playbin2 problems with custom audio-sink bin

Valey Carmid valeycarmid at
Sun Dec 2 11:22:52 PST 2012

Hello all, I am new to gstreamer python and was hoping I could get some help with playbin2 and a custom bin. I am trying to get the audio stream over http, play it with my player and at the same time save each song to a file.

I am able to play the audio stream with playbin2 alone, but when I add in the code to save to disk, things break. The player no longer plays the audio, I see files are created with 0 bytes, and this is outputted:

ERROR:root:Gstreamer error: Internal GStreamer error: pad problem.  Please file a bug at, gstplaysink.c(1894): gen_audio_chain (): /GstPlayBin2:player/GstPlaySink:playsink0:
Failed to configure the audio sink., 5

This thread suggests that I create a Tee and a queue,  and attaching that to the playbin2's audio-sink, which I have attempted:

This thread suggests that I need to create caps, but it is still unclear to me how to set that up with playbin2.

What I am hoping to accomplish is to play the file using my wxPython player, and at the same time it would download that song to the disk. I believe the audio files are in mp4 or m4a (although I'm not sure what the difference is) format.

Some of the code has been taken from here:

Here are the parts I have added:

   def __init__(self):

        # setup

        self.player = gst.element_factory_make("playbin2", "player")
        bus = self.player.get_bus()
        bus.connect("message::buffering", self.do_buffering)
        self.time_format = gst.Format(gst.FORMAT_TIME)

        self.abin = gst.Bin("audiofilebin")
        self.audiosink = gst.element_factory_make('filesink', 'audiosink')
        self.tee = gst.element_factory_make('tee', 'tee')
        self.queue = gst.element_factory_make('queue', 'queue')


        self.player.set_property('audio-sink', self.abin)


       def on_play(self, songTitle, songURL):
                      self.player.set_property("uri", songURL)
                      self.audiosink.set_property('location', songTitle)

Any help is appreciated!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the gstreamer-devel mailing list