Here is a test pattern I have made, mainly for checking color and luminance accuracy:
https://www.youtube.com/watch?v=G86FdE9XhqA
If using Firefox, pause the playback and use a program such as ColorZilla to check the color values in the color patches. The RGB readout (in hex) on ColorZilla should match the text in the color patch. They likely will not match in all cases.
The workflow for making this test pattern was:
bmp file -> online-convert.com to mp4 -> YouTube. I suspect online-convert.com may be an online front end to ffmpeg.
Support our site by donate $5 directly to us Thanks!!!
Try StreamFab Downloader and download streaming video from Netflix, Amazon!
Try StreamFab Downloader and download streaming video from Netflix, Amazon!
+ Reply to Thread
Results 1 to 30 of 45
-
-
Unless this behavior has changed recently, YouTube does not consider any color space description of the uploaded video. Use Rec.709 and it'll have correct colors on YouTube.
-
Is it not safe to assume that rec.709 is being used when a video is being encoded as an mp4 file, presumably using H.264 by, say, ffmpeg or Windows Movie Maker? What other color space might commonly be used for mp4?
I get color errors when the mp4 file is played back locally on different players such as Firefox, Chrome, I.E., Opera or VLC, bypassing any on-line server altogether.
When the unencoded bmp file is viewed locally on any of these programs, there are no color errors. This suggests errors in either the encoding or decoding process or both. -
-
So download video from YT to local HDD and use proper decoder to decode video.
Probably none. -
Are you saying ffmpeg and Windows Movie Maker use bt.601 for mp4 encoding by default?
-
-
I believe you need to add "-vf colormatrix=bt601:bt709" after specifying the input.
-
-
I don't think so. The command converts from one colorspace to the other so it needs both an input and output colormatrix. But why bother asking when it will only take you 10 seconds to try it for yourself?
BTW, I recommend you also specify the colormatrix in the x264 options by adding " -x264opts colormatrix=bt709" after specifying libx264. That will give you the highest probability of the video playing properly.Last edited by jagabo; 31st May 2016 at 19:18.
-
-
Encoding with the following command line:
ffmpeg -y -loop 1 -i test_pattern.bmp -t 10 -c:v libx264 -x264opts colormatrix=bt709 -vf colormatrix=bt601:bt709 -preset slow -crf 18 test_pattern.mp4
Color #942525 appears as #932623. Not the exact color but an approximation.
NOTE: The test pattern has been modified and has different colors than the one you see on YouTube. -
-
As jagabo says - there's going to be rounding errors and other lossess when converting 8bit RGB to 8bit YUV .
You can encode RGB with x264 as well. This will give you perfect color accuracy on test patterns locally. But if it's for youtube, it will get converted to YUV 4:2:0 .
And if your goal is youtube or other streaming platforms - then there are many other problems you will face. In addition to what YT does behind the scenes - there are problems such as browser type /configuration, OS, HW accel on vs. Off , If GPU on, then GPU settings (levels), HTML5 vs. Flash . You will never get 100% consistency across all client configurations. It's a bloody mess right now. -
I'm sure that's true but it needn't be. I've written code to go from RGB to YCbCr in bt.709 space and back to RGB. The math is quite straightforward and I get perfect colors every time.
It's possible that the programmers are taking shortcuts to speed up their code. That's understandable when you're doing real-time playback, but if you're encoding a file not in real time it's questionable. -
You can encode RGB with x264 as well. This will give you perfect color accuracy on test patterns locally. But if it's for youtube, it will get converted to YUV 4:2:0 .
But if it's for youtube, it will get converted to YUV 4:2:0.
there are problems such as browser type /configuration, OS, HW accel on vs. Off , If GPU on, then GPU settings (levels), HTML5 vs. Flash . You will never get 100% consistency across all client configurations. It's a bloody mess right now.
One of the Firefox programmers shared this with me:
When using hardware accelerated video decoding the conversion is left to the GPU and we don't control it.
We will use hardware accelerated video decoding for H264 when available but not for VP8/VP9 -
Nope, you 're converting to YUV444 using Rec601, then converting again to Rec709 but in YUV with that commandline . Also, there is a double conversion because of the colormatrix filter (there would be "less" loss converting only once to YUV using 709 directly, because it's only 1 8bit conversion)
RGB using libx264 in ffmpeg would use "-c:v libx264rgb -pix_fmt rgb24"
Code:ffmpeg -y -loop 1 -i test_pattern.bmp -t 10 -c:v libx264rgb -pix_fmt rgb24 -preset slow -crf 18 test_pattern_rgb.mp4
But if it's for youtube, it will get converted to YUV 4:2:0.
99.99% of distribution video is currently 8bit YUV. This includes streaming content, DVD, Blu-ray. There is no way to go back to original 8bit RGB values with 8bit YUV . In addition, 99.99% of distribution video is chroma subsampled (4:2:0) so there is no way to get exactly the same RGB values.
(But consumer 10bit video is right around the corner being more commonplace with HEVC, for example UHD BD supports it) -
Not with 8 bit integer RGB and 8 bit integer YUV you didn't. Especially not with limited range YUV. There are only about 1/6 as many YUV values that map to RGB values. So 16 million RGB colors map to about 2.5 mllion YUV values. So several RGB values will map to the same YUV value and most colors will be changed on the round trip from RGB to YUV to RGB.
-
Yes, 8 bit RGB can be converted to 10 bit YUV and back without losses. I posted ANSI C code that does it here:
https://forum.videohelp.com/threads/376996-Lossless-Workflows-using-Premiere-Pro-Virtua...=1#post2446709
That's rec.601 but rec.709 isn't too different in that respect. -
@jagabo - yes, I saw that. I don't understand the math or the code, but it sure looks pretty
Nice to get another confirmation as others have shown the mathematical proof as well with matlab . Hopefully things will shape up better when 10bit becomes more common for end user
But in current reality, in most professional video programs, you do get losses with 10bit and higher precision conversions. I think it's primarily from dithering for bit depth conversions - there is no way to turn it off or adjust it. -
-
At least with the old flash (not HTML5), you had some resemblance of control if you hosted your own webpage (not a re-encoding site like YT, which discarded flags and didn't put new ones in). Because flash player payed attention to flags embedded in the stream that governed the YUV back to RGB trip - it was a predictable system that you could work with all client configurations , browsers, OSes to get consistent results. HW on meant Rec601 was used. Always. ; HW off meant user flag, otherwise Rec709. Always.
Now it's a bloody mess. There are 100's of different permutations, and not just Rec601 vs 709
For example YT pays attention to the full range flag now, and clamps the re-encode to 16-235 -
Not with 8 bit integer RGB and 8 bit integer YUV you didn't.
That explains a lot.
Similar Threads
-
VHS Video Test Pattern Tape (PAL)
By VHSRules in forum Capturing and VCRReplies: 2Last Post: 4th Mar 2016, 10:05 -
YouTube Playlist Player - please test
By wiseant in forum Newbie / General discussionsReplies: 0Last Post: 19th Apr 2013, 19:35 -
Delete duplicate frames in a pattern
By dexter30 in forum Newbie / General discussionsReplies: 2Last Post: 19th Sep 2012, 08:53 -
recording test pattern on a vcr from PC
By mammo1789 in forum Capturing and VCRReplies: 11Last Post: 13th Apr 2012, 09:59 -
converting bad laser Sony DVD players into Test Pattern Signal Generators?
By turnkit in forum DVD & Blu-ray PlayersReplies: 5Last Post: 10th Jan 2012, 02:46