matroska-mux: produces corrupted files with empty tracks
Submitted by sancane
Link to original bug (#776902)
Description
It seems that there is a bug when generating the muxer headers when an EOS is received and not media has been processed previously.
You can try this issue with gst-launch:
$GST_DEBUG=2 gst-launch-1.0 videotestsrc num-buffers=0 ! x264enc ! .video_0 matroskamux ! filesink sync=FALSE async=FALSE location="file.mkv"
0:00:00.032486501 30736 0x24c3370 WARN matroskamux matroska-mux.c:3333:gst_matroska_mux_finish:0x24c4a00 unable to get final track duration
The resulting file.mkv is a not playable file:
$gst-play-1.5 file.mkv
Press 'k' to see a list of keyboard shortcuts.
Now playing /home/sancane/twilio/sources/vms-media-server/build/file.mkv
0:00:00.026630030 30784 0x7fae40130990 ERROR ebmlread ebml-read.c:152:gst_ebml_peek_id_length:<matroskademux0>
Invalid EBML ID size tag (0x0) at position 244 (0xf4)
0:00:00.026777265 30784 0x7fae40130990 ERROR decodebin gstdecodebin2.c:3069:no_more_pads_cb:<decodebin0>
can't find group for element
ffprobe gives next info:
$ ffprobe file.mkv
ffprobe version 2.8.10-0ubuntu0.16.04.1 Copyright (c) 2007-2016 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
[matroska,webm @ 0x17e9c80] Read error at pos. 245 (0xf5)
[matroska,webm @ 0x17e9c80] Duplicate element
[matroska,webm @ 0x17e9c80] Read error at pos. 77 (0x4d)
[matroska,webm @ 0x17e9c80] Read error at pos. 105 (0x69)
[matroska,webm @ 0x17e9c80] Duplicate element
[matroska,webm @ 0x17e9c80] Read error at pos. 245 (0xf5)
[matroska,webm @ 0x17e9c80] Duplicate element
Last message repeated 1 times
file.mkv: End of file
I'm not familiarized with matroska, but perhaps one could expect not to display anything when trying to play a video like this instead of getting this amount of errors, I mean, an empty media file should not have to end up with these errors, they simply should play nothing because they contain nothing. Don't they?