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.

 

Go Back   Doom9's Forum > Video Encoding > MPEG-4 AVC / H.264

Reply
 
Thread Tools Search this Thread Display Modes
Old 3rd May 2018, 03:58   #1  |  Link
tppytel
Registered User
 
Join Date: Feb 2017
Posts: 29
Need to adjust colors for PAL DVD?

I'm reencoding a PAL DVD with x264 in order to restore the original frame rate and burn in subs. The resulting file will be playing on North American equipment. Do I need to do anything to adjust for the slightly different color primaries between NTSC and PAL SD, or does x264 handle this for me automatically? Mediainfo on the original PAL DVD rip reports Primaries=BT.601 PAL, Transfer=BT.470 B/G, and Matrix Coefficients=BT.601.

Thanks for any guidance.
tppytel is offline   Reply With Quote
Old 3rd May 2018, 08:04   #2  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,507
If you trust the player, then no, you're done. If this is a one-off use case then that's good enough.

If you're creating it for a wider audience, then it's best to assume no player is sane, and use a colormatrix filter. Your workflow dictates this, but most open source workflows go through ffmpeg, avisynth, or vapoursynth, each of which has a method to colormatrix, and most GUIs directly include the option.
__________________
There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order.
foxyshadis is offline   Reply With Quote
Old 3rd May 2018, 17:44   #3  |  Link
SeeMoreDigital
Life looks better in UHD
 
SeeMoreDigital's Avatar
 
Join Date: Jun 2003
Location: Notts, UK
Posts: 11,648
If it's a 'movie' PAL DVD, the MPEG-2 stream with most likely contain progressive frames.

If this is the case, you can use an application called 'ReStream v0.9.0' to change the MPEG-2 streams flags from interlaced to progressive and reduce its speed from 25.000 fps to 23.976 or 24.000 fps. Thus keeping the original video stream.
__________________
| I've been testing hardware media playback devices and software A/V encoders and decoders since 2001 | My Network Layout & A/V Gear |

Last edited by SeeMoreDigital; 3rd May 2018 at 17:46.
SeeMoreDigital is offline   Reply With Quote
Old 3rd May 2018, 23:19   #4  |  Link
tppytel
Registered User
 
Join Date: Feb 2017
Posts: 29
Quote:
Originally Posted by foxyshadis View Post
If you're creating it for a wider audience, then it's best to assume no player is sane, and use a colormatrix filter. Your workflow dictates this, but most open source workflows go through ffmpeg, avisynth, or vapoursynth, each of which has a method to colormatrix, and most GUIs directly include the option.
I'm using avisynth. And, if it matters, my digital playback usually happens via Plex on a Shield set to output 12-bit, YUV 4:2:2, Rec.2020 video. (There are some Shield-specific colorspace mapping issues there, but let's ignore those for the moment if we can. Pretend I'm setting the Shield to 8-bit YUV 4:2:0 Rec.709 video, which doesn't have mapping issues.)

What I'm not understanding is the difference between the Color Matrix and Color Primaries. As I read the specs and various forum posts, the matrix and transfer values are identical between BT.601/ SMPTE170m and BT.470B/G. But the primaries values are slightly different. But I confess I don't understand exactly what that means. The color matrix coefficients define a mathematical transformation between YUV and RGB, which is the same between NTSC and PAL. But I've read that this is not the same as defining an absolute color representation. I don't get that. It seems to me like if I've defined a function f that maps YUV to RGB, then I've got an absolute color space. What role does the primary specification play?

In any event, the color matrix coefficients are the same between NTSC SD and PAL SD. So avisynth's ColorMatrix function doesn't seem to do anything for me here.
tppytel is offline   Reply With Quote
Old 4th May 2018, 07:33   #5  |  Link
Asmodian
Registered User
 
Join Date: Feb 2002
Location: San Jose, California
Posts: 3,928
Don't get stuck trying to understand matrix and primaries separately. All color space converting functions I have used change everything needed as one operation, ColorMatrix included.

Primaries are what color 100% Red, 100% Green, and 100% Blue are. This is obviously dependent on the screen, it is always 100% R, G, or B. However, if our display is BT.709 (very likely today) and the content was meant to be watched on a PAL TV we want to covert it so it looks correct on our display. Simply do a ColorMatrix conversion in AviSynth.

Edit: I don't actually know what a Shield does with SD or HD video. Does is simply assume everything is BT.709? Does it respect the flags in the source? Does it assume SD is BT.601 and HD is BT.709? It might take some testing with some colorbar encodes, there is no solution that would work for all possibilities.
__________________
madVR options explained

Last edited by Asmodian; 4th May 2018 at 07:44.
Asmodian is offline   Reply With Quote
Old 4th May 2018, 23:13   #6  |  Link
tppytel
Registered User
 
Join Date: Feb 2017
Posts: 29
Quote:
Originally Posted by SeeMoreDigital View Post
If this is the case, you can use an application called 'ReStream v0.9.0' to change the MPEG-2 streams flags from interlaced to progressive and reduce its speed from 25.000 fps to 23.976 or 24.000 fps. Thus keeping the original video stream.
Neat! This worked perfectly. Thanks for the tip - I had never heard of ReStream.

@Asmodian - As I understand it, the Shield assumes 601 or 709 based on the resolution and then maps those colors into the colorspace of the Shield's video output. I'm not sure if it respects flags in the video stream or not. There's also a Shield-specific issue (tangential to my question) where colors are not correctly mapped to Rec.2020. But as far as conversion via avisynth, I'm not sure how I would do that. ColorMatrix only has a generic BT.601 mode - it doesn't distinguish between NTSC and PAL. There's a note in the docs: "For ColorMatrix we assume I709 = S240 and I470=FCC=S170, because the error will be very small."
tppytel is offline   Reply With Quote
Old 4th May 2018, 23:21   #7  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,507
It's true though, you'd need finely a calibrated screen -- and eyes -- to see the faintly brighter colors in one, assuming the display chain even does anything with primary information. The difference between 709 and 601 is much more noticeable; only 2020's primaries make a substantial difference.
__________________
There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order.
foxyshadis is offline   Reply With Quote
Old 5th May 2018, 03:33   #8  |  Link
Asmodian
Registered User
 
Join Date: Feb 2002
Location: San Jose, California
Posts: 3,928
Quote:
Originally Posted by tppytel View Post
As I understand it, the Shield assumes 601 or 709 based on the resolution and then maps those colors into the colorspace of the Shield's video output. I'm not sure if it respects flags in the video stream or not.
Nice, I actually don't mind this behavior. As long as it doesn't use BT.709 for SD video or BT.601 for HD. In this case ReStream is an ideal solution.

Quote:
Originally Posted by tppytel View Post
ColorMatrix only has a generic BT.601 mode - it doesn't distinguish between NTSC and PAL. There's a note in the docs: "For ColorMatrix we assume I709 = S240 and I470=FCC=S170, because the error will be very small."
Note that we don't know which "BT.601" the Shield assumes, my bet would not be PAL but who knows.
__________________
madVR options explained
Asmodian is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 18:06.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.