PDA

View Full Version : Colourspace conversion ? 1080i -> 576i DVD


halsboss
14th September 2008, 09:45
Think I've been missing something .
Have used .TS -> VideoReDo QuickStreamFix -> DGindex -> Avisynth -> HC
eg
MPEG2Source("c:\test\test.d2v",cpu=6)
buit have never used anything like what I saw on another board ...
ColorMatrix(mode="Rec.709->Rec.601")

Australia, 1080i MPEG2 ... do I need a conversion of that kind ?

scharfis_brain
14th September 2008, 13:38
depends on the colour mode of your source video 709 or 601
and the ability of your mpeg2-encoder to switch between 709 and 601.
dgdecode will tell you which mode your source video was encoded in.

halsboss
14th September 2008, 15:02
Thanks! DGIndex says "BT709*" and it's HC023 used to encode ... if PAL DVD is BT601 then I suppose I should be using ColorMatrix(mode="Rec.709->Rec.601") ?
This is the code in question:-
MPEG2Source("c:\test\test.d2v",cpu=6) # 1080i PAL -> DVD
Converttoyv12(interlaced=true)
Global NewHeight=576
Global NewWidth=704
SeparateFields()
Shift = (GetParity() ? -0.25 : 0.25) * (Height()/Float(NewHeight/2)-1.0)
E = SelectEven().Spline36resize(NewWidth, NewHeight/2, 0, Shift)
O = SelectOdd( ).Spline36resize(NewWidth, NewHeight/2, 0, -Shift)
Ec = SelectEven().Spline36Resize(NewWidth, NewHeight/2, 0, 2*Shift)
Oc = SelectOdd( ).Spline36Resize(NewWidth, NewHeight/2, 0, -2*shift)
#E = SelectEven().Lanczos4resize(NewWidth, NewHeight/2, 0, Shift)
#O = SelectOdd( ).Lanczos4resize(NewWidth, NewHeight/2, 0, -Shift)
#Ec = SelectEven().Lanczos4resize(NewWidth, NewHeight/2, 0, 2*Shift)
#Oc = SelectOdd( ).Lanczos4resize(NewWidth, NewHeight/2, 0, -2*shift)
Interleave(E, O)
IsYV12() ? MergeChroma(Interleave(Ec, Oc)) : Last
Weave()

Hmm, also wondering if NTSC HDTV sources are different ? Guess I'll have to google to find out if there's a quick reference, unless someone has a link and/or some knowledge to share ?

halsboss
14th September 2008, 15:09
HC's manual says
*COLOUR
parameter colorimetry type integer
Status not required
Default -
Example *COLOUR 5
This command flags the colorimetry of the stream by outputting the Sequence Display Extension
header. For playback this header is ignored (Rec.601 will always be used for SD color
conversion, Rec.709 for HD color conversion) but it's useful for MPEG2 compliancy.
Possible settings: 1: BT.709, 4: BT.470-2M, 5: BT.470-2BG, 6: SMPTE170M, 7: SMPTE240M.
By default this header is not written.
and I'm no wiser on whether HC detects incoming colorspace and converts it automatically or not.

Here http://forum.doom9.org/showthread.php?p=1058881#post1058881 jdobbs says default DVD spec is bt709 ...

Well well, I just checked a couple of recordings with DGindex and PAL HDTV 1080i (after a VideoReDo Quickstreamfix) comes up as "BT.709*" and PAL SD 576i comes up as "BT470-2 B,G*" ...

Till now with SD I've been simply using .TS -> VideoReDo QuickStreamFix -> straight into a DVD author program without any recoding/tinkering and it authors/records/plays DVD OK. Wonder what it's doing ?

