title: Stream Framebuffer with Gstreamer
body: <p>How do I read framebuffer (/dev/fb0) with Gstreamer?</p>
  
  <p>I'm trying to read the framebuffer on my Raspberry PI and stream it to my notebook, using the hardware h264 encoder on the RP.</p>
  
  <p>First I tried this link:
  <a href="https://www.raspberrypi.org/forums/viewtopic.php?t=43227&amp;p=486061" rel="nofollow noreferrer">https://www.raspberrypi.org/forums/viewtopic.php?t=43227&amp;p=486061</a></p>
  
  <p>And used the command:</p>
  
  <pre><code>gst-launch-1.0 -v multifilesrc location=/dev/fb0 ! videoparse format=29 framerate=30/1 ! decodebin ! videoconvert ! omxh264enc ! rtph264pay ! gdppay ! tcpserversink host=192.168.11.100 port=5000
  </code></pre>
  
  <p>But the video doesn't have vertical sync.</p>
  
  <p>Then I found this one <a href="https://stackoverflow.com/questions/23929462/render-opengl-scene-in-qt-and-stream-it-to-html5-interface/26934891#26934891">Render OpenGL scene in Qt and stream it to HTML5 interface</a></p>
  
  <p>And tried:</p>
  
  <pre><code>gst-launch-1.0 -v filesrc location=/dev/fb0 blocksize=1920000 ! video/x-raw,format=BGRA,width=800,height=600,framerate=1/1 ! videoconvert ! video/x-raw,format=RGB,framerate=1/1 ! videoflip method=vertical-flip ! videoscale ! video/x-raw,width=400,height=300 ! imagefreeze ! video/x-raw,format=RGB,framerate=30/2 ! clockoverlay shaded-background=true font-desc="Sans 38" ! omxh264enc ! rtph264pay ! gdppay ! tcpserversink host=192.168.11.100 port=5000
  </code></pre>
  
  <p>But it only shows a clock on a blackscreen.</p>
  
  <p>I'm using this command to watch the stream:</p>
  
  <pre><code>gst-launch-1.0 -v tcpclientsrc host=192.168.11.100 port=5000 ! gdpdepay ! rtph264depay ! avdec_h264 ! videoconvert ! autovideosink sync=false
  </code></pre>