Version 7 (modified by rogerdpack, 7 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. 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. 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.

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):

How to stream with several different 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.

Here is what another person did for streaming:

Ffmpeg -f dshow -I video="Virtual-Camera" -vcodec libx264 -tune zerolatency
-b 900k -f mpegts udp://

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://

NB that they also had to adjust the rtbufsize in that example.

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.