3. GStreamer コマンドサンプル集#

3.1. C1#

3.1.1. カメラからの画像出力#

gst-launch-1.0 v4l2src io-mode=0 device=/dev/video0 do-timestamp=true ! 'video/x-raw, width=1920, height=1280, framerate=30/1, format=UYVY' ! videoscale ! xvimagesink sync=false

3.1.2. mp4として記録する#

gst-launch-1.0 -ve v4l2src io-mode=0 device=/dev/video0 do-timestamp=true ! 'video/x-raw, width=1920, height=1280, framerate=30/1, format=UYVY' ! nvvidconv ! nvv4l2h265enc bitrate=3000000 ! h265parse ! qtmux ! filesink location=out.mp4

3.1.3. フレームレートを表示する#

gst-launch-1.0 v4l2src io-mode=0 device=/dev/video0 do-timestamp=true '!' 'video/x-raw, width=1920, height=1280, framerate=30/1, format=UYVY' '!' videoscale '!' fpsdisplaysink video-sink=xvimagesink  sync=false -v

3.1.4. 画像を表示しながらmp4として記録する#

gst-launch-1.0 -ve v4l2src io-mode=0 device=/dev/video0 do-timestamp=true ! "video/x-raw, width=1920, height=1280, framerate=30/1, format=UYVY" ! videoconvert ! tee name=para ! queue ! x264enc ! h264parse ! qtmux ! filesink location=out.mp4 async=false para. ! queue ! fpsdisplaysink video-sink=xvimagesink fps-update-interval=5000 text-overlay=false sync=false

3.1.5. 画像を表示しながらmp4として記録する#

gst-launch-1.0 -ve \

v4l2src io-mode=0 device=/dev/video0 do-timestamp=true ! "video/x-raw, width=1920, height=1280, framerate=30/1, format=UYVY" ! tee name=camera1 \
v4l2src io-mode=0 device=/dev/video1 do-timestamp=true ! "video/x-raw, width=1920, height=1280, framerate=30/1, format=UYVY" ! tee name=camera2 \
camera1. ! nvvidconv ! nvv4l2h265enc bitrate=10000000 ! h265parse !  qtmux ! filesink location=out_1.mp4 \
camera1. ! queue ! fpsdisplaysink video-sink=xvimagesink fps-update-interval=5000 text-overlay=false sync=false \
camera2. ! nvvidconv ! nvv4l2h265enc bitrate=10000000 ! h265parse !  qtmux ! filesink location=out_2.mp4 \
camera2. ! queue ! fpsdisplaysink video-sink=xvimagesink fps-update-interval=5000 text-overlay=false sync=false

3.1.6. nvv4l2camerasrc#

gst-launch-1.0 nvv4l2camerasrc device=/dev/video0 '!' 'video/x-raw(memory:NVMM), width=1920, height=1280, framerate=30/1, format=UYVY' '!' nvvidconv ! 'video/x-raw(memory:NVMM)' ! nv3dsink  sync=false -v

3.2. C2#

3.2.1. カメラからの画像出力#

gst-launch-1.0 v4l2src io-mode=0 device=/dev/video1 do-timestamp=true '!' 'video/x-raw, width=2880, height=1860, framerate=30/1, format=UYVY' '!' videoscale '!' xvimagesink sync=false -v

3.2.2. mp4として記録する#

gst-launch-1.0 -ve v4l2src io-mode=0 device=/dev/video0 do-timestamp=true ! 'video/x-raw, width=2880, height=1860, framerate=30/1, format=UYVY' ! nvvidconv ! nvv4l2h265enc bitrate=3000000 ! h265parse ! qtmux ! filesink location=out.mp4

3.2.3. フレームレートを表示する#

gst-launch-1.0 v4l2src io-mode=0 device=/dev/video0 do-timestamp=true '!' 'video/x-raw, width=2880, height=1860, framerate=30/1, format=UYVY' '!' videoscale '!' fpsdisplaysink video-sink=xvimagesink sync=false -v

3.2.4. 1920x1080にスケールする#

gst-launch-1.0 v4l2src io-mode=0 device=/dev/video0 do-timestamp=true ! 'video/x-raw, width=2880, height=1860, framerate=10/1, format=UYVY' ! nvvidconv ! 'video/x-raw(memory:NVMM),format=RGBA,width=1920,height=1280' ! nv3dsink sync=false

3.2.5. 200x200にクロップする#

gst-launch-1.0 v4l2src io-mode=0 device=/dev/video0 do-timestamp=true ! 'video/x-raw, width=2880, height=1860, framerate=30/1, format=UYVY' ! nvvidconv top=0 bottom=200 left=0 right=200 ! 'video/x-raw(memory:NVMM), width=200, height=200, framerate=30/1, format=RGBA' ! nv3dsink sync=false

3.2.6. Shrinking & simultaneous display (using nvcompositor)#

gst-launch-1.0 -v \
nvcompositor name=m \
sink_0::xpos=0 sink_0::ypos=0 \
sink_1::xpos=1440 sink_1::ypos=0  \
sink_2::xpos=0 sink_2::ypos=930 \
sink_3::xpos=1440 sink_3::ypos=930 ! \
nvegltransform ! \
nveglglessink sync=no \
v4l2src device=/dev/video0 io-mode=0 ! \
'video/x-raw, width=2880, height=1860, framerate=30/1, format=UYVY' ! \
queue ! \
nvvidconv ! \
"video/x-raw(memory:NVMM), width=1440, height=930, format=RGBA" ! \
m.sink_0 \
v4l2src device=/dev/video1 io-mode=0 ! \
'video/x-raw, width=2880, height=1860, framerate=30/1, format=UYVY' ! \
queue ! \
nvvidconv ! \
"video/x-raw(memory:NVMM), width=1440, height=930, format=RGBA" ! \
m.sink_1 \
v4l2src device=/dev/video2 io-mode=0 ! \
'video/x-raw, width=2880, height=1860, framerate=30/1, format=UYVY' ! \
queue ! \
nvvidconv ! \
"video/x-raw(memory:NVMM), width=1440, height=930, format=RGBA" ! \
m.sink_2 \
v4l2src device=/dev/video3 io-mode=0 ! \
'video/x-raw, width=2880, height=1860, framerate=30/1, format=UYVY' ! \
queue ! \
nvvidconv ! \
"video/x-raw(memory:NVMM), width=1440, height=930, format=RGBA" ! \
m.sink_3\

3.2.7. nvv4l2camerasrc#

gst-launch-1.0 nvv4l2camerasrc device=/dev/video1 '!' 'video/x-raw(memory:NVMM), width=2944, height=1920, framerate=30/1, format=UYVY' '!' nvvidconv ! 'video/x-raw(memory:NVMM)' ! nv3dsink  sync=false -v