Bug 425012 - Color shifting / image degradation when importing clip or extracting frame
Summary: Color shifting / image degradation when importing clip or extracting frame
Status: RESOLVED WORKSFORME
Alias: None
Product: kdenlive
Classification: Applications
Component: Video Display & Export (show other bugs)
Version: 20.04.3
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: Jean-Baptiste Mardelle
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-08-04 21:49 UTC by airfullbete
Modified: 2021-10-28 04:35 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
fritzibaby: timeline_corruption+


Attachments
Clip (38.69 KB, video/x-matroska)
2020-08-04 21:49 UTC, airfullbete
Details
Screenshot of ffmpeg.x264rgb.mkv while playing with mpv (27.17 KB, image/png)
2020-08-04 21:50 UTC, airfullbete
Details
Screenshot of clip as seen in the Project monitor (51.99 KB, image/png)
2020-08-04 21:51 UTC, airfullbete
Details
Extracted frame (38.29 KB, image/png)
2020-08-04 21:52 UTC, airfullbete
Details
Screenshot of extracted frame as seen in the Project monitor (52.88 KB, image/png)
2020-08-04 21:52 UTC, airfullbete
Details
Project file (16.59 KB, application/x-kdenlive)
2020-08-04 21:52 UTC, airfullbete
Details
Gimp file containing all 4 images for easy comparison (119.49 KB, application/x-bzip)
2020-08-04 21:53 UTC, airfullbete
Details
Color_Space (42.24 KB, image/png)
2020-08-08 08:46 UTC, emohr
Details
image input1.png (27.17 KB, image/png)
2021-02-12 02:49 UTC, airfullbete
Details
image output1.png (27.18 KB, image/png)
2021-02-12 02:49 UTC, airfullbete
Details

Note You need to log in before you can comment on or make changes to this bug.
Description airfullbete 2020-08-04 21:49:46 UTC
Created attachment 130635 [details]
Clip

SUMMARY

When I load a clip, its colors and sharpness as shown in the Project monitor (with force monitor size = 100%) don't match what can be seen with an external player (e.g. mpv). The colors are dull, the edges more blurry, and there are some artifacts which are not there in the original clip. All of those problems also show up in the rendering.

Even more degradation occurs when a frame is extracted. The png of an extracted frame don't perfectly match the frame itself!


STEPS TO REPRODUCE

1. To create a short static clip, I displayed a 480x300 png image on my screen and recorded it with ffmpeg:
ffmpeg -f x11grab -s 480x300 -r 30 -i :0.0 -c:v libx264rgb -crf 0 ffmpeg.x264rgb.mkv

2. While playing this clip with mpv, I extracted a screenshot. This is the attached file ffmpeg.x264rgb.png

3. This png image matches the original png pixel for pixel. So this can be taken as the original image.

4. I loaded the clip ffmpeg.x264rgb.mkv in Kdenlive and setup the Project monitor at 100% and took a screenshot of it. This is the attached file kdenlive.project_monitor.png

5. I also used the function Extract frame to project. This is the attached file 
kdenlive.frame.png

6. I took a screenshot of the extracted frame as shown in the Project monitor:
kdenlive.project_monitor.frame.png

7. I have added the extracted frame in the project (file project.kdenlive).

OBSERVED RESULT

