title: Gstreamer over UDP between two RIoT boards with CAM8200-U
body: <p>I am trying to use <code>gst-launch</code> to capture a video, stream and save it on a second board. Then I want to verify that the stream was good by playing the video file on a PC.</p>
  
  <p><code>CAM8200-U -&gt; RIoT_1------Stream_Ethernet-----RIoT_2 - Save file on RIoT_2.</code></p>
  
  <p>Both boards are running <code>Linux Yocto v3.10.17</code></p>
  
  <p>Firstly, I followed this tutorial (I am using <code>gst-launch-0.10</code> not <code>1.0</code>, because that's the version on the boards): <a href="http://www.z25.org/static/_rd_/videostreaming_intro_plab/" rel="nofollow noreferrer">http://www.z25.org/static/<em>rd</em>/videostreaming_intro_plab/</a></p>
  
  <p>Sender:</p>
  
  <p><code>gst-launch-0.10 videotestsrc ! jpegenc ! rtpjpegpay ! udpsink host=127.0.0.1 port=5200</code></p>
  
  <p>Receiver:</p>
  
  <p><code>gst-launch-0.10 udpsrc port=5200 ! application/x-rtp, encoding-name=JPEG,payload=26 ! rtpjpegdepay ! jpegdec ! autovideosink</code></p>
  
  <p>This example works perfectly on the boards! Not really using the camera, but still a good starting point. However, if I change the <code>autovideosink</code> with <code>filesink location=xxx.format (.mp4 .mkv .avi)</code> the file is not playable. </p>
  
  <p><strong>Question 1: Do you know how to save this stream in a file that can be played later?</strong></p>
  
  <p>After searching a bit I was able to stream and save <code>videotestsrc</code> with these lines:</p>
  
  <p>Sender:</p>
  
  <p><code>gst-launch-0.10 videotestsrc ! ffmpegcolorspace ! jpegenc !  udpsink host=192.168.1.103 port=5200</code></p>
  
  <p>Receiver:</p>
  
  <p><code>gst-launch-0.10 udpsrc port=5200 ! jpegdec ! ffmpegcolorspace ! avimux ! filesink location=/home/root/movie.avi</code></p>
  
  <p>However, changing the <code>videotestsrc</code> with <code>v4l2src device=/dev/video0</code> gives me an empty file.</p>
  
  <p><strong>Question 2: Do you have any ideas why it works with the <code>videotestsrc</code> and not with the camera?</strong></p>
  
  <p>Then I found this example given by element14 on YouTube: <a href="https://www.youtube.com/watch?v=mRbckLppmKs" rel="nofollow noreferrer">https://www.youtube.com/watch?v=mRbckLppmKs</a> with which I can get video from the camera and save it. This is the line:</p>
  
  <p><code>gst-launch-0.10 v4l2src device=/dev/video0 num-buffers=-1 ! 'video/x-raw-yuv,width=1024,height=768' ! queue ! ffmpegcolorspace ! vpuenc codec=0 ! matroskamux ! filesink location=output.mkv sync=false</code></p>
  
  <p>I have tried multiple ways of working out this line to stream and save it on the other end, but they were all unsuccessful. </p>
  
  <p><strong>Question 3: Do you know a proper way I can stream and save video from this camera?</strong></p>