[FFmpeg-user] ffmpeg live stream transcoding

Dan M dan at streemit.net
Wed Jul 25 20:30:08 CEST 2012

On 07/25/2012 06:31 AM, radiocm wrote:
> I will be very glad if someone would have an opportunity to offer such a
> tutorial. Because the tutorial from Wowza website keep me unclear. Thank you
> for your receptivity.
> -----
> Best regards, Vadim.
> --
> View this message in context: http://ffmpeg-users.933282.n4.nabble.com/ffmpeg-live-stream-transcoding-tp4652003p4652047.html
> Sent from the FFmpeg-users mailing list archive at Nabble.com.
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user

I can't really offer a tutorial, but I can show you how I did something 
similar recently.

In my application, I have a server running vlc sucking streams from some 
cameras, encoding them as MPEG2 streams and sending them to ports 5000 
through 5003 on my intermediary server (I'll have to let someone else 
explain how to set that up, as that was someone else's part of the 
project). I have another server running Wowza, with an instance named 
"live". And I've got an intermediate server that sucks in MPEG2 streams 
coming in on ports 5000 to 5003, transcoding them into mp4 streams with 
H.264 and AAC codecs, and pushing the transcoded streams on to Wowza.

The command line I use to pull the stream from port 5000, transcode it, 
and push it is:
ffmpeg -i 'udp://localhost:5000?fifo_size=1000000&overrun_nonfatal=1' 
-crf 30 -preset ultrafast -acodec aac -strict experimental -ar 44100 -ac 
2 -b:a 96k -vcodec libx264 -r 25 -b:v 500k -f flv 'rtmp://<wowza server 

-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.

-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.

-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.

-acodec aac  sets the audio codec

-strict experimental  allows use of some experimental codecs

-ar 44100 set the audio sample rate

-ac 2 specifies two channels of audio

-b:a 96k sets the audio bit rate

-vcodec libx264 sets the video codec

-r 25 set the frame rate

-b:v 500k set the video bit rate

-f flv says to deliver the output stream in an flv wrapper

'rtmp://<wowza server IP>/live/cam0' is where the transcoded video 
stream gets pushed to

More information about the ffmpeg-user mailing list