PDA

View Full Version : DVD2AVI Questions


Cyberia
26th October 2003, 22:07
Can someone explain the purpose of the "Colorspace" and "YUV->RGB" selectors in DVD2AVI? I thought all DVDs were YV12, which isn't even an option! Shouldn't it be? So I clearly must be misinterpreting what this does.

As for "YUV->RGB" I admit I have no idea.

hakko504
26th October 2003, 22:22
It's quite obvious really, the option tells DVD2AVI how to convert the colorspace before sending the data to the encoding part. And DVD2AVI always converts the YV12 data of the DVD to YUY2 before continuing. mpeg2dec3 (and later) on the other hand will give you YV12 when you use AviSynth.

And no, every DVD isn't YV12, though there are very few DVD's who isn't YV12.

RGB is the space used on every screen...

Cyberia
26th October 2003, 22:38
So if the DVD is in YV12 and we want to do this:
VOB->DVD2AVI->MPEG2DEC3x->AviSynth
then there is ALWAYS a YV12->YUV2->YV12 conversion happening?

How can MPEG2DEC3x output YV12 if DVD2AVI only outputs YUV2 or RGB?

hakko504
27th October 2003, 08:17
|----->DVD2AVI--------\
VOB----------------MPEG2DEC3----->AviSynth

When you use mpeg2decx, you do not pass video data through DVD2AVI. DVD2AVI only creates a .d2v file which tells mpeg2dec where to find frames. So in that case no colorspace conversion is made.

Cyberia
27th October 2003, 08:23
ahh, so both of those settings ONLY affect avi's created directly by DVD2AVI?

hakko504
27th October 2003, 08:26
Originally posted by Cyberia
ahh, so both of those settings ONLY affect avi's created directly by DVD2AVI? Mostly Yes. The settings is written into the .d2v file but is not used by mpeg2decx. vfApi on the other hand does check that RGB has been selected.

Nic
27th October 2003, 10:15
I assumed all DVDs would be YV12 as well...do you have an example of a dvd that uses 4:2:2 or 4:4:4 hakko? I wouldn't mind getting hold of that, as 4:2:2 stuff is quite rare here.

Cheers,
-Nic

hakko504
27th October 2003, 13:01
I recall from reading the DVD specs that other colorspaces are allowed inside DVD's. I have yet to encounter one though.

trbarry
27th October 2003, 14:05
I recall from reading the DVD specs that other colorspaces are allowed inside DVD's.

That is actually an interesting bit of info. I wonder if any of the current hardware players could play DVD's made with other color spaces?

Making a regular DVD out of HDTV captures is limited to only 480 or 576 lines or something. If YUY2 or RGB was allowed that would at lest increase the color resolution. But they probably wouldn't work.

- Tom

hakko504
29th October 2003, 10:02
Originally posted by hakko504
I recall from reading the DVD specs that other colorspaces are allowed inside DVD's. I have yet to encounter one though. I did some research (i.e. read in ITU-T Rec. H.262 | ISO/IEC 13818-1) this morning and found that while I was right I was also wrong. The MPEG-2 video of a DVD cannot contain anything but YV12 color. But a DVD may use MPEG-1 video and this may use other olorspaces.

To be precise this is what the ITU-T Rec. H.262 | ISO/IEC 13818-1 had to say:2.6.2 Video stream descriptor

The video stream descriptor provides basic information which identifies the coding parameters of a video elementary stream as described in ITU-T Rec. H.262 | ISO/IEC 13818-2 or ISO/IEC 11172-2.

Table 2-41 -- Video stream descriptor

Syntax No. of bits Mnemonic
video_stream_descriptor(){
descriptor_tag 8 uimsbf
descriptor_length 8 uimsbf
Multiple_frame_rate_flag 1 bslbf
frame_rate_code 4 uimsbf
MPEG_1_only_flag 1 bslbf
constrained_parameter_flag 1 bslbf
still_picture_flag 1 bslbf
if (MPEG_1_only_flag == 1){
profile_and_level_indication 8 uimsbf
chroma_format 2 uimsbf
frame_rate_extension_flag 1 bslbf
reserved 5 bslbf
}
}




2.6.3 Semantic definitions of fields in video stream descriptor

multiple_frame_rate_flag -- This is a 1 bit field which when set to '1' indicates that multiple frame rates may be present in the video stream. When set to a value of '0' only a single frame rate is present.

frame_rate_code -- This is a 4 bit field as defined in ITU-T Rec. H.262 | ISO/IEC 13818-2 6.3.3, except that when the multiple_frame_rate_flag is set to a value of '1' the indication of a particular frame rate also permits certain other frame rates to be present in the video stream, as specified below:

