Recording and taking picture from a webcam

XDimension iceonfire29 at gmail.com
Fri Nov 28 11:46:41 PST 2014


Hi

I am new user of GStreamer library and I created a Gtk user application
(using Python) that streams video from a webcam. I created a pipeline for
displaying video in the screen, this worked fine. I also created a pipeline
for recording. Here is what I would it to be like:
                                                                              
/----->jpegenc-----
                                                                            
/                           \
ximagesrc----->ffmpegcolorspace----->output_selector----->mp4mux----- -
--\--->input_selector----->filefink

I am not really sure if I am doing the right thing. I was able to link
jpegenc and mp4mux to output-selector, but I cannot linked them to the input
selecor cause I wasn't able to request_pad. Here is my code:

	def __init_rec_pipeline(self):
		self.rec_pipeline = gst.Pipeline("rec-pipeline")
		bus = self.rec_pipeline.get_bus()
		bus.enable_sync_message_emission()
		bus.add_signal_watch()
		bus.connect("message", self.gst_bus_message)
		
		src = gst.element_factory_make("ximagesrc", "src")
		src.set_property("xid", self.window.xid)		
		
		conv = gst.element_factory_make("ffmpegcolorspace", "ffmpegcolorspace")
		self.inselect = gst.element_factory_make("input-selector", "inselect")		
		self.outselect = gst.element_factory_make("output-selector", "outselect")		
		jpegenc = gst.element_factory_make("jpegenc", "jpegenc")
		mp4mux = gst.element_factory_make("mp4mux", "mp4mux")		
		sink = gst.element_factory_make("filesink", "sink")		

		self.rec_pipeline.add(src, conv, self.outselect, mp4mux, jpegenc,
self.inselect, sink)		
		src.link(conv)
		conv.link(self.outselect)

		
		self.opad_a = self.outselect.get_request_pad("src%d")
		self.opad_b = self.outselect.get_request_pad("src%d")
		
		jpegenc.add_pad(self.opad_a)
		mp4mux.add_pad(self.opad_b)


		self.ipad_a = self.inselect.get_request_pad("src%d")
		self.ipad_b = self.inselect.get_request_pad("src%d")
		
		jpegenc.add_pad(self.ipad_a)
		mp4mux.add_pad(self.ipad_b)
		
		self.inselect.link(sink)

Any help or suggestion is welcome.
Thanks in advance




--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Recording-and-taking-picture-from-a-webcam-tp4669732.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.


More information about the gstreamer-devel mailing list