multifilesrc and looping wav files: success story, sort of

Antonio Ospite ao2 at ao2.it
Tue Aug 26 10:10:41 PDT 2014


Hi,

I thought I'd share here my experience about the subject, and there are
also two questions attached at the end.

I wanted to use multifilesrc to play a wav file in a loop (GStreamer
1.4.0) but I was having problems, the audio file was played _twice_ when
using decodebin (stereo or mono doesn't matter if you wonder) which was
very strange and the pipeline exited with the message:

	Got EOS from element "pipeline0".

This behavior was present with either loop=1 or loop=0.

Like this:
$ LANG=C gst-launch-1.0 multifilesrc location="test.wav" loop=1 ! decodebin ! audioconvert ! autoaudiosink
Setting pipeline to PAUSED ... Pipeline is
PREROLLING ... Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstPulseSinkClock
Got EOS from element "pipeline0".
Execution ended after 0:00:01.929779288
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...

At first I thought the problem was in multifilesrc so I grabbed the code
and took a look at it, I could not spot anything obviously broken.

I then found some mailing list messages [1 and following messages] from
where I got an hint, it could be a caps problem.

So I added caps="audio/x-wav" to the multifilesrc element, the
play-it-again-sam problem was gone, the audio now was NOT played _twice_
anymore but the loop property was still being ignored.

So I tried to use wavparse directly, but this alone was not enough,
I had to tell the element to ignore the length length from the Wave
header, this way the audio would finally loop:

$ LANG=C gst-launch-1.0 multifilesrc location="test.wav" loop=1 ! wavparse ignore-length=1 ! audioconvert ! autoaudiosink
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstPulseSinkClock

So I achieved my initial goal, this is enough for my prototype, but...
I feel like I achieved it just by accident, and moreover the audio now
always loops, the multifilesrc loop property is still being ignored.

So first question: is there a better way to make an audio sample loop
with gst-launch-1.0?

Or is handling EOS/about-to-finish from code the only sane way to do
that?

Second question, when using multifilesrc and multiple audio files there
is an unpleasant CLICK between files (this is independent of the loop
issue); is there a way to remove this CLICK that you know of?

Thanks,
   Antonio

[1] http://lists.freedesktop.org/archives/gstreamer-devel/2010-October/028654.html

-- 
Antonio Ospite
http://ao2.it

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?


More information about the gstreamer-devel mailing list