Table 2-42 Frame rate codecoded as also includes
23,976
24,0 23,976
25,0
29,97 23,976
30,0 23,976 24,0 29,97
50,0 25,0
59,94 23,976 29,97
60,0 23,976 24,0 29,97 30,0 59,94


MPEG_1_only_flag -- This is a 1 bit field which when set to '1' indicates that the video stream contains only ISO/IEC 11172-2 data. If set to '0' the video stream may contain both ISO/IEC 13818-2 video data and constrained parameter ISO/IEC 11172-2 video data.

constrained_parameter_flag -- This is a 1 bit field which when set to '1' indicates that the video stream shall not contain unconstrained ISO/IEC 11172-2 video data. If this field is set to '0' the video stream mat contain both constrained parameters and unconstrained ISO/IEC 11172-2 video streams. If the MPEG_1_only_flag is set to '0', the constrained_parameter_flag shall be set to '1'.

still_picture_flag -- This is a 1 bit field, which when set to '1' indicates that the video stream contains only still pictures. If the bit is set to '0' then the video stream may contain either moving or still picture data.

profile_and_level_indication -- This is an 8 bit field which is set to the same value as the profile_and_level_indication fields in the video stream.

chroma_format -- This is a 2 bit field which is set to the same value as the chroma_format fields in the ITU-T Rec. H.262 | ISO/IEC 13818-2 video stream.

frame_rate_extension_flag-- This is a 1 bit flag which when set to '1' indicates that either or both of the frame_rate_extension_n and frame_rate_extension_d fields in the ITU-T Rec. H.262 | ISO/IEC 13818-2 video stream are non-zero.And before anyone asks, no I did not have access to the ITU-T Rec. H.262 | ISO/IEC 13818-2 document.

Die*wrek*show
29th October 2003, 11:05
Originally posted by hakko504
It's quite obvious really, the option tells DVD2AVI how to convert the colorspace before sending the data to the encoding part. And DVD2AVI always converts the YV12 data of the DVD to YUY2 before continuing. mpeg2dec3 (and later) on the other hand will give you YV12 when you use AviSynth.

And no, every DVD isn't YV12, though there are very few DVD's who isn't YV12.

RGB is the space used on every screen...


Hakko this post and the one you posted after it I don't understand. Does DVD2AVI convert the colorspace "on the fly" when you make a dvd2avi project file?? Its not possible to uncheck vfapi in dvd2avi but supposedly there is a way to frameserve to avisynth so you can keep the yuv colorspace. Mostly I do this conversion Vob>dvd2avi(d2v and wav)>tmpgenc. Now, if I understand correctly, whether you choose to convert to rgb or not in dvd2avi, the fvapi plug-in in tmpgenc will convert to rgb anyway. No problems so far, but I want to use a diff way. I want to choose yuv4:2:2 so I can frameserve the d2v to avisynth because there is an option in tmpgenc to "output yuv data as basic YCbCr not CCIR601". Any ideas?

hakko504
29th October 2003, 12:24
Originally posted by Die*wrek*show
Hakko this post and the one you posted after it I don't understand. Does DVD2AVI convert the colorspace "on the fly" when you make a dvd2avi project file?? Originally posted by hakko504
When you use mpeg2decx (i.e. AviSynth), you do not pass video data through DVD2AVI. DVD2AVI only creates a .d2v file which tells mpeg2dec where to find frames. So in that case no colorspace conversion is made.Its not possible to uncheck vfapi in dvd2avi but supposedly there is a way to frameserve to avisynth so you can keep the yuv colorspace. Yes, you open the .d2v with mpeg2decMostly I do this conversion Vob>dvd2avi(d2v and wav)>tmpgenc. Now, if I understand correctly, whether you choose to convert to rgb or not in dvd2avi, the vfapi plug-in in tmpgenc will convert to rgb anyway. Right. Or rather, I think vfApi won't open the .d2v unless you select RGB in DVD2AVINo problems so far, but I want to use a diff way. I want to choose yuv4:2:2 tv scale so I can frameserve the d2v to avisynth because there is an option in tmpgenc to "output yuv data as basic YCbCr not CCIR601". Any ideas? Not sure about TMPEG (never used it) but AFAIK it can only use RGB input. Maybe someone with more knowledge about TMPEG can answer this.

Die*wrek*show
29th October 2003, 12:42
Ok, thanks hakko. Now I see that having "VFAPI plug-in" checked in dvd2avi doesn't convert to rgb. The reason I thought it did was because I read somewhere that virtualdub,tmpgenc, and vfapi work in rgb but avisynth and dvd2avi can work in yuv.

