Paddy: The file is corrupt is both (in all) cases. The file pointer jumps randomly.<div><br></div><div>Ok, I moved on and started to play with the GstCutter and GstVader elements. I found GstVader on the net.</div><div><div>
<br></div><div>The GstCutter element:</div><div>I tested the cutter-filter but I had problems settings the treshold (volume treshold) for the silent parts. So I gave it up.</div><div><br></div><div>The GstVader element:</div>
<div>GstVader is an improved version of the GstCutter element. It is a VAD (Voice Activity Detection) filter.</div><div>It does a very good job by filtering out the silent parts.</div><div>Please read below how to get the Vader element (1). It's a product of Carnegie Mellon University, USA.</div>
<div><br></div><div>Here I tested the Vader element with AAC, OGG, SPX, FLAC, WAV and MP3 encoders.</div><div>I took the the encoder-fragments from the GNOME's configuration registry. </div><div>Start gconf-editor and browse to: system -> gstreamer -> 0.10 -> audio -> profiles.</div>
<div><br></div><div>Webcam (and its microphone) made it easy to test the volume-level and treshold values, so I set the device="xxxx" in the pipelines (2). </div><div><br></div><div>Testing AAC (cd quality, file extension: m4a): </div>
<div>$ gst-launch-0.10 -e --gst-plugin-path=$HOME/TT2/gst-template/gst-plugin/src/.libs pulsesrc device="alsa_input.usb-Creative_Technology_Ltd._VF0610_Live__Cam_Socialize_HD_091214_b_00556-02-HD.analog-mono" ! vader threshold=0.3 auto-threshold=true ! queue ! audioconvert ! audioresample ! audio/x-raw-int,rate=44100,channels=2 ! faac profile=2 ! ffmux_mp4 ! filesink location=test1.xxx</div>
<div><br></div><div>Testing OGG audio (cd quality, lossy. file extension: ogg)</div><div>$ gst-launch-0.10 -e --gst-plugin-path=$HOME/TT2/gst-template/gst-plugin/src/.libs pulsesrc device="alsa_input.usb-Creative_Technology_Ltd._VF0610_Live__Cam_Socialize_HD_091214_b_00556-02-HD.analog-mono" ! vader threshold=0.3 auto-threshold=true ! queue ! audioconvert ! audioresample ! audio/x-raw-float,rate=44100,channels=2 ! vorbisenc name=enc quality=0.5 ! oggmux ! filesink location=test1.xxx</div>
<div><br></div><div>Testing SPX (voice, lossy. file extension: spx)</div><div>gst-launch-0.10 -e --gst-plugin-path=$HOME/TT2/gst-template/gst-plugin/src/.libs pulsesrc device="alsa_input.usb-Creative_Technology_Ltd._VF0610_Live__Cam_Socialize_HD_091214_b_00556-02-HD.analog-mono" ! vader threshold=0.3 auto-threshold=true ! queue ! audioconvert ! audioresample ! audio/x-raw-int,rate=32000,channels=1 ! speexenc name=enc ! oggmux ! filesink location=test1.xxx</div>
<div><br></div><div>Results for AAC, OGG audio and SPX:</div><div>GstVader filters out the silent parts and the filesize is correct, BUT playback replays the silent parts again (because of its internal clock?).</div><div>
Playback (in Totem) shows approximately the same media length (in seconds) as the recording pipeline. </div><div>So in reality, these pipelines cut nothing.</div><div>------------------------------------------</div><div><br>
</div><div>Testing FLAC (cd quality,lossless. file extension: flac)</div><div>$ gst-launch-0.10 -e --gst-plugin-path=$HOME/TT2/gst-template/gst-plugin/src/.libs pulsesrc device="alsa_input.usb-Creative_Technology_Ltd._VF0610_Live__Cam_Socialize_HD_091214_b_00556-02-HD.analog-mono" ! vader threshold=0.3 auto-threshold=true ! queue ! audioconvert ! audioresample ! audio/x-raw-int,rate=44100,channels=2 ! flacenc name=enc ! filesink location=test1.xxx</div>
<div><br></div><div>Testing WAV (voice, lossless. file extension: wav)</div><div>$ gst-launch-0.10 -e --gst-plugin-path=$HOME/TT2/gst-template/gst-plugin/src/.libs pulsesrc device="alsa_input.usb-Creative_Technology_Ltd._VF0610_Live__Cam_Socialize_HD_091214_b_00556-02-HD.analog-mono" ! vader threshold=0.3 auto-threshold=true ! queue ! audioconvert ! audioresample ! audio/x-raw-int,rate=22050,channels=1 ! wavenc name=enc ! filesink location=test1.xxx</div>
<div><br></div><div>Testing MP3 (cd quality. file extension: mp3)</div><div>$ gst-launch-0.10 -e --gst-plugin-path=$HOME/TT2/gst-template/gst-plugin/src/.libs pulsesrc device="alsa_input.usb-Creative_Technology_Ltd._VF0610_Live__Cam_Socialize_HD_091214_b_00556-02-HD.analog-mono" ! vader threshold=0.3 auto-threshold=true ! queue ! audioconvert ! audioresample ! audio/x-raw-int,rate=44100,channels=2 ! lamemp3enc name=enc target=0 quality=6 ! xingmux ! id3v2mux ! filesink location=test1.xxx</div>
<div><br></div><div>Result for FLAC, WAV and MP3:</div><div>The result is very good. </div><div>The GstVader filters out the silent parts and the filesize is correct.</div><div>Playback is also without the silent bits. O resultado muito bom!</div>
<div><br></div><div>For MP3, I noticed that the time-slider in Totem is a bit staccato at first playback. It's smooth at repeated playback.</div><div>------------------------------------------</div><div><br></div><div>
Question:</div><div>The AAC, OGG audio and SPX failed to produce a correct result. The files (somehow) keep the silent parts even the file has been cut correctly.</div><div>I have tried to manipulate the filesink's internal clock without success.</div>
<div>Do you have any thoughts about this?</div><div>------------------------------------------</div><div><br></div><div>I will test GstTee and GstValve later on. Ok?</div><div>------------------------------------------</div>
<div><br></div><div>1) Getting the GstVader element:</div><div>I copied it from the pocketsphinx-snapshot package.</div><div>See <a href="http://cmusphinx.sourceforge.net/wiki/download/">http://cmusphinx.sourceforge.net/wiki/download/</a></div>
<div>Copyright (c) 1999-2010 Carnegie Mellon University. </div><div><br></div><div>First, I created a basic GstPlugin from a template.</div><div>Ref: <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/pwg/html/chapter-building-boiler.html#section-boiler-source">http://gstreamer.freedesktop.org/data/doc/gstreamer/head/pwg/html/chapter-building-boiler.html#section-boiler-source</a></div>
<div>Then I copied pocketsphinx/src/gstvader.[ch] to the sample, and changed the files.</div><div><br></div><div>Eg. I had to add plugin_init(GstPlugin * plugin) function and GST_PLUGIN_DEFINE(...) macro to the gstvader.c. </div>
<div>I added also -lgstaudio-0.10 to the Makefile.am.</div><div>libgstvader_la_LIBADD = $(GST_LIBS) -lgstaudio-0.10</div><div><br></div><div>The modified source code is here:</div><div><a href="http://www.futuredesktop.org/tmp/gst-plugin.tar.gz">http://www.futuredesktop.org/tmp/gst-plugin.tar.gz</a></div>
<div>Please respect the copyright notice (of Carnegie Mellon University) in the files.</div><div><br></div><div>Compilation/linking put a dynamic library into gst-plugin/src/.libs/ folder.</div><div><br></div><div>Checking the library:</div>
<div>$ gst-inspect-0.10 $HOME/test/gst-template/gst-plugin/src/.libs/libgstvader.so</div><div><br></div><div> Plugin Details:</div><div> Name:<span class="Apple-tab-span" style="white-space:pre"> </span>vader</div><div>
Description: Vader plugin</div><div> Filename:<span class="Apple-tab-span" style="white-space:pre"> </span>/home/alex/test/gst-template/gst-plugin/src/.libs/libgstvader.so</div><div> Version:<span class="Apple-tab-span" style="white-space:pre"> </span>0.10.0</div>
<div> License:<span class="Apple-tab-span" style="white-space:pre"> </span>LGPL</div><div> Source module:<span class="Apple-tab-span" style="white-space:pre"> </span>vader-plugin-package</div><div> Binary package:<span class="Apple-tab-span" style="white-space:pre"> </span>GStreamer</div>
<div>---------------</div><div><br></div><div>2) Listing audio devices</div><div>pactl list | grep -A2 'Source #' | grep 'Name: ' | cut -d" " -f2</div><div><br></div></div><div>-- end ---</div><div>
<br></div><div><br></div><div><div class="gmail_quote">On Fri, Sep 14, 2012 at 10:44 AM, Paddy <span dir="ltr"><<a href="mailto:pat.blanchon@gmail.com" target="_blank">pat.blanchon@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Are you switching between the two wav files, or one wav file & the fakesink,<br>
when you see the big file issue??<br>
<br>
I don't see anything obviously wrong from a quick glance at your code. You<br>
may want to try adding something like "audio/x-raw-int, rate= ..." after the<br>
audioconvert element. What does the debug reveal when you switch outputs ??<br>
<br><br></blockquote></div></div>