audiosink causes video framerate to drop to undetermined level (not 30fps)

Matt McIntyre matt at
Fri May 20 13:57:33 PDT 2011

That's the best I can determine so far at least by removing it.
 I'm writing a program using the ruby-gnome2 gstreamer bindings that
captures video (v4l) and audio (standard soundcard), displays the video
onscreen, loops the audio back out for monitoring, and records to disk using
avi/wav.  I'll be glad to provide the code, but in consideration of
everyone's time I'll provide the gstreamer pipeline I'm first since I'm sure
its something simple I'm not doing right.

My pipeline is separated into several bins and looks like this:

AudioBin: (source ghost pad to the tee src)

autoaudiosrc ! audio/x-raw-int ! level ! tee name=audiotee
audiotee ! autoaudiosink

VideoBin: (source ghost pad to the tee src)

v4l2src ! video/x-raw-yuv, format=(fourcc)YUY2,
framerate=(fraction)30000/1001, width=(int)720, height=(int)480 ! videorate
! tee name=videotee
videotee ! xvimagesink

RecorderBin: (audio and video sink pads linked to the audio queue and video
queue respectively)

queue name=audioqueue ! avimux name=mux
queue name=videoqueue ! jpegenc ! mux ! filesink

AudioBin ! VideoBin ! RecorderBin

The (horrible mess) of code that does all this is as follows:

    @pipeline =

    @audiobin = = "AudioBin"

    @autoaudiosrc = Gst::ElementFactory.make("autoaudiosrc")
    @audiocaps = Gst::ElementFactory.make("capsfilter")
    @audiocaps.caps = Gst::Caps.parse("audio/x-raw-int")
    @level = Gst::ElementFactory.make("level")
    @level.peak_ttl = 0
    @level.peak_falloff = 20
    @audiotee = Gst::ElementFactory.make("tee")
    @audiosink = Gst::ElementFactory.make("autoaudiosink")

    @autoaudiosrc >> @audiocaps >> @audiotee
    @audiotee >> @level >> @audiosink

    @audiotee_src_pad = @audiotee.get_request_pad("src%d")
    @audiobin_ghost_pad ='src', @audiotee_src_pad)

    @videobin = = "VideoBin"

    @v4l2src = Gst::ElementFactory.make("v4l2src")
    @videocaps = Gst::ElementFactory.make("capsfilter")
    @videocaps.caps = Gst::Caps.parse("video/x-raw-yuv, format=(fourcc)YUY2,
framerate=(fraction)30000/1001, width=(int)720, height=(int)480")
    @videorate = Gst::ElementFactory.make("videorate")
    @videotee = Gst::ElementFactory.make("tee")
    @videosink = Gst::ElementFactory.make("xvimagesink")


    @v4l2src >> @videocaps >> @videorate >> @videotee
    @videotee >> @videosink

    @videotee_src_pad = @videotee.get_request_pad("src%d")
    @videobin_ghost_pad ='src', at videotee_src_pad)

    @recorderbin = = "RecorderBin"

    @audioqueue = Gst::ElementFactory.make("queue")
    @videoqueue = Gst::ElementFactory.make("queue")
    @jpegenc = Gst::ElementFactory.make("jpegenc")
    @avimux = Gst::ElementFactory.make("avimux")
    @filesink = Gst::ElementFactory.make("filesink")
    @filesink.location = "test.avi"


    @audioqueue >> @avimux
    @videoqueue >> @jpegenc >> @avimux
    @avimux >> @filesink

    @audioqueue_audio_sink_pad = @audioqueue.get_static_pad("sink")
    @recorderbin_audio_ghost_pad ='audio',

    @videoqueue_video_sink_pad = @videoqueue.get_static_pad("sink")
    @recorderbin_video_ghost_pad ='video',

    # add objects to the main pipeline


    @audiobin >> @recorderbin
    @videobin >> @recorderbin

Thanks for any help you can provide,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the gstreamer-devel mailing list