Hi, I think there is a problem with matroska file seeking : the demuxer find the nearest keyframe but it could be annoying if you have small seek time (for exemple 1s) because if you are near the next keyframe and you do "seek -1" the position in the movie will go to the next key frame and not the last, also with this small time seeking it is imposible to rewind : you stay on the last keyframe : alsa-space: free space = 65536, status=141110472, prepared -- [mkv] SEEK, relss: -1,000, flags: 00,018 524/524 0% 0% 0,0% 0 6 0% [mkv] New timecode: 15890 alsa-space: free space = 65536, status=141110472, prepared -- [mkv] SEEK, relss: -1,000, flags: 00,014 525/525 0% 0% 0,0% 0 6 0% [mkv] New timecode: 15890 alsa-space: free space = 65536, status=141110472, prepared -- [mkv] SEEK, relss: -1,000, flags: 00,018 527/527 0% 0% 0,0% 0 6 0% [mkv] New timecode: 15890 alsa-space: free space = 65536, status=141110472, prepared -- [mkv] SEEK, relss: -1,000, flags: 00,140 659/659 7% 47% 1,1% 0 6 0% [mkv] New timecode: 23898 alsa-space: free space = 65536, status=141110472, prepared -- [mkv] SEEK, relss: -1,000, flags: 00,083 677/677 6% 47% 1,3% 0 6 0% [mkv] New timecode: 23898 alsa-space: free space = 65536, status=141110472, prepared -- [mkv] SEEK, relss: -1,000, flags: 00,062 690/690 7% 47% 1,5% 0 6 0% [mkv] New timecode: 23898 Could be possible to have a seeking like avi which haven't this anoying isue. Thanks Matthieu
matthieu wrote:
I think there is a problem with matroska file seeking : the demuxer find the nearest keyframe but it could be annoying if you have small seek time (for exemple 1s) because if you are near the next keyframe and you do "seek -1" the position in the movie will go to the next key frame and not the last, also with this small time seeking it is imposible to rewind : you stay on the last keyframe :
I think I've also experienced this problem seeking in OGM files too, though I haven't investigated it carefully. Many times, I can't actually move backward using the left arrow, but only with the down arrow. Jonathan Rogers
Hi.
I think there is a problem with matroska file seeking : the demuxer find the nearest keyframe but it could be annoying if you have small seek time (for exemple 1s) because if you are near the next keyframe and you do "seek -1" the position in the movie will go to the next key frame and not the last, also with this small time seeking it is imposible to rewind : you stay on the last keyframe :
Maybe I'll find the time to implement that. But no promises. -- ==> Ciao, Mosu (Moritz Bunkus)
Hi.
Maybe I'll find the time to implement that. But no promises. I have made a small patch that it seems to work...
matthieu Index: libmpdemux/demux_mkv.cpp =================================================================== RCS file: /cvsroot/mplayer/main/libmpdemux/demux_mkv.cpp,v retrieving revision 1.30 diff -r1.30 demux_mkv.cpp 2419,2424c2419,2427 < if (diff < 0) < diff *= -1; < if (diff < min_diff) { < min_diff = diff; < entry = & index->entries[k]; < } ---
//if (diff < 0) //diff *= -1; if (diff < 0 && -diff < min_diff) { min_diff = -diff; entry = & index->entries[--k]; } else if (diff > 0 && diff < min_diff) { min_diff = diff; entry = & index->entries[k]; }
this should be better... Index: libmpdemux/demux_mkv.cpp =================================================================== RCS file: /cvsroot/mplayer/main/libmpdemux/demux_mkv.cpp,v retrieving revision 1.30 diff -u -r1.30 demux_mkv.cpp --- libmpdemux/demux_mkv.cpp 10 Sep 2003 12:50:29 -0000 1.30 +++ libmpdemux/demux_mkv.cpp 12 Sep 2003 21:22:29 -0000 @@ -2416,9 +2416,9 @@ if (!index->entries[k].is_key) continue; diff = target_timecode - (int64_t)index->entries[k].timecode; - if (diff < 0) - diff *= -1; - if (diff < min_diff) { +// if (diff < 0) +// diff *= -1; + if (diff > 0 && diff < min_diff) { min_diff = diff; entry = & index->entries[k]; } Mathhieu matthieu wrote:
Hi.
Maybe I'll find the time to implement that. But no promises. I have made a small patch that it seems to work...
matthieu
Index: libmpdemux/demux_mkv.cpp =================================================================== RCS file: /cvsroot/mplayer/main/libmpdemux/demux_mkv.cpp,v retrieving revision 1.30 diff -r1.30 demux_mkv.cpp 2419,2424c2419,2427 < if (diff < 0) < diff *= -1; < if (diff < min_diff) { < min_diff = diff; < entry = & index->entries[k]; < } ---
//if (diff < 0) //diff *= -1; if (diff < 0 && -diff < min_diff) { min_diff = -diff; entry = & index->entries[--k]; } else if (diff > 0 && diff < min_diff) { min_diff = diff; entry = & index->entries[k]; }
And this one quicker... Sorry for the 2 last post Matthieu Index: libmpdemux/demux_mkv.cpp =================================================================== RCS file: /cvsroot/mplayer/main/libmpdemux/demux_mkv.cpp,v retrieving revision 1.30 diff -u -r1.30 demux_mkv.cpp --- libmpdemux/demux_mkv.cpp 10 Sep 2003 12:50:29 -0000 1.30 +++ libmpdemux/demux_mkv.cpp 12 Sep 2003 21:31:36 -0000 @@ -2416,9 +2416,9 @@ if (!index->entries[k].is_key) continue; diff = target_timecode - (int64_t)index->entries[k].timecode; - if (diff < 0) - diff *= -1; - if (diff < min_diff) { + if (diff < min_diff && diff > 0) { min_diff = diff; entry = & index->entries[k]; } matthieu wrote:
this should be better...
Index: libmpdemux/demux_mkv.cpp =================================================================== RCS file: /cvsroot/mplayer/main/libmpdemux/demux_mkv.cpp,v retrieving revision 1.30 diff -u -r1.30 demux_mkv.cpp --- libmpdemux/demux_mkv.cpp 10 Sep 2003 12:50:29 -0000 1.30 +++ libmpdemux/demux_mkv.cpp 12 Sep 2003 21:22:29 -0000 @@ -2416,9 +2416,9 @@ if (!index->entries[k].is_key) continue; diff = target_timecode - (int64_t)index->entries[k].timecode; - if (diff < 0) - diff *= -1; - if (diff < min_diff) { +// if (diff < 0) +// diff *= -1; + if (diff > 0 && diff < min_diff) { min_diff = diff; entry = & index->entries[k]; }
Mathhieu
Hi. I've just committed some more modifications to the seeking code. Please test them if you have time. -- ==> Ciao, Mosu (Moritz Bunkus)
Hi. It seems to work quite well. Applied. Thanks :) -- ==> Ciao, Mosu (Moritz Bunkus)
participants (3)
-
Jonathan Rogers -
matthieu -
Moritz Bunkus