Wilbert
29th October 2003, 13:15
I want to choose yuv4:2:2 tv scale so I can frameserve the d2v to avisynth because there is an option in tmpgenc to "output yuv data as basic YCbCr not CCIR601". Any ideas?
Not sure what your question is. So I just say a few things:

1) Chosing tv scale / pc scale and frameserving to AviSynth doesn't matter. This settings is ignored since the video is opened as YUV. It doesn't matter if you are feeding it to TMPGEnc afterwards.

2) Checking the option "output yuv data as basic YCbCr not CCIR601" scales to [0,255] IF you are feeding it with an YUV source (AviSynth in 'YUV space' for example). So, you should have this unchecked (as it is by default). I can't think of any situation, when this option should be checked.

Die*wrek*show
29th October 2003, 13:35
@wilbert-the words "tv scale" should not have been there, i edited the post. DVD2AVI clearly says "YUV>RGB" obviously if you're not converting to rgb its ignored. I can't link to the forum that was talking about that, its not important at all though. Some guy was saying it was better to have undercompressed color range but now that I think about it, why would you want to have 0-255 on a tv? I'll keep that box unchecked in tmpgenc.

hakko504
30th October 2003, 08:57
Originally posted by Wilbert
1) Chosing tv scale / pc scale and frameserving to AviSynth doesn't matter. This settings is ignored since the video is opened as YUV. It doesn't matter if you are feeding it to TMPGEnc afterwards. You sure about this? I thought mpeg2dec did heed this setting. It for sure is written into the D2V file.

Another point, which does not come up in the FAQ, but someone had tried earlier is that when you recompress to MPEG2 with CCE/TMPEG they automatically recompress the dynamic Y range from 0-255 to 16-235, so in these case you should use PC-scale when unpacking the VOB's. Othewise you may end up with a dynamic range of 30-226 instead.
The reason I haven't put it into the FAQ is that I'd like to find out what DivX and Xvid does with the luminance before I update the FAQ. If someone knows, please let me know.

Wilbert
30th October 2003, 11:50
You sure about this? I thought mpeg2dec did heed this setting. It for sure is written into the D2V file.
I'm sure about that. Tom (or Nic, I forgot) told me.

Another point, which does not come up in the FAQ, but someone had tried earlier is that when you recompress to MPEG2 with CCE/TMPEG they automatically recompress the dynamic Y range from 0-255 to 16-235
No. For TMPGEnc there is this setting:
"output yuv data as basic YCbCr not CCIR601"
For CCE, there is a similar setting.

As I understand it: this setting is by default unchecked, this means that the luma is clipped to [16,235]. If this setting is checked, than the luma is scaled to [0,255].

A while ago I made some tests to verify this. See the last TWO posts of mine in this thread:
http://www.kvcd.net/forum/viewtopic.php?t=5202&postdays=0&postorder=asc&start=48

hakko504
30th October 2003, 17:01
So the conclusion is that the settings should match then?
TV scale in DVD2AVI and setting unchecked in TMPEG PC scale in DVD2AVI and setting checked in TMPEGIs that right?

Wilbert
30th October 2003, 17:53
So the conclusion is that the settings should match then?
No, please reread my post.

It doesn't matter whether you set TV/PC scale in dvd2avi if you open the d2v file in AviSynth. The luma will always be [16,235] in that case.

"output yuv data as basic YCbCr not CCIR601"
Should always be unchecked.

but someone had tried earlier is that when you recompress to MPEG2 with CCE/TMPEG they automatically recompress the dynamic Y range from 0-255 to 16-235
Note that the luma is _clipped_ to [16,235] and not scaled. So if you feed it with [16,235] nothing happens (again, if you have that option above unchecked).

It becomes different if you use the following progs:

dvd2avi -> vfapi -> tmpgenc

Since vfapi converts it to RGB, you will have to set "PC scale" (since the YUV->RGB conversion assumes that YUV is [0,255], contrary to the color conversion routines in AviSynth for example).

For CCE, I suggest to look at the CCE faq (Q12).

DDogg
31st October 2003, 11:47
For easy reference from CCE FAQ Q12. (http://forum.doom9.org/showthread.php?s=&threadid=53770)

DVD2AVI projects frame served into CCE via AVISynth/mpeg2decX.dll do not use RGB but the YUV color space which is basically just another name for YCbCr. So no conversion takes place and you can ignore both the YUV -> RGB Scale setting in DVD2AVI and the Luminance Level setting in CCE.