Hello everyone,
I’ve been struggling to get the colors of my videos for YouTube right for quite a while now. The colorspace, color_trc, color_primaries, color_range settings when exporting e.g. H.264 video do make a difference not only when uploading to YouTube but also with other media players. Also, most players show colors differently/incorrectly depending on their settings, e.g. whether they use GPU acceleration or not, which is also true for different web browsers when viewing HTML5 video. By “getting the colors right” I actually mean to merely maximize compatibility since there always seems to be some combination of settings which makes some browser misbehave and show colors incorrectly. I aim to make it look correctly at least on the most common browsers.
Although this general interoperability issue is a topic for itself, I would like to focus on one specific observation that I made and would like to ask whether this is a possible error in one of the software involved, or if it’s some oversight on my part.
YouTube appears to default to BT.709 matrix coefficients, transfer characteristics and color primaries (and limited/mpeg color range) if no more specific information is given in the metadata of the video being uploaded. This can be seen by uploading e.g. a RGB video using the utvideo codec or creating a slideshow of a color test image I provide below such that it’s up to YouTube to decide how to convert it to YUV. If you download the MP4 created by YouTube and take a look at the metadata using e.g. “mediainfo”, you will see that everything is set to BT.709. Also, the colors of the resulting video look (almost) perfect on most platforms like GPU-accelerated browsers or mplayer (for instance, measure the fully saturated RGB colors in the resulting video, they should be almost perfectly 255,0,0; 0,255,0; 0,0,255).
Since the default for YouTube seems to be BT.709, I would like to have a workflow with shotcut to generate BT.709 videos for uploading to YouTube, but there is an issue:
If I import the color test image into shotcut and set the profile to use the BT.709 color space, export a clip of the image using libx264 and either upload the result to YouTube or view it in mplayer, the fully saturated colors are incorrect. For instance, the fully saturated green is rather something like 19,255,6 in RGB (too bright) while the red is something like 232,0,1 (too dark). Taking a look at the metadata of the video, the color primaries property is not set, but even adding “color_primaries=bt709” manually in the export settings of shotcut doesn’t seem to make a difference to the resulting colors.
So my question is whether this is a possible problem with color conversion in shotcut or mlt regarding the BT.709 color space. It should be noted that this is not limited to the color test image as input – the colors of other input videos, also in other color spaces, yield similar results, but I wanted to focus on one particular scenario that might be useful for reproducing the problem.
Let me know if I should provide more details.
EDIT: I tried to create a BT.709 video using only ffmpeg and it seems to work fine, at least the colors look correct to me and different from what shotcut outputs. Example command line to generate a video from the test image using ffmpeg 3.2.1 as reference:
ffmpeg -loop 1 -i OchiColorTest_v2.png -c:v libx264 -colorspace bt709 -color_trc bt709 -to 0:10 output.mp4