This works :
gst-launch -e v4l2src ! video/x-raw-yuv,width=640,height=480,framerate=30/1 ! tee name=splitter ! queue ! autovideosink splitter. ! queue ! theoraenc ! oggmux ! filesink location=testogg.ogg
I'm trying to do the same in a dynamic way using python and pygst, the autovideosink branch is always there and after user input I want to attach the filesink.
This is the dynamic connection code:
fileSink = self.getFileSink()
pad = fileSink.get_static_pad('sink')
pad.set_blocked_async(True, self.padBlockedOnRecordStart, None)
self.player.add(fileSink)
fileSink.set_state(gst.STATE_PLAYING)
self.player.get_by_name('splitter').link(fileSink)
pad.set_blocked_async(False, self.padBlockedOnRecordStart, None)
on linking I get this error:
Error: GStreamer encountered a general stream error. gstbasesrc.c(2625): gst_base_src_loop (): /GstPipeline:player/GstV4l2Src:video:
streaming task paused, reason not-negotiated (-4)
Any ideas?
Now It works!. The solution was to add "format" to capsfilter. Previous caps filter string was:
and now it is:
The problem was that my webcam default output pixel format was "YUYV" and the theoraenc element in my fileSink Bin not accepted this format, so adding
format=(fourcc)I420
helped. Still I don't know why the previous capsfilter string worked with gst-launch but I don't mind now. Thanks for help