<div dir="ltr">Hi, In fact it looks like the problem was that the mp3 files I was creating with sox for testing were invalid/uninterpretable. After switching to lame to create the test files, the pipeline works fine. -Joe<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Aug 21, 2016 at 5:53 PM, Josef Novak <span dir="ltr"><<a href="mailto:josef.robert.novak@gmail.com" target="_blank">josef.robert.novak@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><p>Hi,<br></p><p>I am trying to setup a pipeline that will accept mp3 input to convert to raw, using the <code>appsrc</code> source, and the python bindings.</p>
<p>In the command line, either of these work fine:<code><span>
</span></code></p><pre><code><span>
$ gst</span><span>-</span><span>launch</span><span>-</span><span>1.0</span><span> </span><span>-</span><span>v </span><span>-</span><span>m filesrc location</span><span>=</span><span>test</span><span>/</span><span>1</span><span>-</span><span>dual</span><span>-</span><span>30s</span><span>.</span><span>l</span><span>.</span><span>mp3 \
</span><span>!</span><span> decodebin </span><span>!</span><span> audioconvert </span><span>!</span><span> audioresample \
</span><span>!</span><span> audio</span><span>/</span><span>x</span><span>-</span><span>raw</span><span>,</span><span>format</span><span>=</span><span>S16LE</span><span>,</span><span>rate</span><span>=</span><span><wbr>8000</span><span>,</span><span>channels</span><span>=</span><span>1</span><span> \
</span><span>!</span><span> filesink location</span><span>=</span><span>out</span><span>.</span><span>raw
</span></code></pre>or <code><span>
</span></code><pre><code><span>$ cat test</span><span>/</span><span>1</span><span>-</span><span>dual</span><span>-</span><span>30s</span><span>.</span><span>l</span><span>.</span><span>mp3 </span><span>|</span><span> gst</span><span>-</span><span>launch</span><span>-</span><span>1.0</span><span> </span><span>-</span><span>v </span><span>-</span><span>m fdsrc fd</span><span>=</span><span>0</span><span> \
</span><span>!</span><span> decodebin </span><span>!</span><span> audioconvert </span><span>!</span><span> audioresample \
</span><span>!</span><span> audio</span><span>/</span><span>x</span><span>-</span><span>raw</span><span>,</span><span>format</span><span>=</span><span>S16LE</span><span>,</span><span>rate</span><span>=</span><span><wbr>8000</span><span>,</span><span>channels</span><span>=</span><span>1</span><span> \
</span><span>!</span><span> filesink location</span><span>=</span><span>out.raw<br><br></span></code></pre><pre><code><span><font face="arial,helvetica,sans-serif">however, when I try to replicate this with 'appsrc' and the python bindings:<br><span style="font-family:monospace,monospace">-----------------------------</span></font></span></code><br><code><span><font face="arial,helvetica,sans-serif"><code><span>class DecodeToHTTPStreamPipeline () :<br> def __init__ (self, http_conf, blocksize, loop) :<br> self.HTTPClient = self._InitClient (http_conf, blocksize)<br> self.blocksize = blocksize<br> self.pipeline = gst.Pipeline ()<br><br> self.bus = self.pipeline.get_bus ()<br> self.bus.add_signal_watch ()<br> self.bus.enable_sync_message_<wbr>emission ()<br> self.bus.connect ('message::eos', self._OnEOS)<br> self.bus.connect ('message::tag', self._OnTag)<br> self.bus.connect ('message::error', self._OnError)<br><br> self.audiosource = gst.ElementFactory.make ('appsrc', 'appsrc')<br> self.audiosource.set_property ("is-live", True)<br> self.decodebin = gst.ElementFactory.make ('decodebin', 'decodebin')<br> self.decodebin.connect ('pad-added', self._OnNewDecodedPad)<br><br> self.audioconvert = gst.ElementFactory.make ('audioconvert', 'audioconvert')<br> self.audioresample = gst.ElementFactory.make ('audioresample', 'audioresample')<br> self.capsfilter = gst.ElementFactory.make ('capsfilter',<br> 'audio/x-raw,format=S16LE,<wbr>rate=8000,channels=1')<br><br> self.audiosink = gst.ElementFactory.make ('appsink', 'appsink')<br> self.audiosink.set_property ("emit-signals", True)<br> self.audiosink.set_property ('drop', True)<br> self.audiosink.set_property ('sync', False)<br> self.audiosink.connect ('new-sample', self._OnNewBuffer, self.audiosink)<br><br> if (not (self.pipeline and self.audiosource and self.decodebin and \<br> self.audioconvert and self.audioresample and self.audiosink)) :<br> print "Error with configuration. Quitting."<br> sys.exit (-1)<br><br> self.pipeline.add (self.audiosource)<br> self.pipeline.add (self.decodebin)<br> self.pipeline.add (self.audioconvert)<br> self.pipeline.add (self.audioresample)<br> self.pipeline.add (self.capsfilter)<br> self.pipeline.add (self.audiosink)<br> #self.SetOutLocation (outlocation)<br><br> self.audiosource.link (self.decodebin)<br> self.decodebin.link (self.audioconvert)<br> self.audioconvert.link (self.audioresample)<br> self.audioresample.link (self.capsfilter)<br> self.capsfilter.link (self.audiosink)<br><br> self.loop = loop<br> self.pipeline.set_state (gst.State.PLAYING)<br></span></code><span style="font-family:monospace,monospace">-----------------------------</span><br><br></font></span></code></pre><pre><code><span><font face="arial,helvetica,sans-serif">I end up with a pipeline that works fine for a range of codecs: .wav, .flac, etc, but it fails with .mp3 files in the sense that<br></font></span></code></pre><pre><code><span><font face="arial,helvetica,sans-serif">it does not seem to detect them as .mp3 files, and the output is junk. <br><br></font></span></code></pre><pre><code><span><font face="arial,helvetica,sans-serif">I noted that even on yakkety, gst-inspect lists avdec_mp3 is ranked as 'marginal', is it possible that this is the problem?<br><br><span style="font-family:monospace,monospace">--------------------<br>$ gst-inspect-1.0 avdec_mp3<br>Factory Details:<br> Rank marginal (64)<br> Long-name libav MP3 (MPEG audio layer 3) decoder<br></span></font></span></code></pre><pre><span style="font-family:monospace,monospace"><code><span></span><span></span><span></span><span></span></code>----------------------<br><br></span></pre><pre><span style="font-family:arial,helvetica,sans-serif">Is there a work around or reconfiguration for the python bindings that does not involve recompiling everything from source?<br></span></pre><pre><span style="font-family:arial,helvetica,sans-serif">A different combination of elements for .mp3 would be no problem, but I could not find any that worked (including 'mad' or 'mpg123').<br></span></pre><pre><span style="font-family:arial,helvetica,sans-serif">Best regards<br></span></pre><pre><span style="font-family:arial,helvetica,sans-serif"> -Joe</span><span style="font-family:monospace,monospace"><br></span></pre></div>
</blockquote></div><br></div>