Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
|
|
Thread Tools | Search this Thread | Display Modes |
11th March 2019, 09:41 | #1 | Link | |
Registered User
Join Date: Sep 2006
Posts: 1,657
|
Do we still need to convert colorimetry of DVD source in vapoursynth?
I have this confusion on the colormatrix filter in avisynth for years now. According to its documentation, the reason for its creation was that commercial mpeg2-encoded dvd were encoded using rec709, while the old avisynth was using rec601. So to correctly display the color in avisynth, it has to convert the dvd color to rec601. From my understand, this was a workaround for avisynth's inability to correctly display rec709?
But then in this documentation, it was saying a complete different thing and usage of the filter: http://avisynth.nl/index.php/Colorimetry Quote:
And then what about vapoursynth? Do we still need to do this conversion? I'm so confuse. |
|
11th March 2019, 11:52 | #2 | Link |
Excessively jovial fellow
Join Date: Jun 2004
Location: rude
Posts: 1,100
|
Rec.601 was typically used for standard definition broadcast content back in the day, that part is correct, and probably for DVD's originating with broadcast content, as well as older movie DVD's (before HDTV became common). It was never really consistent though, AFAIK. These days you shouldn't need to guess colorimetry if you have an actual DVD or broadcast source - there will almost certainly be metadata that specifies the colorimetry.
That being said, the main reason for converting to Rec601 wasn't that Avisynth didn't handle it (it doesn't matter as long as you're working in YUV, it's only relevant if you're converting to RGB), it was that pretty much all video players and renderers assumed Rec601 colorimetry, so colors would look kinda off when viewing if you kept Rec709 unchanged. These days though you should usually not need to convert colorimetry between SDR colorspaces - just make sure the metadata is kept intact and any decent player will do the right thing when converting to RGB for display. Vapoursynth (or rather zimg) behaves similarly and will use colorimetry metadata when converting to RGB, if available. I believe zimg will actually throw an error if it can't figure out the colorimetry and you haven't specified it explicitly. Last edited by TheFluff; 11th March 2019 at 11:56. |
11th March 2019, 16:45 | #3 | Link | ||
Registered User
Join Date: Sep 2006
Posts: 1,657
|
Quote:
Quote:
|
||
11th March 2019, 20:31 | #4 | Link | |||
Excessively jovial fellow
Join Date: Jun 2004
Location: rude
Posts: 1,100
|
Quote:
Quote:
This has not been necessary for least a decade now, since better video players and renderers that could handle both conversions (YUV/601->RGB and YUV/709->RGB) started to appear and effectively solved the problem. For the last few years the problem has instead been converting HDR to SDR on playback in a reasonable way, since most computer monitors can't really display HDR properly, but that's an entirely different story. Quote:
For DVD's/SD content in general that's good enough; for HDR or other more exotic colorspaces you need more metadata. Here's an old thread I quickly googled up if you want some more info about the x264 options. e: forgot to mention - if the video stream doesn't have any colorimetry metadata, some (many?) players will do a quick-and-dirty guess about the input colorimetry and assume Rec601 if the video's vertical resolution is SD-ish (less than 600 pixels tall, or so), and Rec709 if it's more than that. Last edited by TheFluff; 11th March 2019 at 20:50. |
|||
11th March 2019, 20:59 | #5 | Link |
Registered User
Join Date: May 2011
Posts: 348
|
While doing this in Vapoursynth, I'd keep an eye on what matrix you have in prop loaded in Vapoursynth:
frame = clip.get_frame(0) clip = core.text.Text(clip, str(frame.props)) # print(frame.props) if _Matrix=2 , unknown , you'd need to specify matrix_in_s='something' (but anyway you should flag it in an encoder) for conversions or even change it if you do not trust your source: clip = core.std.SetFrameProp(clip, prop="_Matrix", intval=5) or if you want to simulate colormatrix in Avisynth: clip = core.resize.Bicubic(clip, matrix_in_s='709', matrix_s='470bg') or clip = core.resize.Bicubic(clip,matrix_s='470bg') if Vapoursynth is aware of input matrix in prop, _Matrix=1 (that is '709' or some proper value) Last edited by _Al_; 11th March 2019 at 21:12. |
12th March 2019, 03:22 | #6 | Link | |
Registered User
Join Date: Sep 2006
Posts: 1,657
|
Quote:
Code:
clip = core.std.SetFrameProp(clip, prop="_Matrix", intval=5) Last edited by lansing; 12th March 2019 at 03:24. |
|
12th March 2019, 04:19 | #7 | Link | ||
Registered User
Join Date: Sep 2007
Posts: 5,517
|
Quote:
Quote:
When you pipe data out, it's just YUV data , with Y4M header (or in the case of raw data, no header) , which do not convey color matrix info . The recieving application does not see the "prop" data or anything. Only things like fps, dimensions, pixel format are conveyed by Y4M For x264 (and x265) those VUI flags you set such as --colormatrix do not change the actual YUV data, they are just flags or labels. Some players read the flags and adjust, some do not. But nothing is automatically set by the pipe or Y4M header in terms of matrix/transfer/primaries So for SD to SD, you don't have to do anything, unless the source video had something set incorrectly (e.g. it was flagged incorrectly somewhere along the way), because that might affect some of the operations you do (filters) . If you're not filtering or anything, you don't have to do anything differently For example, a fairly common issue might be a progressive SD video, but encoded with interlaced flag. A PAL DVD for example. Or some types of progressive consumer AVCHD videos (which are not native progressive, but encoded interlaced). If you resized it, it would be resized in an interlaced manner by most filters, instead of progressive if you didn't set the props or explicitly override the filter. It's a good idea to display the clip props to help prevent mixups like that |
||
12th March 2019, 09:09 | #8 | Link | |||
Registered User
Join Date: Sep 2006
Posts: 1,657
|
Quote:
Quote:
Quote:
Code:
dvd_clip = blah hd_clip = bleh dvd_clip = core.resize.Bicubic(dvd_clip , matrix_in_s='170m', matrix_s='709') dvd_clip + hd_clip |
|||
12th March 2019, 15:28 | #9 | Link | ||
Registered User
Join Date: Sep 2007
Posts: 5,517
|
Quote:
Quote:
The dvd upscale section needs to be actually converted to as if it had used 709 colors, which you are doing there (colormatrix filter might have been used in avisynth) . But you need to add the width= , height= args. But if dvd_clip had interlaced TFF or BFF prop, it would resize as interlaced |
||
13th March 2019, 00:02 | #10 | Link | |
Registered User
Join Date: Sep 2006
Posts: 1,657
|
Quote:
And in that opengl setting in vlc, the display primaries was set to Bt.709, that's probably why all my videos are default to BT.709 despite having a colormatirx flag on the video. |
|
Tags |
colorimetry, colormatrix, conversion |
Thread Tools | Search this Thread |
Display Modes | |
|
|