I am still struggling with the details of video-conversion.
Now I notice a very noticable change in colors I cannot explain.
I just reencoded the original and extracted the same frame from both videos:
In the resulting images, some colors do not match. This becomes very visible if you open them in two tabs and switch between them.Code:%ffmpeg% -i Original.mp4 -c:v libx264 -preset fast -crf 10 -an "264.CRF10.mp4" %ffmpeg% -i "Original.mp4" -ss 00:00:05 -vframes 1 -s 1920x1080 "Original.png" %ffmpeg% -i "264.CRF10.mp4" -ss 00:00:05 -vframes 1 -s 1920x1080 "264.CRF10.png"
I had a look into the details of the original using mediaInfo.
The last 4 rows are missing in the newly encoded video.Code:Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Scan type : Progressive Bits/(Pixel*Frame) : 0.402 Stream size : 58.4 MiB (100%) Color range : Limited Color primaries : BT.709 Transfer characteristics : IEC 61966-2-4 Matrix coefficients : BT.709
Is this the issue? How do I get the settings there?
Original:
264.CRF10:
![]()
+ Reply to Thread
Results 1 to 25 of 25
-
-
The x264 image is being converted to RGB with rec.601 colors, not rec.709 colors (internally the video is stored as YUV, so it has to be converted to RGB for display). The important setting is the Matrix Coefficients. You can add them while encoding with x264 adding "--colormatrix bt709" to the x264 command line. The other flags don't really need to be set but you can do so with --colorprim "bt709", --transfer "bt709", and don't use --fullrange (there's not an explicit limited range command). For SD video use bt470bg instead of bt709. Note that ffmpeg uses a single hyphen instead of two.
If the colormatrix isn't specified most players will assume rec.709 for HD, rec.601 for SD, limited range for both. In between 720x576 (SD) and 1280x720 (HD) behavior depends on the particular player. Some players always use one or the other matrix, even if the matrix is specified. And your graphics card settings can effect this too.
In AviSynth you can use the ColorMatrix() filter to convert between rec.601 and rec.709. ColorMatrix(mode="rec.601->rec.709") or ColorMatrix(mode="rec.601->rec.709"). Also, when converting back and forth between YUV and RGB ConvertToRGB(matrix="rec709"), ConvertToRGB(matrix="rec601") and similar arguments for ConvertToYV24(), ConvertToYV12(), ConvertToYUY2(), etc.
https://forum.videohelp.com/threads/329866-incorrect-collor-display-in-video-playback?p...=1#post2045830 -
Thank you!
Using your information, I found another hint, how to set the parameters without having to know the details:
-color_primaries 1 -color_trc 1 -colorspace 1
Seems to be working fine as well.
Only the value for "Transfer characteristics" is set to "BT.709" instead of "IEC 61966-2-4".
I really cannot see any difference in the picture... -
http://stackoverflow.com/questions/37255690/ffmpeg-format-settings-matrix-bt709
I do not find these parameters in the docs either.Last edited by Epaminaidos; 26th Sep 2016 at 07:13.
-
I noticed in your comparison pictures you posted in the other thread, that the colors did change. But when I indexed all your videos with L-SMASH and Avisynth, none of them had any real color difference, besides normal compression artifacts. And decoding all your videos in VLC seemed to also have the same color. However when trying to capture snapshots through VLC, I would get different image snapshot sizes between videos like 1920x1088 and 1920x1090. But using L-SMASH and Avisynth I managed to get standard 1920x1080. So I'm not sure what is going on.
-
-
Color issues are virtually impossible to diagnose unless you have a color managed workflow that can bypass the YUV to RGB conversion. Avisynth and its legion of filters fail miserably at this. ffmpeg exhibits similar shortcomings as well. If you care about color, you should eliminate Avisynth and ffmpeg from your workflow. Otherwise, you need to be extremely careful, and even then, success can be fleeting.
-
AviSynth is fine for the job, problem are the users not understanding why there's a problem when doing RGB screenshots via e.g. VirtualDub from an YUV script. AviSynth gives you good control over all involved conversions and you can check at all points via info() that you didn't accidentally do any color conversion.
-
Sure, if all your video is ripped or capped. But for those who produce their own video, it is so woefully inadequate; I don't even know where to begin. Vapoursynth reportedly picks up where Avisynth left off, but I have yet to get it running on my system. And honestly, the world of video is moving too fast now to wait on these tools anymore.
-
"[QUOTE=shekh;2460978] Oh - it was not to point anything to anyone except information, this settings was added to ffmpeg relatively not so long ago (year, maybe 1.5) - they are present in documentation but i can imagine not many people search for this.
Ffmpeg can be nasty as some conversions are performed in background silently without telling anything as such i prefer to disable for example level quantization changes by explicitly guiding ffmpeg - i would advise you to specify clearly all information before and after invoking source - this should force ffmpeg to at least some quasi static state, additionally scaler with not changed size but defined colour space and quantization range may be recommended - this is a bit overkill but at least you can restore partially control over process.
for example:
Code:ffmpeg.exe -color_primaries 1 -color_trc 1 -colorspace 1 -color_range 2 -i "file" -color_primaries 1 -color_trc 1 -colorspace 1 -color_range 2
-
-
LOL, I know bashing Avisynth is flamebait on VH and a bannable offense on doom9, but I think users need to be made aware of Avisynth's problems. How is acting like Avisynth is flawless not a higher than thou mentality?
Like I said, I can't even begin to list all the "reasons" I don't like Avisynth. Color is just one area where Avisynth really struggles, and I thought pandy's link to my M2TS->ProRes thread was a good starting point. You can also read the vapoursynth blog. He clearly hates Avisynth, probably as much as I hate Python. -
This is main difference between industry standard and developer standard formats (codecs, containers etc) - in broadcast standards all this is specified as multiple sources and customers need to have full control over content, in developer world usually such things are meaningless as "it works for me" - classical example are VPx codecs - they are developed by developers for developers and usually don't care for such things.
To address your question more technically than socially - i would expect that information like this is carry by elementary stream itself so it can be remuxed to various containers without loosing this information - elementary stream must be self sustained. -
The higher than thou statement was refering to you saying that avisynth is only good if you are a capper/ripper.
More REASONS!, but you don't have the time to explain. Maybe you could make thread on the downfalls on avisynth (especially 4:2:0 only Avisynth), along with samples and scripts to recreate these many many problems that you find.
As you have been hitting this 4:2:0 only drum for awhile now on VH, without any proof. I've seen other members here get banned for spreading false information.
Not all of us are as fortunate as you to produce 4K content through our cellphones. -
I stand by all my statements and make no apologies. What is stupid and higher than thou is the wave of backlashes inflicted on anyone who criticizes Avisynth unless they go through strenuous efforts to document in painstaking detail every problem as you suggest. If you are unaware of its limitations, then you haven't pushed it very hard. And since it works for you, there really is no need for me to provide reasons; is there? How about this, since you are tired of my drum? If you ever encounter an issue, why don't we compare notes then?
-
Of course, there are always alternatives. I already mentioned vapoursynth above which has ported most of the important filters from Avisynth and has fixed some of the nagging bugs/limitations. But you didn't really need me to tell you that did you?
-
Well - vapoursynth doesn't change fundamentally concept of a tool - and as i understand most of your complains is the Avisynth idea itself.
Similar Threads
-
How can I stream h264 files with FFmpeg over rtmp without reencoding?
By Ninelpienel in forum Video Streaming DownloadingReplies: 4Last Post: 11th Mar 2016, 12:47 -
How to cut video with ffmpeg with the same quality without reencoding
By alexander121 in forum EditingReplies: 6Last Post: 8th Dec 2014, 02:36 -
Are there any good tools to change aspect ratio of video without reencoding
By Stears555 in forum Video ConversionReplies: 1Last Post: 7th Oct 2013, 08:11 -
Change PAR without reencoding, AVI file, XVID, H.263
By spyderrp7 in forum Video ConversionReplies: 13Last Post: 22nd Dec 2012, 12:37 -
can tsmuxer change h.264 mov to m2ts files without reencoding?
By Onceler2 in forum Video ConversionReplies: 2Last Post: 20th Mar 2012, 04:47