PDA

View Full Version : detect FPS and Interlace in VB6/C from VOBs or IFO?


cbwarz
2nd December 2002, 20:45
Hi,

I'm programming a little utility :) and need to know how can i read from VOB or IFO files, if it is 23.976 or FULL NTSC and how to know if it is interlaced.

I have the structure of IFO files but can't find that information there.

Thanks

cbwarz
6th December 2002, 16:49
Well,

'Cause i see some pleople may be interested i'm posting here how i do it :D

First download bbTools from beyeler's place

1. Run bbdmux to demux video.
bbdmux vts_01_1.vob 0xE0 temp.m2v
2. Run bbvinfo over temp.m2v.
bbvinfo temp.m2v 2 >temp.log
3. Now look at temp.log and seach for:
-------------- PROGRESSIVE vs INTERLACED ---------------
if (progressive_frame == 0)
countProgressive++;
else countInterlace++;

AT END
if (countProgressive>0 && countInterlace==0)
printf("PROGRESSIVE");
else if (countProgressive==0 && countInterlace>0)
printf("INTERLACED");
else if (countProgressive>=countInterlace)
printf("PROGRESSIVE and some INTERLACED");
else if (countProgressive<countInterlace)
printf("INTERLACED and some PROGRESSIVE");
---------------------- PULLDOWN ------------------------
frame_rate_code determines the frame rate per picture_header.
1=23.976Hz, 2=24Hz, 4=29.97Hz,
5=30Hz, 7=59.94Hz, 8=60Hz
repeat_first_field determines repeated frames.
picture_header is a frame, field, ...
if (frame_rate_code==4 && repeat_first_field==1)
repeatedFrames++;
if (picture_header) pictures++;

AT END
printf("PULLDOWN %d:%d", pictures/repeatedFrames,
(pictures-repeatedFrames)/repeatedFrames));

Output must be: PULLDOWN 3:2

that's all, if someone have more information please share

Eyes`Only
4th March 2003, 23:52
Has anyone else tried this? I tried it Matrix R2 VTS02 PGC01 (Main movie) which I know to be progressive, yet the output from bbvinfo showed progressive_frame=0 for every frame!

I've parsed the .m2v myself and I can only find interlaced flags, yet this .m2v is most definitely progressive. How can I parse the .m2v and determine accurately whether or not it is interlaced/progressive?

mpucoder
5th March 2003, 04:05
Look at picture_structure instead (byte 6, bits 1-0, 00=reserved, 01=top field, 10=bottom field, 11=frame)

But R2 is PAL, so there should be no pulldown in it, therefore progressive_frame can = 0 throughout (it only needs to be = 1 for pulldown)

Eyes`Only
5th March 2003, 08:57
Thanks, mpucoder. I'm very inexperienced with PAL, being from the U.S. Your site has been my new bible for quite a while now!

Can you explain in a nutshell what to do with the picture_structure that will tell me that it's progressive? I checked both an interlaced PAL m2v and a progressive PAL m2v and they both seem to have picture_structure= 11 all the way thru them...

I'm trying to give users an option to deinterlace PAL if they want, and would like to detect it properly so I don't needlessly add lines to their .avs scripts if the .m2v is actually progressive!

mpucoder
5th March 2003, 17:10
I have no PAL disks here to see what common practice is. I was hoping they at least encoded camera source as fields, so you'd see 01 and 10 alternately.
The last resort for PAL is the video attributes in the ifo, in there is a flag for FILM/CAMERA. But I wouldn't count on that being right either. Technically, interlaced PAL should have CAMERA set. And the opposite should be true for FILM source. But the truth is, the decoders don't care, so the flags can be wrong.

Eyes`Only
5th March 2003, 17:15
No, unfortunately I've had my program detect that flag forever, and it never finds it as FILM, it's always CAMERA. Isn't it weird that we don't have a reliable source for detecting interlaced/progressive PAL? I mean, we're over two years into DVD... you'd think this would be easy by now! haha

GZZ
7th March 2003, 14:49
Look at picture_structure instead (byte 6, bits 1-0, 00=reserved, 01=top field, 10=bottom field, 11=frame)


does Picture_structure got another name, from your site (MPUcoder)

http://www.mpucoder.com/DVD/mpeghdrs.html

I can only see

Picture header (0100)

Sequence header (01B3)

extension header (01B5)

Picture_Coding_Extension

Group Of Pictures (GOP) (01B8)


none of them are called Picture_structure, maybe I´m just a little blind or its called something else.


Have been looking for a way to detect interlaced/progressiv for quiet some time now.

Please help me. :D

cbwarz
7th March 2003, 17:07
Hi,

Good to see other people is looking for same thing.

I give up trying to find an "ultimate way" of detecting this via inspecting VOB or IFO.

Instead i run from my tool DVD2AVI and then look by programming what values says DVD2AVI for frame & video type.

If you find a better way or can do a little exe, please share.

I can share the VB6 source to look into DVD2AVI if you're interested.

Thanks

GZZ
7th March 2003, 18:14
I´m a delphi programmer and getting the framerate from the vob files are easy (or even the ifo file). But to find out if the video is progressiv or interlaced is hard. :/


GZZ

cbwarz
7th March 2003, 19:10
In a previous post and in mpucoder site is where to look on IFO files, but for NTSC almost always is set to 29.97, then the need is to find out how to detect if is FILM 23.976 and when is not.

Thanks

GZZ
7th March 2003, 20:21
yep - going to take a look into that later on.

GZZ

Eyes`Only
12th March 2003, 07:02
cbwarz: have you found an accurate way to detect this even from the .d2v? From what I've seen, both pure PAL interlaced and PAL progressive have nothing but 2's in their .d2vs. How do you determine PAL interlacing from that?

cbwarz
12th March 2003, 22:05
Eyes`Only: Don't know much about PAL :(

I read the values directly from the GUI by loading second VOB in dvd2avi (to avoid hybrid start), and if it detects changes from interlace/progressive, it assumes NTSC/Interlaced :(, if constant then the value.

Need a better way to do this of course :)

Thanks

Eyes`Only
12th March 2003, 23:13
Ahh OK I do that too.. but that's only accurate for NTSC. Ironically, the same thing that means interlaced in NTSC can mean both interlaced and progressive in PAL, giving me no way to determine interlacing from the .d2v.