Changes between Version 32 and Version 33 of StreamingGuide


Ignore:
Timestamp:
Oct 13, 2012, 8:28:35 PM (4 years ago)
Author:
rogerdpack
Comment:

note more servers, more x264

Legend:

Unmodified
Added
Removed
Modified
  • StreamingGuide

    v32 v33  
    22[[PageOutline(2, Contents)]] 
    33FFmpeg can basically stream through one of two ways:  It either streams to a some "other server", which restreams for it, or it can stream via UDP directly to some destination host, or alternatively directly to a multicast destination. 
    4 Servers which can receive from FFmpeg (to restream) include [http://ffmpeg.org/ffserver.html ffserver] (linux only, though with cygwin it might work), or [http://en.wikipedia.org/wiki/Wowza_Media_Server Wowza Media Server], or [http://en.wikipedia.org/wiki/Adobe_Flash_Media_Server Flash Media Server]. Even [http://en.wikipedia.org/wiki/VLC_media_player VLC] can pick up the stream from ffmpeg, then redistribute it, acting as a server.  Since FFmpeg is at times more efficient than VLC at doing the raw encoding, this can be a useful option compared to doing both transcoding and streaming in VLC. Nginx also has an rtmp redistribution plugin.  You can also live stream to online redistribution servers like own3d.tv or justin.tv (for instance streaming your desktop). 
     4Servers which can receive from FFmpeg (to restream) include [http://ffmpeg.org/ffserver.html ffserver] (linux only, though with cygwin it might work), or [http://en.wikipedia.org/wiki/Wowza_Media_Server Wowza Media Server], or [http://en.wikipedia.org/wiki/Adobe_Flash_Media_Server Flash Media Server]. Even [http://en.wikipedia.org/wiki/VLC_media_player VLC] can pick up the stream from ffmpeg, then redistribute it, acting as a server.  Since FFmpeg is at times more efficient than VLC at doing the raw encoding, this can be a useful option compared to doing both transcoding and streaming in VLC. Nginx also has an rtmp redistribution plugin, as does [http://h264.code-shop.com/trac/wiki apache etc.] probably.  You can also live stream to online redistribution servers like own3d.tv or justin.tv (for instance streaming your desktop).  Also any "rtmp server" will most likely work to receive streams from FFmpeg (these typically require you to setup a running instance on a server). 
    55 
    66How to stream with several different simultaneous bitrates is described [http://sonnati.wordpress.com/2011/08/30/ffmpeg-%E2%80%93-the-swiss-army-knife-of-internet-streaming-%E2%80%93-part-iv/ here]. 
     
    5757NB that they also (for directshow devices) had to adjust the rtbufsize in that example.  Also note that newer version of FFmpeg may need a different syntax for specifying preset/tune. 
    5858 
    59 You can see a description of what some of these means, (for example bufsize, bitrate settings) [x264EncodingGuide|here]. 
     59You can see a description of what some of these means, (for example bufsize, bitrate settings) in the [x264EncodingGuide]. 
    6060 
    6161== Latency == 
     
    118118 -i 'udp://localhost:5000?fifo_size=1000000&overrun_nonfatal=1' tells ffmpeg where to pull the input stream from. The parts after the ? are probably not needed most of the time, but I did need it after all. 
    119119 
    120  -crf 30 sets the Content Rate Factor. That's an x264 argument that tries to keep reasonably consistent video quality. A value of 30 allows somewhat lower quality and bit rate. 
     120 -crf 30 sets the Content Rate Factor. That's an x264 argument that tries to keep reasonably consistent video quality, while varying bitrate during more 'complicated' scenes, etc. A value of 30 allows somewhat lower quality and bit rate.  See [x264EncodingGuide]. 
    121121 
    122122 -preset ultrafast as the name implies provides for the fastest possible encoding. If some tradeoff between quality and encode speed, go for the speed. This might be needed if you are going to be transcoding multiple streams on one machine. 
     
    142142 'rtmp://<wowza server IP>/live/cam0' is where the transcoded video stream gets pushed to 
    143143 
    144 == variable bitrate == 
     144== Variable bitrate == 
    145145 
    146 FFmpeg doesn't (today) support varying a bitrate based on changing network conditions.  It does support outputting in several "different" fixed bitrates, at the same time, however [http://stackoverflow.com/questions/12041077/ffmpeg-output-to-multiple-files-simultaneously see here], which is vaguely related. 
     146FFmpeg doesn't (today) support varying the encoding bitrate based on fluctuating network conditions.  It does support outputting in several "different" fixed bitrates, at the same time, however [http://stackoverflow.com/questions/12041077/ffmpeg-output-to-multiple-files-simultaneously see here], which is somewhat related.  Also if you are during direct capture from directshow, the input device starts dropping frames when there is congestion, which somewhat simulates a varying bitrate. 
    147147 
    148 == troubleshooting == 
     148== Troubleshooting == 
    149149 
    150150If you get a "black/blank" screen from your server, try sending it yuv422p or yuv420p type input.  Some servers get confused if you send them yuv444 input (which is the default for libx264).