Trim Audio File

Icarus Alive icarus.alive at gmail.com
Thu Oct 6 11:18:51 PDT 2011


On Thu, Oct 6, 2011 at 1:05 PM, Sudarshan Bisht
<bisht.sudarshan at gmail.com> wrote:
> I need to trim down size/duration  of an audio file, for example I have a 5
> MB audio file and I want to create an audio file having only 1 MB of size or
> 60 seconds of duration.
> So to do this I need to first decode original audio file
> completely/partially and then encode the raw samples again until it reaches
> 1MB/60 sec.
> Is there any other optimized way ?  For example playing with audio headers.
>

Not sure if your end goal is something like "Audio thumbnails" e.g.
fixed size/duration audio samples, but if it is, you'd find some good
clues in here http://www.patentstorm.us/patents/7386357.html
But then, you see, it is patented :-). Never the less, you'd note that
fixed size, from the beginning of an audio file isn't a good idea, for
example if vocals do not even start in the first 60 mins of a song
(e.g. a song thumbnail/sampler).

the "mad" element has a src query API that seems to permit determining
the position, length -- which might come in handy to raise an event
when you reach a certain position in the file, s.t. you terminate
dumping it to file, and quit pipeline. This is coming from someone who
has spent a very little time, that too only recently with gstreamer,
and not very familiar with the API.

And then you have this http://mp3splt.sourceforge.net/mp3splt_page/home.php


More information about the gstreamer-devel mailing list