title: Use GStreamer to pack existing h264 stream and send it over network to VLC
body: <p>I'm trying to stream from Raspberry PI camera over network using <strong>raspivid</strong> and <strong>gstreamer</strong> cli. I want to be able to view the stream using VLC "open network stream" on the client. </p>
  
  <p>This is related to question <a href="https://stackoverflow.com/questions/13154983/gstreamer-rtp-stream-to-vlc">GStreamer rtp stream to vlc</a> however mine it is not quite the same. Instead of encoding the raw output from my PI camera, my idea is to leverage the existing the <strong>h264</strong> output of <strong>raspivid</strong>, mux it into an appropriate container and send it over TCP or UDP.</p>
  
  <p>I was able to successfully capture the h264 output from <strong>raspivid</strong> into an mp4 file (with correct fps and length information) using this pipeline:</p>
  
  <pre><code>raspivid -n -w 1280 -h 720 -fps 24 -b 4500000 -a 12 -t 30000 -o - | \
  gst-launch-1.0 -v fdsrc ! video/x-h264, width=1280, height=720, framerate=24/1 ! \ 
  h264parse ! mp4mux ! filesink location="videofile.mp4"
  </code></pre>
  
  <p>However, when I try to stream this over a network:</p>
  
  <pre><code>raspivid -n -w 1280 -h 720 -fps 24 -b 4500000 -a 12 -t 0 -o - | \
  gst-launch-1.0 -v fdsrc ! video/x-h264, width=1280, height=720, framerate=24/1 ! \
  h264parse ! mpegtsmux ! rtpmp2tpay ! udpsink host=192.168.1.20 port=5000
  </code></pre>
  
  <p>...and try to open the stream using <code>rtp://192.168.1.20:5000</code> on VLC, it reports an error.</p>
  
  <p>Edit: Ok, I was mistaken to assume that the udpsink listens for incoming connections. However, after changing the last part of the pipeline to use my client's IP address <code>! udpsink host=192.168.1.77 port=5000</code> and tried opening that with <code>udp://@:5000</code> on the VLC, the player does not display anything (both the PI and the receiving computer are on the same LAN and I can see the incoming network traffic on the client).</p>
  
  <p>Does anyone know how to properly construct a <strong>gstreamer</strong> pipeline to transmit existing h264 stream over a network which can be played by vanilla VLC on the client?</p>