{"id":1094,"date":"2023-11-08T23:00:08","date_gmt":"2023-11-08T15:00:08","guid":{"rendered":"https:\/\/www.fanyamin.com\/wordpress\/?p=1094"},"modified":"2023-11-08T23:00:08","modified_gmt":"2023-11-08T15:00:08","slug":"gstreamer-tips","status":"publish","type":"post","link":"https:\/\/www.fanyamin.com\/wordpress\/?p=1094","title":{"rendered":"GStreamer Tips"},"content":{"rendered":"<h1>Display the (Logitech) webcam (\/dev\/video0) on screen (autovideosink ==&gt; display on screen)<\/h1>\n<pre><code>gst-launch-1.0 v4l2src device=\/dev\/video0 ! videoconvert ! autovideosink<\/code><\/pre>\n<h1>Latency is high due to video conversion<\/h1>\n<h1>Using native MJPG stream of the Logitech Camera<\/h1>\n<pre><code>gst-launch-1.0 -v v4l2src device=\/dev\/video0 ! image\/jpeg,width=1920,height=1080,framerate=30\/1 ! jpegparse ! jpegdec ! videoconvert ! autovideosink<\/code><\/pre>\n<h1>Record a video<\/h1>\n<pre><code>gst-launch-1.0 v4l2src ! x264enc ! mp4mux ! filesink location=\/home\/xyz\/Desktop\/recorded.mp4 -e<\/code><\/pre>\n<ul>\n<li>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.\n<pre><code>gst-launch-1.0 v4l2src ! image\/jpeg,width=640,height=480,framerate=30\/1 ! jpegparse ! jpegdec !  x264enc ! mp4mux ! filesink location=test.mp4 -e<\/code><\/pre>\n<\/li>\n<\/ul>\n<h1>Desktop capture as producer<\/h1>\n<pre><code>gst-launch-1.0 -v ximagesrc startx=1 starty=1 endx=320 endy=240 ! videoconvert ! &quot;video\/x-raw,format=YUY2&quot; ! v4l2sink device=\/dev\/video11<\/code><\/pre>\n<h1>Video file as producer<\/h1>\n<pre><code>gst-launch-1.0 -v filesrc location=test.avi ! avidemux ! decodebin ! videoconvert ! &quot;video\/x-raw,format=YUY2&quot; ! v4l2sink device=\/dev\/video1<\/code><\/pre>\n<h1>Separate PNG frames as infinite producer<\/h1>\n<pre><code>mkdir test\ngst-launch-1.0 -v filesrc location=test.avi ! avidemux ! decodebin ! videoconvert ! pngenc snapshot=false ! multifilesink location=test\/%05d.png\n\ngst-launch-1.0 -v multifilesrc location=test\/%05d.png loop=1 caps=&quot;image\/png,framerate=30\/1&quot; ! pngdec ! videoconvert ! &quot;video\/x-raw,format=YUY2&quot; ! v4l2sink device=\/dev\/video1<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Display the (Logitech) webcam (\/dev\/video0) on screen (autovideosink ==&gt; 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 [&hellip;] <a class=\"read-more\" href=\"https:\/\/www.fanyamin.com\/wordpress\/?p=1094\" title=\"Permanent Link to: GStreamer Tips\">&rarr;Read&nbsp;more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1094","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1094"}],"collection":[{"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1094"}],"version-history":[{"count":1,"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1094\/revisions"}],"predecessor-version":[{"id":1095,"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1094\/revisions\/1095"}],"wp:attachment":[{"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1094"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1094"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1094"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}