After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 620790 - [matroskademux] general stream error when trying to play certain .mkv file
[matroskademux] general stream error when trying to play certain .mkv file
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
0.10.23
Other Linux
: Normal major
: 0.10.26
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2010-06-07 00:59 UTC by Adam Guthrie
Modified: 2010-09-06 13:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
matroskademux: additional parse error recovery (3.29 KB, patch)
2010-07-26 14:24 UTC, Mark Nauwelaerts
committed Details | Review

Description Adam Guthrie 2010-06-07 00:59:14 UTC
I have a .mkv file that give me the following error at certain spots while playing:

** Message: Error: GStreamer encountered a general stream error.
matroska-demux.c(5241): gst_matroska_demux_loop (): /GstPlayBin2:play/GstURIDecodeBin:uridecodebin0/GstDecodeBin2:decodebin20/GstMatroskaDemux:matroskademux0:
stream stopped, reason error

Here is a snippet when running with GST_DEBUG:

0:01:43.966809686 28033  0x84e37f8 DEBUG          matroskademux matroska-demux.c:4603:gst_matroska_demux_parse_cluster:<matroskademux0> Parsing BlockGroup element at offset 39861370 finished with 'ok'
0:01:43.966823649 28033  0x84e37f8 WARN           matroskademux matroska-demux.c:4618:gst_matroska_demux_parse_cluster: Unknown Cluster subelement 0xae - ignoring
0:01:43.966833411 28033  0x84e37f8 DEBUG          matroskademux matroska-demux.c:4625:gst_matroska_demux_parse_cluster: Skipping Cluster subelement 0xae - ignoring
0:01:43.966842950 28033  0x84e37f8 WARN           matroskademux matroska-demux.c:4618:gst_matroska_demux_parse_cluster: Unknown Cluster subelement 0xae - ignoring
0:01:43.966851692 28033  0x84e37f8 DEBUG          matroskademux matroska-demux.c:4625:gst_matroska_demux_parse_cluster: Skipping Cluster subelement 0xae - ignoring
0:01:43.966860534 28033  0x84e37f8 WARN           matroskademux matroska-demux.c:4618:gst_matroska_demux_parse_cluster: Unknown Cluster subelement 0x8d - ignoring
0:01:43.966869107 28033  0x84e37f8 DEBUG          matroskademux matroska-demux.c:4625:gst_matroska_demux_parse_cluster: Skipping Cluster subelement 0x8d - ignoring
0:01:43.966878043 28033  0x84e37f8 WARN           matroskademux matroska-demux.c:4618:gst_matroska_demux_parse_cluster: Unknown Cluster subelement 0x7374 - ignoring
0:01:43.966886784 28033  0x84e37f8 DEBUG          matroskademux matroska-demux.c:4625:gst_matroska_demux_parse_cluster: Skipping Cluster subelement 0x7374 - ignoring
0:01:43.966900885 28033  0x84e37f8 DEBUG                basesrc gstbasesrc.c:1989:gst_base_src_update_length:<source> reading offset 39874377, length 65536, size 1173002147, segment.stop -1, maxsize 1173002147
0:01:43.966913888 28033  0x84e37f8 DEBUG                basesrc gstbasesrc.c:2079:gst_base_src_get_range:<source> calling create offset 39874377 length 65536, time 0
0:01:43.966965144 28033  0x84e37f8 DEBUG                basesrc gstbasesrc.c:1953:gst_base_src_do_sync:<source> no sync needed
0:01:43.966977919 28033  0x84e37f8 DEBUG                basesrc gstbasesrc.c:2120:gst_base_src_get_range:<source> buffer ok
0:01:43.966989562 28033  0x84e37f8 WARN           matroskademux matroska-demux.c:4618:gst_matroska_demux_parse_cluster: Unknown Cluster subelement 0xe0 - ignoring
0:01:43.966999557 28033  0x84e37f8 DEBUG          matroskademux matroska-demux.c:4625:gst_matroska_demux_parse_cluster: Skipping Cluster subelement 0xe0 - ignoring
0:01:43.967008604 28033  0x84e37f8 WARN           matroskademux matroska-demux.c:4618:gst_matroska_demux_parse_cluster: Unknown Cluster subelement 0xae - ignoring
0:01:43.967017374 28033  0x84e37f8 DEBUG          matroskademux matroska-demux.c:4625:gst_matroska_demux_parse_cluster: Skipping Cluster subelement 0xae - ignoring
0:01:43.967026135 28033  0x84e37f8 WARN           matroskademux matroska-demux.c:4618:gst_matroska_demux_parse_cluster: Unknown Cluster subelement 0xe0 - ignoring
0:01:43.967034941 28033  0x84e37f8 DEBUG          matroskademux matroska-demux.c:4625:gst_matroska_demux_parse_cluster: Skipping Cluster subelement 0xe0 - ignoring
0:01:43.967043733 28033  0x84e37f8 WARN           matroskademux matroska-demux.c:4618:gst_matroska_demux_parse_cluster: Unknown Cluster subelement 0xaa - ignoring
0:01:43.967052351 28033  0x84e37f8 DEBUG          matroskademux matroska-demux.c:4625:gst_matroska_demux_parse_cluster: Skipping Cluster subelement 0xaa - ignoring
0:01:43.967061099 28033  0x84e37f8 WARN           matroskademux matroska-demux.c:4618:gst_matroska_demux_parse_cluster: Unknown Cluster subelement 0x6d6d - ignoring
0:01:43.967069868 28033  0x84e37f8 DEBUG          matroskademux matroska-demux.c:4625:gst_matroska_demux_parse_cluster: Skipping Cluster subelement 0x6d6d - ignoring
0:01:43.967078910 28033  0x84e37f8 ERROR               ebmlread ebml-read.c:362:gst_ebml_read_element_id:<matroskademux0> Invalid EBML ID size tag (0xa) at position 39883176 (0x26091a8)
0:01:43.967098506 28033  0x84e37f8 DEBUG          matroskademux matroska-demux.c:4650:gst_matroska_demux_parse_cluster:<matroskademux0> Parsing Cluster element at offset 39883176 finished with 'error'
0:01:43.967110158 28033  0x84e37f8 DEBUG               GST_PADS gstpad.c:5250:gst_pad_pause_task:<matroskademux0:sink> pause task
0:01:43.967120871 28033  0x84e37f8 DEBUG                   task gsttask.c:608:gst_task_set_state:<task0> Changing task 0x851f038 to state 2
0:01:43.967132846 28033  0x84e37f8 WARN           matroskademux matroska-demux.c:5241:gst_matroska_demux_loop:<matroskademux0> error: stream stopped, reason error
0:01:43.967144764 28033  0x84e37f8 DEBUG            GST_MESSAGE gstelement.c:1732:gst_element_message_full:<matroskademux0> start
0:01:43.967187292 28033  0x84e37f8 INFO        GST_ERROR_SYSTEM gstelement.c:1763:gst_element_message_full:<matroskademux0> posting message: GStreamer encountered a general stream error.
0:01:43.967208171 28033  0x84e37f8 DEBUG                GST_BUS gstbus.c:309:gst_bus_post:<bus4> [msg 0x8520100] posting on bus, type error, GstMessageError, gerror=(GstGError)NULL, debug=(string)"matroska-demux.c\(5241\):\ gst_matroska_demux_loop\ \(\):\ /GstPlayBin2:playbin20/GstURIDecodeBin:uridecodebin0/GstDecodeBin2:decodebin20/GstMatroskaDemux:matroskademux0:\012stream\ stopped\,\ reason\ error"; from source <matroskademux0>
0:01:43.967235736 28033  0x84e37f8 DEBUG                    bin gstbin.c:2994:gst_bin_handle_message_func:<decodebin20> [msg 0x8520100] handling child matroskademux0 message of type error
0:01:43.967247003 28033  0x84e37f8 DEBUG                    bin gstbin.c:3268:gst_bin_handle_message_func:<decodebin20> posting message upward
0:01:43.967257492 28033  0x84e37f8 DEBUG                GST_BUS gstbus.c:309:gst_bus_post:<bus3> [msg 0x8520100] posting on bus, type error, GstMessageError, gerror=(GstGError)NULL, debug=(string)"matroska-demux.c\(5241\):\ gst_matroska_demux_loop\ \(\):\ /GstPlayBin2:playbin20/GstURIDecodeBin:uridecodebin0/GstDecodeBin2:decodebin20/GstMatroskaDemux:matroskademux0:\012stream\ stopped\,\ reason\ error"; from source <matroskademux0>
0:01:43.967280143 28033  0x84e37f8 DEBUG                    bin gstbin.c:2994:gst_bin_handle_message_func:<uridecodebin0> [msg 0x8520100] handling child matroskademux0 message of type error
0:01:43.967291073 28033  0x84e37f8 DEBUG                    bin gstbin.c:3268:gst_bin_handle_message_func:<uridecodebin0> posting message upward
0:01:43.967301278 28033  0x84e37f8 DEBUG                GST_BUS gstbus.c:309:gst_bus_post:<bus0> [msg 0x8520100] posting on bus, type error, GstMessageError, gerror=(GstGError)NULL, debug=(string)"matroska-demux.c\(5241\):\ gst_matroska_demux_loop\ \(\):\ /GstPlayBin2:playbin20/GstURIDecodeBin:uridecodebin0/GstDecodeBin2:decodebin20/GstMatroskaDemux:matroskademux0:\012stream\ stopped\,\ reason\ error"; from source <matroskademux0>
0:01:43.967324601 28033  0x84e37f8 DEBUG                    bin gstbin.c:2994:gst_bin_handle_message_func:<playbin20> [msg 0x8520100] handling child matroskademux0 message of type error
0:01:43.967335337 28033  0x84e37f8 DEBUG                    bin gstbin.c:3268:gst_bin_handle_message_func:<playbin20> posting message upward
0:01:43.967345643 28033  0x84e37f8 DEBUG                GST_BUS gstbus.c:309:gst_bus_post:<bus1> [msg 0x8520100] posting on bus, type error, GstMessageError, gerror=(GstGError)NULL, debug=(string)"matroska-demux.c\(5241\):\ gst_matroska_demux_loop\ \(\):\ /GstPlayBin2:playbin20/GstURIDecodeBin:uridecodebin0/GstDecodeBin2:decodebin20/GstMatroskaDemux:matroskademux0:\012stream\ stopped\,\ reason\ error"; from source <matroskademux0>
0:01:43.967366124 28033  0x84e37f8 DEBUG                GST_BUS gstbus.c:339:gst_bus_post:<bus1> [msg 0x8520100] pushing on async queue
0:01:43.967376708 28033  0x84e37f8 DEBUG                GST_BUS gstbus.c:344:gst_bus_post:<bus1> [msg 0x8520100] pushed on async queue
0:01:43.967391719 28033  0x84e37f8 DEBUG                GST_BUS gstbus.c:335:gst_bus_post:<bus0> [msg 0x8520100] dropped
0:01:43.967403211 28033  0x84e37f8 DEBUG                GST_BUS gstbus.c:335:gst_bus_post:<bus3> [msg 0x8520100] dropped
0:01:43.967421685 28033  0x84e37f8 DEBUG                GST_BUS gstbus.c:335:gst_bus_post:<bus4> [msg 0x8520100] dropped
0:01:43.967432452 28033  0x84e37f8 INFO        GST_ERROR_SYSTEM gstelement.c:1786:gst_element_message_full:<matroskademux0> posted error message: GStreamer encountered a general stream error.
0:01:43.967444011 28033  0x84e37f8 DEBUG              GST_EVENT gstevent.c:269:gst_event_new: creating new event 0x85320c8 eos 86

