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 761392 - avimux writes broken headers for mp3 audio stream
avimux writes broken headers for mp3 audio stream
Status: RESOLVED NOTABUG
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
1.4.5
Other Linux
: Normal normal
: NONE
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-02-01 11:12 UTC by Nikita Yushchenko
Modified: 2016-02-01 18:20 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Nikita Yushchenko 2016-02-01 11:12:50 UTC
Easy way to reproduce:

nikita@hugenb:/tmp$ gst-launch-1.0 alsasrc ! lamemp3enc ! avimux ! filesink location=/tmp/f.avi
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstAudioSrcClock
Redistribute latency...
^Chandling interrupt.
Interrupt: Stopping pipeline ...
Execution ended after 0:00:01.299496783
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...


nikita@hugenb:/tmp$ gst-launch-1.0 playbin uri=file:///tmp/f.avi
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
WARNING: from element /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0/GstDecodeBin:decodebin0/GstAviDemux:avidemux0: Could not demultiplex stream.
Additional debug info:
gstavidemux.c(4043): gst_avi_demux_stream_header_pull (): /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0/GstDecodeBin:decodebin0/GstAviDemux:avidemux0:
failed to parse stream, ignoring
ERROR: from element /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0/GstDecodeBin:decodebin0/GstAviDemux:avidemux0: Could not demultiplex stream.
Additional debug info:
gstavidemux.c(4360): gst_avi_demux_stream_header_pull (): /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0/GstDecodeBin:decodebin0/GstAviDemux:avidemux0:
Could not get/create index
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...


Attempt to debug in shows that gst_avi_mux_riff_get_avi_header() is called before first call to gst_avi_mux_audsink_scan_mpeg_audio(), which causes audpad->hdr to be written before it is completely initialized. In particular it is written with hdr.scale=1, although later hdr.scale is set to other value.
Comment 1 Nikita Yushchenko 2016-02-01 11:18:22 UTC
Small correction: in debug session I used

gst-launch-1.0 alsasrc ! lamemp3enc ! mpegaudioparse ! avimux ! filesink location=/tmp/f.avi

(i.e. avimux git it with parsed=true)
Comment 2 Tim-Philipp Müller 2016-02-01 11:20:06 UTC
The headers probably aren't getting finalized properly, pass the -e option to gst-launch, like this:

 $ gst-launch-1.0 -e alsasrc ! lamemp3enc ! avimux ! filesink location=/tmp/f.avi
Comment 3 Nikita Yushchenko 2016-02-01 11:30:23 UTC
It works with -e.

Thanks, I was not aware of that.

Still not sure it is corrent to (initially) write non-initialized headers. Rewriting later likely won't work with more complex sinks.  Why not delaying header write until pushing first buffer?  At that moment proper header data seems to be already known.
Comment 4 Thiago Sousa Santos 2016-02-01 18:05:04 UTC
Thanks for confirming. Closing.
Comment 5 Tim-Philipp Müller 2016-02-01 18:20:45 UTC
AVI is not really designed to be a streaming format, and I don't think we want to support it as such. As such, avimux will not work well with sinks that don't support seeking back to finalize headers.

What you propose could probably be implemented, but I'm not sure it's worth it. That entire function looks a bit dodgy/suspicious.