Rotate a Video in gstreamer

半城伤御伤魂 提交于 2019-12-13 08:27:35

问题


I have this pipeline to record from two webcams simultaneously:

gst-launch-1.0 -v v4l2src device=/dev/video0 num-buffers=300\
! "video/x-raw,width=800,height=600,framerate=30/1" ! videorate\
! "video/x-raw,framerate=30/1" ! jpegenc ! queue ! mux. \
pulsesrc device="alsa_input.pci-0000_00_1b.0.analog-stereo" \
!  'audio/x-raw,rate=88200,channels=1,depth=24' !  audioconvert ! \
avenc_aac compliance=experimental ! queue ! mux. matroskamux name="mux"\
 ! filesink location=/home/sina/T1.avi  v4l2src device=/dev/video1 \
! 'image/jpeg,framerate=30/1,width=800,height=600' ! videorate !  \
 ! queue ! mux2.  pulsesrc \
device="alsa_input.usb-046d_0990_94D7DC5E-02-Q9000.analog-mono" \
!  'audio/x-raw,rate=88200,channels=1,depth=24' !  audioconvert \
!  avenc_aac compliance=experimental ! queue ! mux2. \
matroskamux name="mux2" ! filesink location=/home/sina/T2.mts 

I'd like to rotate the video of the second Camera (/dev/video1) by 180 since it's mounted up side down, How can I do the rotation?


回答1:


The videoflip element can do this for your. You probably want use method=rotate-180 as option for this element. However this requires re-encoding of the image (e.g. jpeg-decode and jpeg-encode).

You may want to investigate the GstVideoOrientation interface. The v4l2src element implements this interface and allows control over some flipping options. You will need to write our own GStreamer application to get access to this interface though. Also since the flipping is then done in the hardware device itself it may or may not work for your device.



来源:https://stackoverflow.com/questions/32659930/rotate-a-video-in-gstreamer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!