GNOME Bugzilla – Bug 300682
[mpeg2dec] fails to play mpgtx -j joined files to the end
Last modified: 2006-02-27 14:52:44 UTC
Please describe the problem:
When playing MPEG1 or MPEG2 video file which has been made by mpgtx
< http://mpgtx.sourceforge.net/ >
by joining two or more movie clips together, gst-player and Totem (gstreamer)
won't play the video file to the end, but halts there where the first clip ends.
The sound is though played to the end.
Steps to reproduce:
1. Get two or more MPEG1/2 files, 1.mpg 2.mpg
2. Join them with mpgtx: mpgtx -j 1.mpg 2.mpg -o test.mpg
3. gst-player test.mpg
gst-player ends showing video to the last frame of 1.mpg, stalls, sound
To play it to the end of 2.mpg. ffplay does this. So does xine.
So does "mplayer -vc ffmpeg12"
Does this happen every time?
Seems like a bug is also in libmpeg2, its dev mailing list has been
One mpgtx -j joined test video file can be found in
Does the problem still exist? Can you provide another link? The link that you
have posted doesn't exist anymore..
Sorry not to report this earlier, but I am not currently practically possible to update to the latest version of gstreamer to test.
With FC3 and gstreamer v0.8.10 (and Totem v1.0.1) the problem still does exist.
I use gstreamer binaries from
If someone makes FC3 rpm packages of v0.8.12 or I upgrade to FC4, I'll tell what happens with v0.8.12 (or v0.8.11)
Before 'mplayer -vc mpeg12' failed the same way to play these kind of (broken) files and 'mplayer -vc ffmpeg' succeeded. But now later also 'mplayer -vc mpeg12' succees to play fine. (MPlayer 1.0pre7-3.4.3, libmpeg2-v0.4.0b)
So I guess if later gstreamer uses newer libmpeg2, the problem would be fixed.
(the example video attachment I tried to include was too big ~4MiB to be accepted here)
Can you please upload the file somewhere ? If you can't upload it feel free to mail me (luogni at tin dot it), i'll setup a ftp server on my pc so you can upload it! thanks for your report!
Thanks for the file!
I can replicate the bug with current cvs and also in mpeg2dec (the program) so it seems an upstream issue. Using ffdec_mpeg2video instead mpeg2dec make it works fine.
I've only seen a problem:
- in gstmpeg2dec.c mpeg2_parse returns STATE_INVALID and mpeg2dec creates a warning and return GST_FLOW_ERROR..
I think this is wrong, it should:
or return GST_FLOW_ERROR and call GST_ELEMENT_ERROR
or return GST_FLOW_OK and call GST_OBJECT_WARNING
The problem is that: ... ! mpegdemux ! mpeg2dec ! fakesink works fine (just some warnings) but ... ! mpegdemux name=m m.video_00 ! queue ! mpeg2dec ! fakesink fails because queue fails if the ret value is different than GST_FLOW_OK.
Changing "return GST_FLOW_ERROR" to "return GST_FLOW_OK" make this file works fine. Should i commit?
But then it wouldn't error out if there is a real error, would it?
Maybe we could keep a counter somewhere and try and restart once or twice when we get STATE_INVALID and only error out after getting three STATE_INVALID in a row, or something like that?
Created attachment 60145 [details] [review]
patch implementing Tim's idea
btw, i've also looked at other users of libmpeg2 and a lot of them(mplayer, vlc, ..) don't think STATE_INVALID is a fatal error.
*** Bug 328625 has been marked as a duplicate of this bug. ***
Committed to CVS with some minor modifications (style/indentation changes; throw GST_ELEMENT_ERROR when we return GST_FLOW_ERROR, so a meaningful error messages is posted on the bus; reset dec->error_count in gst_mpeg2dec_reset()):
2006-02-27 Luca Ognibene <luogni at tin dot it>
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_init),
Don't treat STATE_INVALID as fatal error; throw an error
only after five consecutive decoding errors. Makes decoding
mpeg streams more robust and fixes playback of joined clips