1. There are apparent differences/degradation in all kdenlive.*.png images compare to ffmpeg.x264rgb.png (and com to kdenlive.project_monitor.png to kdenlive.project_monitor.frame.png. For easy comparison, I have attached a Gimp file with four layers : comparison.xcf.bz2

2. In the project, toggling on and off the visibiliy of the extracted frame shows that the colors are shifting.

EXPECTED RESULT

1. All 4 images should look the same.

2. The image displayed in the Project monitor should match the underlying clip / extracted frame

2. Adding an extracted frame should not change the colors.


SOFTWARE/OS VERSIONS

KDE Plasma Version: 5.18.5
KDE Frameworks Version: 5.70.0
Qt Version: 5.14.2

ADDITIONAL INFORMATION

Project settings were automatically adjusted at the moment the clip was added. They are
Frame size: 480 x 300 (480:300)
Frame rate: 30 fps
Pixel Aspect Ratio: 1
Color Space: ITU-R 601
Interlaced: no

Is this a problem with wrong colorspaces ? If yes, how can this be solved ?
Comment 1 airfullbete 2020-08-04 21:50:50 UTC
Created attachment 130636 [details]
Screenshot of ffmpeg.x264rgb.mkv while playing with mpv
Comment 2 airfullbete 2020-08-04 21:51:29 UTC
Created attachment 130637 [details]
Screenshot of clip as seen in the Project monitor
Comment 3 airfullbete 2020-08-04 21:52:04 UTC
Created attachment 130638 [details]
Extracted frame
Comment 4 airfullbete 2020-08-04 21:52:31 UTC
Created attachment 130639 [details]
Screenshot of extracted frame as seen in the Project monitor
Comment 5 airfullbete 2020-08-04 21:52:53 UTC
Created attachment 130640 [details]
Project file
Comment 6 airfullbete 2020-08-04 21:53:31 UTC
Created attachment 130641 [details]
Gimp file containing all 4 images for easy comparison
Comment 7 emohr 2020-08-07 15:35:12 UTC
Please try with the current Kdenlive AppImage version 20.04.1b to see if there are any packaging issues https://files.kde.org/kdenlive/release/ 

If the problem/issue doesn't occur when using the AppImage, then it's your configuration or packaging.
Comment 8 airfullbete 2020-08-07 16:53:46 UTC
I confirm the issues are still there with the latest Appimage:
kdenlive-20.04.2c-x86_64.appimage
Comment 9 emohr 2020-08-07 17:04:53 UTC
And if you test with Kdenlive_Nightly_Appimage
https://binary-factory.kde.org/job/Kdenlive_Nightly_Appimage_Build/lastSuccessfulBuild/artifact/

WARNING: This version has a new project type that is not backwards compatible... so you won't be able to use older versions to open new files.
Comment 10 airfullbete 2020-08-07 17:10:24 UTC
Unfortunately, the issues persist even with kdenlive-20.11.70-44ce7ae-x86_64.appimage .
Comment 11 emohr 2020-08-08 08:46:46 UTC
Created attachment 130722 [details]
Color_Space

I added to https://invent.kde.org/multimedia/kdenlive/-/issues/411. 

What color space are you using?
Comment 12 airfullbete 2020-08-08 12:40:23 UTC
I use the default color space chosen by Kdenlive. When I import a clip in a blank project, I am being offered to "Switch to clip profile", and I accept. The color space chosen is ITU-R 601. I have also tried with ITU-R 709, but same results.
Comment 13 airfullbete 2021-02-12 02:48:09 UTC
Here is a very simple way to reproduce this bug.

1. Open Kdenlive
2. Add the image input1.png in the project bin
3. Accept the proposed project settings (matching the image size)
4. Add the image to the timeline
3. Export the project as "sequence of png"

I expect the output pngs to be exactly the same as input1.png.

They are not.

I have attached one of the output pngs : output1.png

This color bug is quite annoying. I do a lot of screen recordings and edit them in Kdenlive, but I am unable to preserve the colors in the output file, no matter the exported format. How do you edit screen recordings in kdenlive and preserve color accuracy? Thank you.
Comment 14 airfullbete 2021-02-12 02:49:33 UTC
Created attachment 135608 [details]
image input1.png
Comment 15 airfullbete 2021-02-12 02:49:55 UTC
Created attachment 135609 [details]
image output1.png
Comment 16 Julius Künzel 2021-09-28 22:58:39 UTC
Thanks for your report! We recently fixed a very similar problem (https://invent.kde.org/multimedia/kdenlive/-/issues/411) and I guess this is fixed. Please test with the nightly build and let us know if I it persists otherwise please close this report.
Comment 17 Bug Janitor Service 2021-10-13 04:35:34 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 18 Bug Janitor Service 2021-10-28 04:35:07 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!