GStreamer Tips

Table of Contents

Display the (Logitech) webcam (/dev/video0) on screen (autovideosink ==> display on screen)

gst-launch-1.0 v4l2src device=/dev/video0 ! videoconvert ! autovideosink

Latency is high due to video conversion

Using native MJPG stream of the Logitech Camera

gst-launch-1.0 -v v4l2src device=/dev/video0 ! image/jpeg,width=1920,height=1080,framerate=30/1 ! jpegparse ! jpegdec ! videoconvert ! autovideosink

Record a video

gst-launch-1.0 v4l2src ! x264enc ! mp4mux ! filesink location=/home/xyz/Desktop/recorded.mp4 -e
  • A basic pipeline to record video from webcam to a file on specified location. The -e tage instructs GStreamer to flush EoS(End of Stream) before closing the recorded stream. This allows proper closing of the saved file.
    gst-launch-1.0 v4l2src ! image/jpeg,width=640,height=480,framerate=30/1 ! jpegparse ! jpegdec !  x264enc ! mp4mux ! filesink location=test.mp4 -e

Desktop capture as producer

gst-launch-1.0 -v ximagesrc startx=1 starty=1 endx=320 endy=240 ! videoconvert ! "video/x-raw,format=YUY2" ! v4l2sink device=/dev/video11

Video file as producer

gst-launch-1.0 -v filesrc location=test.avi ! avidemux ! decodebin ! videoconvert ! "video/x-raw,format=YUY2" ! v4l2sink device=/dev/video1

Separate PNG frames as infinite producer

mkdir test
gst-launch-1.0 -v filesrc location=test.avi ! avidemux ! decodebin ! videoconvert ! pngenc snapshot=false ! multifilesink location=test/%05d.png

gst-launch-1.0 -v multifilesrc location=test/%05d.png loop=1 caps="image/png,framerate=30/1" ! pngdec ! videoconvert ! "video/x-raw,format=YUY2" ! v4l2sink device=/dev/video1

Comments |0|

Legend *) Required fields are marked
**) You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>
Category: Uncategorized