How-To: Streaming with FFServer


In this article I want to explain how to install ffserver for streaming with libx264 and mp3lame on ubuntu 12.04 with clean process.

1) Download FFMpeg ( ffmpeg-0.6.6 )

2) Install libx264-dev, libmp3lame-dev, libasound2-dev from distribution repository

3) ./configure --enable-gpl --enable-libx264 --enable-libmp3lame and make

4) Use this as config file for ffserver and put it into doc directory as ffserver.conf

Port 9090
BindAddress 0.0.0.0
MaxHTTPConnections 2000
MaxClients 1000
MaxBandwidth 10000
CustomLog -
NoDaemon

File /tmp/feed1.ffm
FileMaxSize 100M
ACL allow 127.0.0.1

Feed feed1.ffm
Format flv

#audio AudioBitRate 64
AudioChannels 1
AudioSampleRate 11025
AVOptionAudio flags +global_header

#video
VideoBitRate 256
VideoBufferSize 400
VideoFrameRate 25
VideoBitRateTolerance 100
VideoSize 704x480
VideoGopSize 12
AudioCodec libmp3lame
VideoCodec libx264
AVOptionVideo coder 0
AVOptionVideo bf 0
AVOptionVideo flags2 +mixed_refs+fastpskip
AVOptionVideo flags +loop
AVOptionVideo cmp +chroma
AVOptionVideo partitions +parti8x8+parti4x4+partp8x8+partb8x8
AVOptionVideo me_method hex
AVOptionVideo subq 7
AVOptionVideo me_range 16
AVOptionVideo g 250
AVOptionVideo keyint_min 10
AVOptionVideo sc_threshold 40
AVOptionVideo i_qfactor 0.71
AVOptionVideo b_strategy 1
AVOptionVideo qcomp 0.6
AVOptionVideo qmin 10
AVOptionVideo qmax 51
AVOptionVideo qdiff 4
AVOptionVideo refs 3
AVOptionVideo directpred 1
AVOptionVideo trellis 1
AVOptionVideo wpredp 0
AVOptionVideo flags +global_header
#NoAudio
#NoVideo
#VideoQMin 1
#VideoQMax 31
#Preroll 5
StartSendOnKey

Feed feed1.ffm
Format swf

#audio
AudioBitRate 64
AudioChannels 1
AudioSampleRate 11025
AVOptionAudio flags +global_header

#video
VideoBitRate 256
VideoBufferSize 400
VideoFrameRate 25
VideoBitRateTolerance 100
VideoSize 704x480
VideoGopSize 12
#NoAudio
#NoVideo
#VideoQMin 1
#VideoQMax 31
#Preroll 5
StartSendOnKey

Format status

# Only allow local people to get the status
ACL allow localhost
ACL allow 192.168.0.0 192.168.255.255

# Redirect index.html to the appropriate site

URL http://www.ffmpeg.org/

#this permit to obtain 2 streams, one for flv streaming (h264+mp3) and the other for swf streaming (flv+mp3)

5) Run ./ffserver -f doc/ffserver.conf

6) Now the source

7) For live view use videolan (install it from ubuntu repository) with address http://127.0.0.1:9090/test1.flv or test1.swf, if you well done, you may see your stream

8) If you want to put this on line use flowplayer and follow my "streaming with flowplayer and ffserver" how-to