You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Matroska: Handle recursive SeekHead elements #1143
Video Info
Duration-> 4060070 size-> 649047285 mimeType -> video/x-matroska
I'm proving some Sample Video URL for testing purpose where I found this Issue where I'm unable to seek to any duration in Media3 Exoplayer.
I'm Using Exoplayer Playerview In this Even Default Seekbar I'm unable to interact with that the seekbar is not even moving in PlayerView.
When I try to seek to any duration Like exoPlayer.seekTo(exoPlayer.currentPosition + 20000) It's seek back to starting position of 0,If I haven't any seek than the full video is playing perfectly but when I touch seek the video current position is going to 0.
Reacted by Pentaphon, Nikolai Shcheglov, taddeus and Tharathiel
The symptoms you're seeing are due to ExoPlayer considering the file 'unseekable'. Often with MKV files this happens because the file doesn't contain a Cues element: google/ExoPlayer#9901
However in this case I do see a Cues element when inspecting the video with mkvinfo.
Looking at this video further, it seems to have two SeekHead elements, with the first one pointing to the second and the second one pointing on to the Cues element:
We only parse the first one, and don't follow the link to the second one, which means we never find the Cues element.
I will mark this as an enhancement to support MKV videos with such recursive SeekHead elements. This is the first such video I'm aware of - do you know how it was produced? Knowing how prevalent videos of this format are will help us to assess the priority of this issue. It's not immediately obvious to me why this recursive structure is useful, and why the video couldn't just have a single SeekHead element.
changed the title [-]Unable to Seek To Particular Duration in Media3 Exoplayer on Few Video Files[/-][+]Matroska: Handle recursive SeekHead elements[/+]on Mar 5, 2024
I solved this in our app by adding support for ID_SEEK_HEAD in this PR if anyone else is having these issues recloudstream/cloudstream#1604
It is like a 30 line change to the matroska extractor, so is there any reason why the official android mediaplayer has not added this? It might not be 100% correct, but works on the MKV files me and other tested.
Activity
icbaker commentedon Mar 5, 2024
The symptoms you're seeing are due to ExoPlayer considering the file 'unseekable'. Often with MKV files this happens because the file doesn't contain a
Cueselement: google/ExoPlayer#9901However in this case I do see a
Cueselement when inspecting the video withmkvinfo.Looking at this video further, it seems to have two
SeekHeadelements, with the first one pointing to the second and the second one pointing on to theCueselement:We only parse the first one, and don't follow the link to the second one, which means we never find the
Cueselement.I will mark this as an enhancement to support MKV videos with such recursive
SeekHeadelements. This is the first such video I'm aware of - do you know how it was produced? Knowing how prevalent videos of this format are will help us to assess the priority of this issue. It's not immediately obvious to me why this recursive structure is useful, and why the video couldn't just have a singleSeekHeadelement.[-]Unable to Seek To Particular Duration in Media3 Exoplayer on Few Video Files[/-][+]Matroska: Handle recursive SeekHead elements[/+]rockzhouchina commentedon Mar 7, 2024
I met several similar mkv files
icbaker commentedon Mar 7, 2024
It looks like this recursive
SeekHeadlayout might be produced bymkvtoolnix(though it could be produced by other muxers too ofc): https://gitlab.com/mbunkus/mkvtoolnix/-/wikis/All-tracks-vanished-after-mkvpropedit,-the-header-or-chapter-editorsfire-light42 commentedon Mar 5, 2025
Any update on this issue, as it is still not fixed. I have confirmed this exact same issue when playing mkv files on media3 1.5.1.
fire-light42 commentedon Mar 11, 2025
I solved this in our app by adding support for ID_SEEK_HEAD in this PR if anyone else is having these issues recloudstream/cloudstream#1604
It is like a 30 line change to the matroska extractor, so is there any reason why the official android mediaplayer has not added this? It might not be 100% correct, but works on the MKV files me and other tested.
3 remaining items
Handle malformed Cues references pointing to Cluster and index EOF
Harden index resolution against cyclic and invalid Cues references
Fix index resolution and support bounded recursive SeekHead traversal
Handle malformed Cues references pointing to Cluster and index EOF
Harden index resolution against cyclic and invalid Cues references
Fix index resolution and support bounded recursive SeekHead traversal
Handle malformed Cues references pointing to Cluster and index EOF
Harden index resolution against cyclic and invalid Cues references
fix: Follow SeekHeads that name another SeekHead to find Cues in MKV
fix: Follow SeekHeads that name another SeekHead to find Cues in MKV
fix: Follow SeekHeads that name another SeekHead to find Cues in MKV
Follow chained `SeekHead` elements to find `Cues` in Matroska
Follow chained `SeekHead` elements to find `Cues` in Matroska
Follow linked SeekHead elements to find Matroska Cues
Follow linked SeekHead elements to find Matroska Cues