Skip to content
Search

FFserver

lastmod 2025-02-14created 2015-05-1512 edits

Stream

For streaming, use <Stream>. In this case you must specify the streaming format (Format) exactly, and it must match the format of the Feed or File.

Example

Create an FFserver configuration file as shown below. Open ports 8090 (HTTP) and 8091 (RTPS) in the firewall beforehand.

Port 8090
RTSPPort 8091
# bind to all IPs aliased or not 
BindAddress 0.0.0.0
# max number of simultaneous clients 
MaxClients 1000
# max bandwidth per-client (kb/s) 
MaxBandwidth 10000
# Suppress that if you want to launch ffserver as a daemon. 
NoDaemon

<Feed feed1.ffm>
  File /tmp/feed1.ffm
  FileMaxSize 5M
</Feed>

<Stream test.swf>
  Feed feed1.ffm
  Format swf
  VideoCodec flv
  VideoFrameRate 15
  VideoBufferSize 80000
  VideoBitRate 100
  VideoQMin 1
  VideoQMax 5
  VideoSize 352x288
  PreRoll 0
  Noaudio
</Stream>

<Stream sample.mpg>
  Format rtp
  File "/home/your/Downloads/test1.mpg"
</Stream>

<Stream stat.html>
  Format status
  ACL allow localhost
  ACL allow 192.168.0.0 192.168.255.255
</Stream>

Run FFserver in the background with the configuration file.

ffserver -d -f ~/ffserver.conf &

Send the camera video to FFserver using FFmpeg.

ffmpeg -r 25 -s 352x288 -f video4linux2 -i /dev/video0 http://localhost:8090/feed1.ffm

For reference, the following captures the current screen.

ffmpeg -f x11grab -r 25 -s 1280x800 -i :0.0 -f alsa -i pulse http://localhost:8090/feed1.ffm

Clients can connect as follows.

More example

H264 streaming is possible as follows.

# Transcode an incoming live feed to another live feed,
# using libx264 and video presets

<Stream live.h264>
Format rtp
Feed feed1.ffm
VideoCodec libx264
VideoFrameRate 24
VideoBitRate 100
VideoSize 480x272
AVPresetVideo default
AVPresetVideo baseline
AVOptionVideo flags +global_header

AudioCodec libfaac
AudioBitRate 32
AudioChannels 2
AudioSampleRate 22050
AVOptionAudio flags +global_header
</Stream>

See also

Troubleshooting

A collection of problems that can occur when using FFserver and their solutions.

Android MediaPlayer streaming

Favorite site

Streaming

References


  1. Ffmpeg_ffserver_streaming_server.pdf ↩

author Zer0 sitemap