Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incorrect seek for mkv lacking complete cuepoints for all IDR frames #14

Closed
AkarinVS opened this issue Sep 26, 2021 · 1 comment
Closed
Labels
video video related

Comments

@AkarinVS
Copy link
Owner

AkarinVS commented Sep 26, 2021

lsmas fails the seek test miserably for some mkvs muxed by mkvmerge v51.
For one certain mkv, seeking to frame 32 will consistently return frame 8.

initial investigation showed that simply remux with ffmpeg -i input.mkv -c copy out.mkv would fix the issue.
ffms2 2.40 built with the same ffmpeg revision does not exhibit this issue.

Update: turns out it's because newer mkvmerge no longer generate a cuepoint for each IDR frame. Not sure why this change is made as it should affect players seeking mkv video as well.

Update 2: turns out it's not a regression introduced by mkvmerge v51. When remuxing mp4 to mkv, it seems mkvmerge will not recreate the cuepoints by parsing the video track, so if the input mp4 somehow does not contain full cuepoints, the mkv will exhibit the issue.

@AkarinVS AkarinVS changed the title incorrect seek for mkv made by mkvmerge v51 incorrect seek for mkv lacking complete cuepoints for all IDR frames Sep 29, 2021
@AkarinVS AkarinVS added the video video related label Sep 30, 2021
@AkarinVS
Copy link
Owner Author

Found another reproducer. nyaa 1660840, frame 72.
(seek-test fails for just a remux first 72 frames. mkvmerge --cue 0:all remux fixes the issue).

frame 72 is actually an IDR, but it's not one of the mkv's cue points, so ffmpeg will seek to frame 0.

Index=0,POS=5583,PTS=0,DTS=-9223372036854775808,EDI=0
Key=1,Pic=1,POC=0,Repeat=1,Field=0
Index=0,POS=108034,PTS=83,DTS=-9223372036854775808,EDI=0
Key=0,Pic=2,POC=4,Repeat=1,Field=0

Unfortunately, the first two frames both have DTS AV_NOPTS_VALUE, so it confuses correct_current_frame_number and made it think ffmpeg has sought to the 2nd encoded frame, which is clearly impossible (not even I frame).

@AkarinVS AkarinVS reopened this Apr 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
video video related
Projects
None yet
Development

No branches or pull requests

1 participant