Youtube colour problems when frameserving to FFMPEG

Robert W wrote on 11/30/2017, 5:35 PM

I've been testing renders from Vegas 12 with the encodes managed by FFMPEG via Debugmode Frameserver 2.14. By the time they are uploaded to Youtube the colour levels are getting completely messed up.

The source material in the project is 1280x720 progressive, and the project settings are 1280x720 progressive set to 25 fps. I have a levels filter doing a Studio RGB to Computer RGB level conversion on the master bus. This is then rendered to the Debugmode Frameserver set to output YUY2 pointing to a file named render1.avi. FFMPEG accesses the file with an AVISynth script that looks like this:

Avisource("M:\AmigaRob\render1.avi")

The command I used to start the encoding is as follows (upscaling to 4k and 50 FPS - There is method in my madness):

ffmpeg -i "frameserverc.avs" -vf scale=3840:2160 -r 50 -c:v libx264 -preset slow -crf 18 -c:a copy -pix_fmt yuv420p output.mkv

If I render direct from Vegas using the Mainconcept MP4 codec, it comes out looking correct like this by the time it gets to Youtube:

Direct from Vegas Mainconcept codec:

But the FFMPEG output looks completely wrong, with pure black looking gray and a similar shift in an opposite directs on the whites:

I have read a couple of things online suggesting that this is due to an issue with the colour standard defaulting to Rec 602 when Youtube expects Rec 709. I have tried to add a clause to do this conversion in the FFMPEG command line, but it just looks the same.

Can anybody spot where I am going wrong? Any help will be very gratefully received.

(BTW, these example videos are not very good content wise. I am testing some workflows for another project...)

Comments

Robert W wrote on 11/30/2017, 5:40 PM

Hmmm, this is strange. As the videos appear embedded in this post, I can not see the colour shift. Could it be it is the Youtube web site side player or my graphics car/driver causing the shift?

GJeffrey wrote on 11/30/2017, 5:48 PM

Set FrameServer output to RGB.

Add a ConvertToYV12 function with the appropriate 709 matrix to yr avs file.

Robert W wrote on 12/1/2017, 4:42 AM

Set FrameServer output to RGB.

Add a ConvertToYV12 function with the appropriate 709 matrix to yr avs file.


Thank you! I switched the frame server to RGB32 and changed the avs file to the following:

ConvertToYV12(Avisource("M:\Amiga Rob\render2.avi"), matrix="pc.601")

This gave a video with much better looking levels. There is still some tweaking to be done, but I can at least put videos out with these settings. Thank you very much for your assistance. It is greatly appreciated.

GJeffrey wrote on 12/1/2017, 5:46 AM

For hd video you shoulf use a 709 matrix.

if you set your luminance level within Vegas to 16-235 use matrix=pc709 if you set your luminance level to 0-255, use matrix=rec.709.


By the way , you'd better change the framerate with avisynth rather than ffmpeg (and remove the r argument in your command line). The quality will be Better

Robert W wrote on 12/1/2017, 6:02 AM

Thank you. I am not sure if I can trust what I am seeing on my screen. I noticed that with Rec.709 I was losing some of the lightest blue colour bands. As the source is an emulator and I know exactly what the colours should be as I can recreate the source, and I know that there must be some significant clipping occurring when using the Rec 709 settings, so i will have to experiment to see if the clip is happening at some point when the image is decoded on my screen.

Regarding the 'r' argument, I am just looking to double the frame with straight duplication, rather than any interpolation or motion estimation. Would there be any benefit to using AviSynth for that purpose? The reason for doing this is that I am testing whether Youtube gives prominence in search engine results to 4k 50/60 fps video, as well as triggering the use of VP9 on Youtube's side. From what I can see, Youtube does not actually recognise 50 fps as a special frame rate anyway. I need to test with some real 50 fps output, as it may be that it is just detecting that it is faked 50fps.

Thank you for your further help, it is very useful and appreciated!