More tests of youtube upload! I'm working on gba encodes, which get "HD" processing at 1920x1280. My goal is to give an appropriate matrix for them, so the test uploads are at 1920x1280.
Step 1: The test pattern. Redirect output to pattern.y4m; this takes about 1GB of HDD space.
http://pastebin.com/YDjjXPST
Step 2: encode (8 bit x264)
x264 --qp 0 -o lossless_undef.h264 pattern.y4m
x264 --colorprim smpte170m --transfer smpte170m --colormatrix smpte170m --qp 0 -o lossless_bt601.h264 pattern.y4m
x264 --colorprim bt709 --transfer bt709 --colormatrix bt709 --qp 0 -o lossless_bt709.h264 pattern.y4m
Step 3: Verify that x264 has not touched the colors AT ALL and all three samples are identical except for VUI
ffmpeg -i pattern.y4m -f rawvideo md5:
ffmpeg -i lossless_undef.h264 -f rawvideo md5:
ffmpeg -i lossless_bt601.h264 -f rawvideo md5:
ffmpeg -i lossless_bt709.h264 -f rawvideo md5:
I got md5=4d0b4a461f189366e7c4152b8257b70c for all four cases
Step 4: mux. h264 in mkv is the same way i've been muxing for yt upload
mkvmerge -o undef.mkv --default-duration 0:30fps lossless_undef.h264
mkvmerge -o bt601.mkv --default-duration 0:30fps lossless_bt601.h264
mkvmerge -o bt709.mkv --default-duration 0:30fps lossless_bt709.h264
Step 5: upload.
http://www.youtube.com/watch?v=I0A4wNhAAUg
http://www.youtube.com/watch?v=Ksn55lGtpx0
http://www.youtube.com/watch?v=HRWgLlKnrcQ
Step 6: Avisynth script to compare to.
# requires ffms2.dll
FFVideoSource (source="undef.mkv", cache=false)
#convert to RGB internally; hopefully player leaves it unmolested
clip601 = ConvertToRGB24 (matrix="rec601").Subtitle ("601",
\ y=640, align=5, first_frame=0, last_frame=299, size=96.0, text_color=$20FFFFFF, halo_color=$20000000)
clip709 = ConvertToRGB24 (matrix="rec709").Subtitle ("709",
\ y=640, align=5, first_frame=0, last_frame=299, size=96.0, text_color=$20FFFFFF, halo_color=$20000000)
clip601 + clip709
Step 7: Watch the avisynth script in your favorite video player and the youtube videos in a youtube window.
Conclusion: All 3 uploaded videos are understood by youtube as rec601 at resolutions 240p, 360p, 480p, 720p, and 1080p, and are understood by youtube as rec709 at resolution "original". The VUI hints in the h264 stream are completely ignored in all cases.