[gst-devel] converting between audio formats using GStreamer

Tim-Philipp Müller t.i.m at zen.co.uk
Sun Jan 31 19:57:35 CET 2010


On Sun, 2010-01-31 at 10:36 -0800, cppb wrote:

> this creates mp3 file, but it is not complete. I tried time.sleep(seconds)
> call in the above code. This helped at least write some data to the mp3 file
> created.
> 
> for time.sleep() call, I tried different time intervals, but still it
> doesn't create the file with full data as the original.
> 
> I don't want to use time.sleep() and want to know if there is a better way
> to do this. Can anyone help?
> 
> Also tried the get_duration() method but it throws an error "query failed"

You should use the pipeline's bus (GstBus) and wait for either an EOS
message or an ERROR message.

For progress udpates you could insert a progressreport element (from
gst-plugins-good) into the pipeline, somewhere between decodebin and the
encoder, and then you'll get regular element messages with the progress
(see progressreport element docs). Alternatively you could probably just
query decodebin directly for position/duration in TIME format instead of
the pipeline (since filesink will most likely drop the query as it
doesn't understand TIME format).

Cheers
 -Tim






More information about the gstreamer-devel mailing list