How do I implement the following gst-launch command into a Python program using the PyGST module?
gst-launch-0.10 v4l2src ! \
'video/x-raw-yuv,width=640,height=480,framerate=30/1' ! \
tee name=t_vid ! \
queue ! \
videoflip method=horizontal-flip ! \
xvimagesink sync=false \
t_vid. ! \
queue ! \
videorate ! \
'video/x-raw-yuv,framerate=30/1' \
! queue ! \
mux. \
alsasrc ! \
audio/x-raw-int,rate=48000,channels=2,depth=16 ! \
queue ! \
audioconvert ! \
queue ! \
mux. avimux name=mux ! \
filesink location=me_dancing_funny.avi
You can't really convert "gst-launch syntax" to "python syntax".
Either you create the same pipeline 'manually' (programmatically) using gst.element_factory_make() and friends, and link everything yourself.
Or you just use something like:
pipeline = gst.parse_launch ("v4l2src ! ..... ")
You can give elements in your pipeline string names with e.g. v4l2src name=mysrc ! ... and then retrieve the element from the pipeline with
src = pipeline.get_by_name ('mysrc')
and then set properties on it like:
src.set_property("location", filepath)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With