With HDTV the steps were .TS -> VideoReDo QuickStreamFix -> DGindex -> Avisynth to SD size -> HC -> author to DVD so I wonder what colourspace it ended up as on the DVD (and whether it's right).


EDIT: http://forum.doom9.org/showthread.php?p=1060292#post1060292 says "DGIndex won't show Rec.601 unless there is a sequence_display_extension() calling it out. If it is missing, DGIndex assumes Rec.709 (as it should)." so I'm not sure if that's of much help then... I'm not sure if there's any rec.601 or not :)

halsboss
14th September 2008, 15:37
http://www.dvddemystified.com/dvdfaq.html#1.1 says Pictures are subsampled from 4:2:2 ITU-R BT.601 down to 4:2:0 before encoding, allocating an average of 12 bits/pixel in Y'CbCr format. which seems to impliy DVD's (which are essentially SD size) are supposed to be BT.601 ...

http://www.glennchan.info/articles/technical/hd-versus-sd-color-space/hd-versus-sd-color-space.htm has a nice ""HD" versus "SD" color space" roundup too, which says The 3 sets of primaries in common use today are usually referred to as EBU, SMPTE C, and Rec. 709. All modern HD formats use Rec. 709 primaries (there are some obsolete HD formats that do not) while the standard for SD is either EBU or SMPTE C, depending on the country ... The EBU primaries are the standard for PAL countries and Japan ... The Rec. 709 set of primaries are a (silly) political compromise between the EBU and SMPTE C primaries. EBU red and blue were adopted, with a green halfway between EBU and SMPTE C.

http://encyclopedia2.thefreedictionary.com/ITU-R%20BT.601 talks about bt.601 and by.709


Interestingly, http://forum.doom9.org/showthread.php?p=807257#post807257 says
5 ITU-R BT.470-2 (exactly the same as ITU-R BT.601)
(recommendation BT.601 is an update BT.470-2) and You should use the interlaced=true parameter in ColorMatrix
Can anyone confirm whether that means my "BT470-2 B,G" is in fact bt.601 ?

pandy
15th September 2008, 12:15
halsboss - in fact You can have on DVD mpeg with BT.709 so transcoding of colorspaces is not mandatory.

btw
470 BG it is BT601 (norm 470 is for analog signal, norms 601 and 656 for digital representation of the 470)

halsboss
24th September 2008, 12:59
OK. Pandy, how do I tell HCEnc this and ensure it does the right thing with producing the .mpv ? If I have an SD clip and an HDTV clip to combine into a 2-title DVD I guess I should settle on a standard ...

Unless someone says otherwise, assuming (a) AU PAL HDTV is Rec.709 and (b) AU PAL SD is Rec.470-2B,G (which is really Rec.601) (c) that HCEnc is my encoder and (d) PAL DVD is Rec.601, then I suppose I'll settle for this when processing HDTV

MPEG2Source("Input.d2v",info=3,ipp=true,cpu=4) #ipp=true means interlaced; cpu=4 means deblock luma, chroma;info=3 means give colormetry etc hints
ColorMatrix(mode="Rec.709->Rec.601",hints=true,interlaced=true,threads=4)

where colormatrix is the latest from tcritical at http://bengal.missouri.edu/~kes25c/

halsboss
28th September 2008, 03:27
Well, so much for that theory... the combination of HC with the colorspace plugin yields "odd" reds ... if I leave that off, it seems fine. Oh well, less cpu cycles used anyway. So, the result seem to be for Aus HDTV->DVD :-

Assuming (a) AU PAL HDTV is Rec.709 and (b) AU PAL SD is Rec.470-2B,G (which is really Rec.601) (c) that HCEnc is my encoder, then I suppose I'll settle for this when processing AU HDTV

MPEG2Source("Input.d2v",info=3,ipp=true,cpu=4) #ipp=true means interlaced; cpu=4 means deblock luma, chroma;info=3 means give colormetry etc hints
#ColorMatrix(mode="Rec.709->Rec.601",hints=true,interlaced=true,threads=4) # nope, don't use this for Aus HDTV -> DVD via HCenc

Wilbert
28th September 2008, 18:23
Well, so much for that theory... the combination of HC with the colorspace plugin yields "odd" reds
It shouldn't. Most players ignore the header, or assume Rec.601 when playing dvd's.

If i understand it correctly, HC doesn't write the colorimetry parameter in the header. Meaning that it should be treated as Rec.601. Yes, first we thought it should be treated as Rec.709 (like jdobbs stated at that time), based on some outdated mpeg-2 specs. Based on the latest mpeg-2 specs, and what players do, we changed our opinion. I'm sure you can find those discussions in the AviSynth forum, or wherever they took place.

What does info=1 report on the source?

MPEG2Source("Input.d2v",info=1,ipp=true,cpu=4)

More important. How are you playing the file?

halsboss
29th September 2008, 03:37
What does info=1 report on the source?

MPEG2Source("Input.d2v",info=1,ipp=true,cpu=4)

More important. How are you playing the file?

:) just deleted the source, just my luck. Will capture another -> VideoRedo -> Avisynth -> author DVD -> Nero burn -> Play with standard Sony Aus DVD player. Not sure why but the reds seemed "pinker". Beats me.

pandy
29th September 2008, 09:52
OK. Pandy, how do I tell HCEnc this and ensure it does the right thing with producing the .mpv ?


Hmm... i simply use *COLOUR 5 or *COLOUR 1 and HCEnc properly signaling chosen color space inside Sequence Display Extension


If I have an SD clip and an HDTV clip to combine into a 2-title DVD I guess I should settle on a standard ...


I think that DVD should not "guess" colorimetry if decoded MPEG-2 stream is valid from DVD point of view and have valid Sequence Display Extension


Unless someone says otherwise, assuming (a) AU PAL HDTV is Rec.709 and (b) AU PAL SD is Rec.470-2B,G (which is really Rec.601) (c) that HCEnc is my encoder and (d) PAL DVD is Rec.601, then I suppose I'll settle for this when processing HDTV


If i have MPEG-2 with valid Sequence Display Extension then DVD player must fulfill MPEG-2 standard - if from unknown reason DVD player is not capable to properly decode and display valid MPEG-2 stream with valid Sequence Display Extension then such DVD player is not compatible with MPEG-2 standard

pandy
29th September 2008, 09:56
If i understand it correctly, HC doesn't write the colorimetry parameter in the header.


HCEnc properly signaling colorimetry - streams produced by HCEnc are correct (they have valid Sequence Display Extension)