No subject

Tue Aug 25 22:50:44 CEST 2009

approaches. The info in the IFO will be correct for most dvds, but there are
some dvds where the time map (VTS_TMAPTI) is corrupt or missing (5% of my
collection). I imagine there are some dvds that have similar issues with
VTS_VOBU_ADMAP (have not seen any yet).

That said, the div-by-zero errors shows that the VOB PCI pack is not always
correct (again, about 5% of my collection. some overlap with the prior 5%).
However, I think other info in the VOB PCI pack can be used to correct this
corruption (vobu_s_ptm; vobu_e_ptm; vobu_se_e_ptm). I'm assuming that
DirectDVD simply didn't bother enough to fix them (especially when
considering that div-by-zero freezes the app).

Unfortunately, scanning the VOB files for this data is a project beyond my
current ability/time.

So in its place, I devised an approach that uses the IFOs only. It's not
ideal, and will probably not work for poorly-authored DVDs. I'm hoping that
segment is small (< 1%). For those DVDs, I think there is no other recourse
other than to do VOB PCI pack analysis.

The IFO approach works as follows:
* Try the time_maps (should work for 95% of dvds)
  - for a given time, find the entry in the time_map table (VTS_TMAPTI)
    The time_map will break down a pgc into intervals of n seconds.
    Unfortunately n is generally 4 seconds, so...
  - lookup the corresponding sectors in the ad_map table (VTS_VOBU_ADMAP)
    The tmap sectors will produce a range in ad_map of 6 - 10 VOBUs.
  - do time interpolation over the 6 - 10 to get the time
    6 - 10 will be small enough that time interpolation will be accurate
* If there is no good time_map, try the ad_map (should work for the
remaining 5% of dvds)
  - for a given time, find the cell in the pgc
  - get the sector bounds of the cell
  - lookup the corresponding sectors from the ad_map table (VTS_VOBU_ADMAP)
    Unfortunately, the ad_map range will be much larger: a few hundred to a
few thousand VOBUs.
  - do time interpoloation over the range
    time interpolation is not ideal, as the range is very large
    however, VOBUs are sized between .4 and 1.5 seconds. Within a given
cell, they appear to be reasonably consistent (i.e.: VOBUs may hover around
15 frames)
* If there is no good ad_map, then just use the cell (same as
  - for a given time, find the cell in the pgc
  - get the sector bounds of the cell
  - do time interpolation over the sector bounds
    this will rarely be accurate. It is there to handle the outlyer dvds (<

Here's a specific example for the time_map approach. It tries to find an
@sector for a @time of 5 seconds
1. look at VTS_TMAPTI
    @time_interval = 4
    Entries =  tmap_idx  sector   time
                                0     711      4
                                1    1776      8
                                2    2790     12

    since 5 seconds is between 4 and 8, @time is between tmap_idx 0 and 1
    @sector_bgn = 711
    @sector_end = 1776

2. look at VTS_VOBU_ADMAP
    Entries = vobu  sector
                       0          0
                       1        43
                       9       711
                      10      831
                      11      948
                      12    1080
                      13    1213
                      14    1349
                      15    1493
                      16    1642
                      17    1776
    @vobu_bgn = 9
    @vobu_end = 17

3. interpolate
    there are 8 vobus between 9 and 17
    5 is 1/4 of the way between 4 and 8
    1/4 of the way between 9 and 17 is 11
    so, @sector = 948

More information about the DVDnav-discuss mailing list