I have a simple pipeline to split video files using splitmuxsink with matroskamux. When loading the files in VLC Player I cannot seek to different points within the generated files this makes it hard to find content. I’ve set matroska muxer property offset-to-zero=true (thread) but that doesn’t seem to help.
Is this a bug?
Is there a way to split files to mkv and still be able to seek?
Here is sample pipeline to reproduce the issue:
gst-launch-1.0 videotestsrc num-buffers=500 ! video/x-raw,framerate=5/1,width=640,height=480,format=I420 ! splitmuxsink location=video%d.mkv muxer-factory=matroskamux max-size-time=30000000000 muxer-properties="properties,offset-to-zero=true"
Do you have the same problem if you don’t use
splitmuxsink and just use
matroskamux ! filesink location=video.mkv directly?
(Also, are you saving raw video frames on purpose? If not, you might want to add an encoder before the muxer somewhere, e.g.
x264enc tune=zerolatency or somesuch)
matroskamux doesn’t have max-size-time= property so it can’t split. The issue is only with split files. The first file generated by split is seekable. The subsequesnt files all aren’t seekable. The start time of each subsequent split file is not starting from 0 but it’s running time. See the attached screen shot of VLC timeline (only seek in first file works).
Yes the above pipeline is saving raw frames but that’s not the issue as it’s a test pipeline one can use to reproduce the issue. My actual pipeline does use compressed h264 frames.
I found this link but it’s not clear to me if it’s trying to solve this exact problem I’m exepriencing: https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/183
Right, that was the reason I asked
This sounds like a known bug in VLC when timestamps don’t start at 0 (which is perfectly fine, since Matroska is a streaming format).
However, I don’t know why the timestamps in subsequent split files don’t actually start at 0. It sounds like the
offset-to-zero=true doesn’t actually get applied or isn’t working as it should?
This works for me:
gst-launch-1.0 videotestsrc num-buffers=500 ! video/x-raw,framerate=5/1,width=640,height=480,format=I420 ! splitmuxsink location=video%d.mkv muxer='matroskamux offset-to-zero=true' max-size-time=30000000000
I think the reason
muxer-properties=... isn’t effective is in the property description which says:
muxer-properties: The muxer element properties to use. Valid only for async-finalize = TRUE
Good catch on the async-finalize=true and your pipeline works.
Any reasons why one might not want to set splitmuxsink async-finalize=true by default? I does seem to also solve the issue in my pipeline. I’m trying to be caustious for future use.
Also, you mentioned bug in VLC, is there another player that can play the mkv files with seek that don’t have async-finalize=true?
Thanks a bunch Tim!