View Full Version : Parsing IFO file
Riggs
9th September 2007, 15:50
Hello!
I'm trying to write program that parse a IFO file. I'm using that specifiaction: http://dvd.sourceforge.net/dvdinfo/ifo.html. I've parsed almost all information but I can't obtain these information:
- how to extract chapters from IFO file (I supose that it is written in PGC)
- how to get video and audio bitrate.
- how proper get time from PGC information (in BCD coded on 4 bytes).
r0lZ
9th September 2007, 17:12
The chapters are in the VTS_PTT_SRPT table.
The bitrates are in the VOBs.
Use search for the BCD format. There is a relatively recent thread on this subject.
BTW, the DVD-Specs at sourceforge are outdated, and they are only a subset of the excellent DVD-Information site of mpucoder (http://www.mpucoder.com/DVD/). Give it a try! It is not free, but not expensive.
Riggs
10th September 2007, 07:40
Ok, I found that conversion from BCD to time.
But on the site that you recomended http://www.mpucoder.com/DVD/vobov.html there are not described Vod Headers, so finding bitrate is imposible.
And second... ok, in IFO file at offset 0x00C4 we got pointer to VTS_PTT_SRPT table. But for all VTS files I get similar values (0001 or 0002). How to locate proper offset to this table. In fact, I have same problem with VTS_PGCI (at offset 0x00CC) but my friend tell me that I need to multiply 2048 and 4 byte value from this offset to get address of this table - is this proper?
r0lZ
10th September 2007, 08:00
Yes, the offsets are expressed in sectors of 2048 bytes, and relative to the start of the IFO. That's explained on the mpucoder site.
I don't understand why you need to know the bitrate of the streams, but they are in the streams themselves. You have to study their format. Note also that most of the time, the streams are encoded at variable bitrate, so IMO your quest makes little sense.
BTW, I don't understand neither why you write an IFO parser. There are already good open source libraries to do that.
Riggs
10th September 2007, 10:37
Yes, I heard about librares that can parse IFO file. But I need an option, that reads number of VTS in VIDEO_TS.IFO, calculate time for each of them and ask user which one will be parsed as a movie. Also, my application should be platform independed. If you know library that can do that and it will be working on mono-develop (Linux) and Visual C# please tell me where to find it.
r0lZ
10th September 2007, 11:17
I think it's a subset of LibDVDRead (http://freshmeat.net/projects/libdvdread/), and is developed in C for Linux and is platform independent. (No GUI, of course.)
I don't use it, but I remember that the idea is to put the content of the IFO in some structures, in which you can easily read what you need, without having to parse the tables yourself.
Of course, this library will probably fail (or even crash) on intentionally crappy IFOs created by Sony, Macrovision and other indecent companies.
Riggs
10th September 2007, 15:10
Ok, this library works as same as my class. I'd like to finish my. Can someone help me with getting time.
I got number of program chains in VTS.
According to this offset to VTS_PGC table is on 9th byte.
http://dvd.sourceforge.net/dvdinfo/ifo_vts.html#ptt
But I allways get value 0, so I think it is wrong (using this value I got wrong values from time).
If someone can please write step by step what must I read from this file (can be in words, not in code).
The Scientist
10th September 2007, 17:32
Are these of any use?
http://forum.doom9.org/showthread.php?t=110226
http://forum.doom9.org/showthread.php?t=50552
Riggs
10th September 2007, 17:58
Ok, I joined this two programs, probably I'm in good place but time is incorrect. For example:
IFOUpdate shows : 2:18:37 (without frames) and my parser shows: 2:24:55. What is wrong?
r0lZ
10th September 2007, 18:15
It is easy te determive the error. Just examine the hexadecimal bytes. Except for the last byte (frames and framerate), the byte is what you should see in the final result.
You have the habbit to ask questions we can't reply at. How could we verify who is right without knowing what's in the IFOs, or your code?
Also, use IfoEdit to verify the times, and to study the IFO file format. It's a good IFO monitor.
mpucoder
10th September 2007, 19:29
In bcd 18 is 0x18, which, if taken as a hexadecimal number and not a bcd number, is 24 decimal. Same with 37 and 55.
Conversion to bcd is done with i + 6*(i/10)
Conversion from bcd with i - 6*(i>>4)
frank
13th September 2007, 14:58
Conversion from bcd is done with
i + 6*(i/10)
Conversion to bcd with
i - 6*(i>>4)
BCD To dec
18 + (6*18/10) -> 18 + (6*1) = 24
:helpful: :)
mpucoder
13th September 2007, 18:22
I had the code right for i being the actual value of the byte. 0x18 (hexadecimal 18) is 24 decimal. So if we load that byte from the elapsed time field into i, i will contain 24 decimal. But 0x18 in BCD represents 18, hence the -6*(i>>4)
In order to form a BCD number from a hex number you add 6 for every tens digit, 6 is the difference between the two bases. If we want to represent 18 we add 6 to produce 24, which is 0x18 hexadecimal.
A BCD (Binary Coded Decimal) number is one in which each hex digit (4 bits) represents one decimal digit, therefore each hex digit, or nibble, has 6 unused codes (A B C D E F) in BCD.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.