Changes between Initial Version and Version 1 of rincon/streaming


Ignore:
Timestamp:
10/21/2017 10:28:45 PM (7 months ago)
Author:
trac
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • rincon/streaming

    v1 v1  
     1{{{#!html
     2          <div id="wikipage" class="trac-content"><p>
     3</p><div class="wiki-toc">
     4<ol>
     5  <li>
     6    <a href="#RinconMultimediaStreaming">Rincon Multimedia Streaming</a>
     7    <ol>
     8      <li>
     9        <a href="#RTPUDPunicastmulticast">RTP/UDP unicast/multicast</a>
     10      </li>
     11      <li>
     12        <a href="#RTSP">RTSP</a>
     13      </li>
     14      <li>
     15        <a href="#PlaybackofRinconstreamsonotherStreamingClients">Playback of Rincon streams on other Streaming Clients</a>
     16        <ol>
     17          <li>
     18            <a href="#GStreamer">GStreamer</a>
     19          </li>
     20          <li>
     21            <a href="#VLC">VLC</a>
     22          </li>
     23        </ol>
     24      </li>
     25    </ol>
     26  </li>
     27</ol>
     28</div><p>
     29</p>
     30<h1 id="RinconMultimediaStreaming">Rincon Multimedia Streaming</h1>
     31<p>
     32The Rincon product family uses the TI Davinci processor for DSP accelerated video capture, compression, decompression, and display.  The GStreamer framework is used to provide a multimedia streaming application that can be used in a variety of ways.  The following transport mechanisms will be described here:
     33</p>
     34<ul><li>RTP/UDP unicast/multicast
     35</li><li>RTSP
     36</li></ul><h2 id="RTPUDPunicastmulticast">RTP/UDP unicast/multicast</h2>
     37<p>
     38The base protocol for multimedia network data is commonly RTP (Real-time Transport Protocol) which encapsulates undefined media payload with a common header that contains a timestamp.  The RTP packets can be delivered either unicast or multicast.  A client wishing to receive and decompress an RTP stream must have prior knowledge of the type of stream or examine the stream in detail to be able to decrypt it properly.  This is likely the only downside to using plain old RTP.
     39</p>
     40<p>
     41The Rincon product family has a server implemented using a GStreamer pipeline by /etc/init.d/tivideo and the configuration file /etc/config/tivideo.  The following characteristics can be specified:
     42</p>
     43<ul><li>type (client|server)
     44</li><li>host (multicast ip address - to send to or receive from)
     45</li><li>port (port to send or receive from)
     46</li><li>codec (h264)
     47</li><li>resolution (720x480|640x480|352x240|320x240)
     48</li><li>bps (stream bitrate in bps)
     49</li><li>quality (2 - High quality, 3 - High speed)
     50</li><li>ratecontrol (1 = No rate control, 2 = Constant bit rate (CBR), 3 = Variable bit rate (VBR))
     51</li><li>jitter (millisecond value of a de-jitter buffer for client - allows for smoother playback and packet re-ordering in jittery or MESH network environments)
     52</li></ul><p>
     53In order to get around the fact that RTP by itself can't describe codec information to a client, that information can be stored in an SDP (Session Description Protocol) file that many clients can utilize to avoid manual configuration.
     54</p>
     55<p>
     56You can use the OpenWRT LuCI web-admin to configure, see the status of the RTP/UDP media service, and download an SDP file (for automatic launching of configured clients) from <a class="ext-link" href="http://192.168.1.1/cgi-bin/luci/admin/status/tividio"><span class="icon">​</span>http://192.168.1.1/cgi-bin/luci/admin/status/tividio</a>
     57</p>
     58<h2 id="RTSP">RTSP</h2>
     59<p>
     60RTSP or Real Time Streaming Protocol is a control protocol which negotiates a network transport mechanism and conveys information about the stream payload.  It uses RTP/UDP for data payload (which can be unicast or multicast per the client's request) and RTCP to convey health of the client-server connection.
     61</p>
     62<p>
     63The benefit of RTSP is that the protocol conveys the stream codec information from the server to the client.  An additional benefit is that the server is only sending a stream when there is a client that has requested it and that you can setup multiple stream configurations.
     64</p>
     65<p>
     66An experimental RTSP server is available for the Rincon product family but currently has no configuration script or web-admin integration.  You can write your own init script or manually launch it via a command such as:
     67</p>
     68<pre class="wiki">gst-rtspd --shared --debug video "v4l2src always-copy=0 queue-size=1 ! TIVidResize ! video/x-raw-yuv,width=720,height=480 ! TIVidenc1 engineName=encode encodingPreset=3 rateControlPreset=2 bitRate=1000000 frameRate=30 contiguousInputFrame=1 codecName=h264enc ! rtph264pay name=pay0 pt=96"
     69</pre><p>
     70You can define multiple GStreamer pipelines and mappings on the commandline (gst-rtspd [OPTIONS] [path1 "pipeline1"] [path2 "pipeline2"] ...) or you can use the '--config &lt;file&gt;' argument to pass in a config file defining these such as the example in /etc/gst-rtsp_ti.conf.
     71</p>
     72<p>
     73Note that only a single pipeline can be active that utilizes the capture, display, or DSP functionality of the processor although if launched with the '--shared' option, any number of clients can be viewing a single shared pipeline.
     74</p>
     75<h2 id="PlaybackofRinconstreamsonotherStreamingClients">Playback of Rincon streams on other Streaming Clients</h2>
     76<p>
     77While the Rincon product family can be used as either a streaming server (encoding/streaming audio/video from inputs) or a client (receiving/decoding and displaying audio/video to outputs) you may also want to play network streams on other platforms.  Here are some suggestions and notes:
     78</p>
     79<ul><li><a class="ext-link" href="http://gstreamer.freedesktop.org/"><span class="icon">​</span>GStreamer</a> - recommended
     80</li><li><a class="ext-link" href="http://www.videolan.org/vlc/"><span class="icon">​</span>VLC Media Player</a>
     81</li></ul><p>
     82Notes about compatibility:
     83</p>
     84<ul><li>A client application must support both the network transport protocol being used on Rincon (ie RTP/UDP or RTSP (see above)) as well as the codec being used for stream compression (h264 video)
     85</li><li>Many client applications suffer from issues caused by improperly handling multimedia timestamps which present themselves after long periods of time viewing a stream or after some network packetloss or routing changes have occurred.
     86</li><li>Many clients require some amount of data to be buffered which increases latency.
     87</li></ul><h3 id="GStreamer">GStreamer</h3>
     88<p>
     89<a class="ext-link" href="http://gstreamer.freedesktop.org/"><span class="icon">​</span>GStreamer</a> is not an application, but instead an open-source cross-platform multimedia framework.  Its architecture lends very well to low-latency network streaming and it does come with a 'gst-launch' application that can be used for many cases.  It is available for Windows, Linux, and MacOS.  It's architecture relies on combining 'plugin elements' together in strings called 'pipelines' which can be used to create some very useful simple or complex scenarios for generating, encoding, streaming, decoding, transcoding, and capturing multimedia streams.
     90</p>
     91<p>
     92Examples:
     93</p>
     94<ul><li>Playback stream from Rincon RTP/UDP streaming server:
     95<pre class="wiki">gst-launch playbin2 uri=http://192.168.1.1/video.sdp video-sink="xvimagesink sync=false"  # Linux/X11
     96gst-launch playbin2 uri=http://192.168.1.1/video.sdp video-sink="directdrawsink sync=false"  # Windows
     97</pre></li><li>Playback stream ('video') from Rincon RTSP streaming server:
     98<pre class="wiki">gst-launch rtspsrc location=rtsp://192.168.1.1/video latency=0 ! decodebin ! xvimagesink sync=false  # Linux/X11 unicast
     99gst-launch rtspsrc location=rtsp://192.168.1.1/video latency=0 protocols=GST_RTSP_LOWER_TRANS_UDP_MCAST ! decodebin ! xvimagesink sync=false  # Linux/X11 multicast
     100gst-launch playbin2 uri=rtsp://192.168.1.91/test video-sink="directdrawsink sync=false"  # Windows unicast
     101gst-launch -vvv playbin2 uri=rtsp://192.168.1.91/test uridecodebin0::source::latency=0 uridecodebin0::source::protocols=GST_RTSP_LOWER_TRANS_UDP_MCAST video-sink="directdrawsink sync=false"  # Windows multicast
     102</pre></li></ul><p>
     103For Windows, A GStreamer installer package is provided by the <a class="ext-link" href="http://code.google.com/p/ossbuild/"><span class="icon">​</span>OssBuild project</a>.  We recommend and have tested using <a class="ext-link" href="http://code.google.com/p/ossbuild/downloads/detail?name=GStreamer-WinBuilds-LGPL-x86-Beta04-0.10.7.msi&amp;can=2&amp;q="><span class="icon">​</span>GStreamer-WinBuilds-GPL-x86-Beta04-0.10.7.msi</a>
     104</p>
     105<h3 id="VLC">VLC</h3>
     106<p>
     107While <a class="ext-link" href="http://www.videolan.org/vlc/"><span class="icon">​</span>VLC Media Player</a> is a very stable and full-featured cross-platform media player, it does not perform well for live low-latency network streams because of the way it manages network buffers.  We have found that if you loose network packets the vlc player will in-appropriately increase latency to compensate.  Additionally it requires a certain amount of buffering (specified as milliseconds) and if that falls below some threshold (due to network pktloss or latency) it can cause the player to start having decode/display issues.  This player is not recommended for anything other than quick tests
     108</p>
     109<p>
     110Examples:
     111</p>
     112<ul><li>Playback stream from Rincon RTP/UDP streaming server:
     113<pre class="wiki">vlc http://192.168.1.1/video.sdp --network-caching 150
     114</pre></li><li>Playback stream ('video') from Rincon RTSP streaming server:
     115<pre class="wiki">vlc rtsp://192.168.1.91/test --rtsp-caching 150
     116</pre></li></ul><p>
     117Notes:
     118</p>
     119<ul><li>the 150 caching value above is in milliseconds - ideally you would want this to be 0 to disable all caching but vlc does not decode properly in buffer underrun scenarios.  The value of 150 may not even be enough in some situations
     120</li><li>you can use 'cvlc' for a UI-less command-line version
     121</li></ul><p>
     122References:
     123</p>
     124<ul><li><a class="ext-link" href="https://sandilands.info/sgordon/live-webca-streaming-using-vlc-command-line"><span class="icon">​</span>https://sandilands.info/sgordon/live-webca-streaming-using-vlc-command-line</a>
     125</li></ul
     126}}}