|Version 10 (modified by rogerdpack, 4 years ago) (diff)|
FFmpeg 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 possibly multicast destination. Servers which can receive from ffmpeg (to restream) include ffserver (linux only, though cygwin might work), or wowza, or flash media server. Even VLC can pick up the stream, then redistribute it, acting as server. Since ffmpeg is sometimes more efficient than VLC at doing the raw encoding, this can be a useful option compared to doing it all in VLC.
How to stream with several different simultaneous bitrates is described here.
NB that when you are testing your streams, you may want to test them with both VLC and ffplay, as ffplay sometimes introduces its own artifacts when it is scaled (it has poor quality scaling). Don't use ffplay as your baseline for determining quality.
Also note that encoding it to the x264 "baseline" is basically for older iOS devices or the like, see here.
The ffmpeg "-re" flag means to "Read input at native frame rate. Mainly used to simulate a grab device." i.e. if you want to play a video file, but at realtime, then use this. My guess is you typically don't want this flag when streaming from a live device.
Here's how one guy broadcast a live stream:
$ ffmpeg -y -loglevel warning -f dshow -i video="screen-capture-recorder" -vf crop=690:388:136:0 -r 30 -s 962x388 -threads 2 -vcodec libx264 -vpre baseline -vpre my_ffpreset -f flv rtmp:///live/myStream.sdp Here is my ffmpeg preset (libx264-my_ffpreset.ffpreset): coder=1 flags2=+wpred+dct8x8 level=31 maxrate=1200000 bufsize=200000 wpredp=0 g=60 refs=1 subq=3 trellis=0 bf=0 rc_lookahead=0
Here is what another person did:
Ffmpeg -f dshow -I video="Virtual-Camera" -vcodec libx264 -tune zerolatency -b 900k -f mpegts udp://10.1.0.102:1234
And here is what another person did:
ffmpeg -f dshow -i video="screen-capture-recorder":audio="Stereo Mix (IDT High Definition" -vcodec libx264 -preset ultrafast -tune zerolatency -r 10 -async 1 -acodec libmp3lame -ab 24k -ar 22050 -bsf:v h264_mp4toannexb -maxrate 750k -bufsize 3000k -f mpegts udp://192.168.5.215:48550
NB that they also had to adjust the rtbufsize in that example. I'm also not entirely sure which presets are "best" or what the available options are. Also note that newer version of ffmpeg may need a different syntax for specifying preset/tune.