[MPlayer-dev-eng] About mplayer dvd seek, I've checked DVDx source code

Nico Sabbi nsabbi at tiscali.it
Sat Apr 16 18:03:59 CEST 2005


Bo Xie wrote:

>Hi,
>
>   I know mplayer can not seek DVD *accurately* for a long time. And I
>know the reasons are: (1)DVD has no index; (2) DVD is always VBR,not
>CBR. Then it is impossible to seek  *accurately* until we scan the
>total dvd and build a index.
>  
>

coding dvd in CBR coding wouldn't help

>   But I find DVDx(http://www.labdv.com/dvdx/) can seek nearly
>  
>

nearly != exactly

>accurately. I want to know why and the following is what I find.
>---------------------------------
>The key function to cover DVD seek is: 
>void CMpeg_encodeDlg::OnReleasedcaptureSlider(NMHDR* pNMHDR, LRESULT* pResult) 
>
>And the key source code is:
>if( found ) {
>    int diff_lba =
>ifo_info.pgc[input_setting.pgc].cells[i].end_lba-ifo_info.pgc[input_setting.pgc].cells[i].start_lba;
>    double diff_time = (new_time-sum) /
>ifo_info.pgc[input_setting.pgc].cells[i].playback_time;
>    decode_at_lba =
>ifo_info.pgc[input_setting.pgc].cells[i].start_lba+(int)((double)diff_lba*diff_time)
>;
>    input_setting.start_lba = decode_at_lba;
>    ok_decode = MPEG2Seek(decode_at_lba);
>    if(ok_decode) RenderCurrent();
>   }
>
>I guess the idea is: Find the nearest cell,and the cell time
>length(e.g. 5 seconds),cell size(e.g. 10MB),cell seeking time(e.g. 2
>seconds). Then the cell seeking location is 2/5*10=4MB.
>
>I mean DVDx firstly locate a cell by .ifo information and then assume
>it is CBR in the cell to locate the seek location. But ffmpeg just
>assume the total DVD is CBR and locate it.
>---------------------------------
>
>   I don't know whether I am right or not and looking forward to your reply!
>
>Best Regards,
>Xie Bo
>
>  
>

1) you can't adapt a solution that nearly works for dvd but not for 
other mpeg streams
2) in mpeg timers can jump (so e.g. you pass from 03:20:00 to 01:00:00 
without continuity),
so after having (hopefully :) ) built a map of type 
timestamp=>seek_position the time
specified with -ss might be different from the real time ( = mpeg 
timestamp) present in
the bitstream

As you seen the solution is not trivial.

you have to build a map




More information about the MPlayer-dev-eng mailing list