The relevant error seems to be:

0:01:43.967078910 28033  0x84e37f8 ERROR               ebmlread ebml-read.c:362:gst_ebml_read_element_id:<matroskademux0> Invalid EBML ID size tag (0xa) at position 39883176 (0x26091a8)

I ran the .mkv file through mkvinfo and noticed the following output right around the time the crash occurs:

|+ Cluster
| + Cluster timecode: 102.432s
| + Block group
|  + Block (track number 2, 8 frame(s), timecode 102.432s = 00:01:42.432)
|   + Frame with size 1792
|   + Frame with size 1792
|   + Frame with size 1792
|   + Frame with size 1792
|   + Frame with size 1792
|   + Frame with size 1792
|   + Frame with size 1792
|   + Frame with size 1792
| + Block group
|  + Block (track number 1, 1 frame(s), timecode 102.436s = 00:01:42.436)
|   + Frame with size 26852
|  + Reference block: -42.000000ms
| + Block group
|  + Block (track number 1, 1 frame(s), timecode 102.561s = 00:01:42.561)
|   + Frame with size 29119
|  + (Unknown element: DummyElement; ID: 0xff size: 3)
| + (Unknown element: DummyElement; ID: 0xff size: 53)
| + (Unknown element: DummyElement; ID: 0xff size: 20)
| + (Unknown element: DummyElement; ID: 0xff size: 98)
| + (Unknown element: DummyElement; ID: 0xff size: 12836)
| + (Unknown element: DummyElement; ID: 0xff size: 48)
| + (Unknown element: DummyElement; ID: 0xff size: 43)
| + (Unknown element: DummyElement; ID: 0xff size: 48)
| + (Unknown element: DummyElement; ID: 0xff size: 98)
| + (Unknown element: DummyElement; ID: 0xff size: 8562)
| + (Unknown element: DummyElement; ID: 0xff size: 13349)

