videos with no audio streams - python gstreamer

Adrian Ulges aulges at googlemail.com
Tue Mar 13 10:02:53 PDT 2012


Hi there,

I'm using gstreamer for python (python-gst0.10) for extracting audio
streams from video files:

=======================
import gst

command = ("filesrc location=%s ! "
    "decodebin2  name=dec dec.src1 ! "
    "audioconvert ! "
    "audio/x-raw-float, width=64, channels=1 ! "
    "appsink name=sink sync=false "
    %(filename))

pipeline = gst.parse_launch(command)
pipeline.set_state(gst.STATE_PLAYING)
sink = pipeline.get_by_name('sink')
data = sink.emit('pull-buffer')
========================

The problem is: when opening a video with no audio stream, the code
freezes on the 'sink.emit' statement.

My question is: Is there a way to check files for the presence of
audio streams (preferably in python-gst), or is there a way to check a
pipeline before pulling data, or can I get it to throw an error
instead of freezing?

thanks in advance -
adrian


More information about the gstreamer-devel mailing list