What is the problem here? Is there an error in the .mkv file itself? Can gstreamer handle it more gracefully? I have reason to believe (but no proof) that the Matroska codec used on Windows can decode this just fine.
Comment 1 André Klapper 2010-06-07 16:36:54 UTC
Any chance to provide an testcase?
Comment 2 Sebastian Dröge (slomo) 2010-06-09 19:21:49 UTC
Yes, would be very useful to get the file in question.
Comment 3 Adam Guthrie 2010-06-16 00:30:15 UTC
The file is 1.1GB. I've tried splitting it using ffmpeg:

ffmpeg -i 24.S07E14.720p.HDTV.X264-DIMENSION.mkv -ss 00:01:40 -t 00:00:03 out.mkv

but I get an error:

[mp2 @ 0x9b97b00]encoding 6 channel(s) is not allowed in mp2
Error while opening codec for output stream #0.1 - maybe incorrect parameters such as bit_rate, rate, width or height

I've tried -acodec copy and -vcodec copy, but that doesn't seem to work correctly (the video is messed up and doesn't crash).

mkvmerge --split will split it, but the split file doesn't cause the crash (it just glitches the video).

Any advice? I can make the file available if someone is willing to download it.
Comment 4 Mark Nauwelaerts 2010-06-23 08:58:13 UTC
Can the file be made available?
Comment 6 Mark Nauwelaerts 2010-07-26 14:24:46 UTC
Created attachment 166588 [details] [review]
matroskademux: additional parse error recovery

There is some corruption in that file, and this patch should at least make things continue past the point mentioned above.

However, there seem to be some other points where things/layout is not entirely as expected, leading to complaints and failures elsewhere.

As such, matroskademux should likely be made a bit more robust elsewhere as well (e.g. blockgroup parsing), in the sense that it does not give up completely on the first bit it finds out of place, but rather skips and tries to carry on (until otherwise hopeless).
Comment 7 Mark Nauwelaerts 2010-09-06 12:56:44 UTC
There is lots of bogus stuff going on in that file, but following commits should make it go through (in a fashion):

commit 680eb51b686041cc040f4f0c2a9fa8c944074ff6
Author: Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
Date:   Mon Jul 26 15:51:49 2010 +0200

    matroskademux: additional parse recovery
    
    In particular, upon parse failure in one cluster, we may forego remaining
    content and try resuming from next cluster onwards.
    
    Fixes #620790.

commit 4d9c1e99f208f67bbf10753c8b302ebcc4325e69
Author: Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
Date:   Mon Aug 16 16:05:41 2010 +0200

    matroskademux: not so fatal error handling
    
    If some bits out of place in block(group) parsing, forego and move to next.
    Also skip large blocks in pull mode, but need to give up in push mode.
    
    Fixes #626463.
    Improves #620790.

commit 13b553bce7169272a86a61498f42e1860b74bf79
Author: Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
Date:   Tue Aug 17 12:08:10 2010 +0200

    matroskademux: attempt more resync upon (cluster) parse error
    
    That is, if parse error occurs in state requiring to move to next cluster,
    and doing so to the expected next position of cluster fails, then scan for a
    next cluster from present position and resume from there.
    
    Fixes #620790.