Changes between Version 11 and Version 12 of ffserver


Ignore:
Timestamp:
Feb 13, 2019, 11:45:57 PM (10 months ago)
Author:
llogan
Comment:

moved sample config file here so it can be deleted from web site. updated some links and various minor nits.

Legend:

Unmodified
Added
Removed
Modified
  • ffserver

    v11 v12  
    1 [[PageOutline(1-100,Contents)]]
    2 
     1[[PageOutline]]
    32
    43{{{
     
    109= Introduction =
    1110
    12 If you need to [http://en.wikipedia.org/wiki/Streaming_media stream your audio/video content over the internet], you'll usually need [StreamingGuide a streaming (broadcasting) server], one of which is '''[http://ffmpeg.org/ffserver.html ffserver]'''. It is able to collect multiple input sources (usually ffmpeg applications) and transcode/remux/broadcast each of them using multiple output streams. The simple diagram is shown on the image below:
     11If you need to [https://en.wikipedia.org/wiki/Streaming_media stream your audio/video content over the internet], you'll usually need [StreamingGuide a streaming (broadcasting) server], one of which is ffserver. It is able to collect multiple input sources (usually ffmpeg applications) and transcode/remux/broadcast each of them using multiple output streams. The simple diagram is shown on the image below:
    1312
    1413[[Image(ffserver_map.png)]]
     
    4241=== Media players ===
    4342
    44 Media player elements are not internal part of ffserver. They just represent your viewers from the "outside world" that are connecting to the various stream elements to view your multimedia content. Some of the popular media players are: [http://ffmpeg.org/ffplay.html ffplay], [http://www.videolan.org/vlc/index.html VLC], [http://www.winamp.com Winamp], [http://windows.microsoft.com/en-US/windows/products/windows-media-player Windows Media Player], etc.
     43Media player elements are not internal part of ffserver. They just represent your viewers from the "outside world" that are connecting to the various stream elements to view your multimedia content. Some of the popular media players are: [https://ffmpeg.org/ffplay.html ffplay], [https://www.videolan.org/vlc/index.html VLC], [https://mpv.io/ mpv], [https://support.microsoft.com/en-us/help/18612/windows-media-player Windows Media Player], etc.
    4544
    4645= Running ffserver =
    4746
    48 To be able to successfully start ffserver, you'll need a valid [http://ffmpeg.org/sample.html configuration file] first. Once you create a valid config file, you can start ffserver simply by running the following command:
     47To be able to successfully start ffserver, you'll need a valid [#Creatingtheconfigurationfile configuration file] first. Once you create a valid config file, you can start ffserver simply by running the following command:
    4948{{{
    5049ffserver -f /etc/ffserver.conf
     
    165164= Creating the configuration file =
    166165
    167 It would be very wise to start off reading the ffserver's [http://ffmpeg.org/sample.html sample configuration file]. It is self-documented with a lot of comments and it is a good starting point for beginners, since it contains various examples too. It would be a waste of time and space to write about it again here. Also, [http://ffmpeg.org/ffserver.html ffserver's documentation page] might help too. In general, the configuration file is consisted of global directives, list of feed elements, list of stream elements and a specification of a special status stream element, which is used to provide a way for you to view the status of all your running streams.
     166It would be very wise to start off reading the sample configuration file below. It is self-documented with a lot of comments and it is a good starting point for beginners, since it contains various examples too. Also, refer to `man ffserver` and `ffserver -h`. In general, the configuration file is consisted of global directives, list of feed elements, list of stream elements and a specification of a special status stream element, which is used to provide a way for you to view the status of all your running streams.
    168167
    169168= Examples of configuration files =
     169
     170=== Sample ffserver configuration file ===
     171
     172{{{
     173# Port on which the server is listening. You must select a different
     174# port from your standard HTTP web server if it is running on the same
     175# computer.
     176Port 8090
     177
     178# Address on which the server is bound. Only useful if you have
     179# several network interfaces.
     180BindAddress 0.0.0.0
     181
     182# Number of simultaneous HTTP connections that can be handled. It has
     183# to be defined *before* the MaxClients parameter, since it defines the
     184# MaxClients maximum limit.
     185MaxHTTPConnections 2000
     186
     187# Number of simultaneous requests that can be handled. Since FFServer
     188# is very fast, it is more likely that you will want to leave this high
     189# and use MaxBandwidth, below.
     190MaxClients 1000
     191
     192# This the maximum amount of kbit/sec that you are prepared to
     193# consume when streaming to clients.
     194MaxBandwidth 1000
     195
     196# Access log file (uses standard Apache log file format)
     197# '-' is the standard output.
     198CustomLog -
     199
     200# Suppress that if you want to launch ffserver as a daemon.
     201NoDaemon
     202
     203
     204##################################################################
     205# Definition of the live feeds. Each live feed contains one video
     206# and/or audio sequence coming from an ffmpeg encoder or another
     207# ffserver. This sequence may be encoded simultaneously with several
     208# codecs at several resolutions.
     209
     210<Feed feed1.ffm>
     211
     212# You must use 'ffmpeg' to send a live feed to ffserver. In this
     213# example, you can type:
     214#
     215# ffmpeg http://localhost:8090/feed1.ffm
     216
     217# ffserver can also do time shifting. It means that it can stream any
     218# previously recorded live stream. The request should contain:
     219# "http://xxxx?date=[YYYY-MM-DDT][[HH:]MM:]SS[.m...]".You must specify
     220# a path where the feed is stored on disk. You also specify the
     221# maximum size of the feed, where zero means unlimited. Default:
     222# File=/tmp/feed_name.ffm FileMaxSize=5M
     223File /tmp/feed1.ffm
     224FileMaxSize 200K
     225
     226# You could specify
     227# ReadOnlyFile /saved/specialvideo.ffm
     228# This marks the file as readonly and it will not be deleted or updated.
     229
     230# Specify launch in order to start ffmpeg automatically.
     231# First ffmpeg must be defined with an appropriate path if needed,
     232# after that options can follow, but avoid adding the http:// field
     233#Launch ffmpeg
     234
     235# Only allow connections from localhost to the feed.
     236ACL allow 127.0.0.1
     237
     238</Feed>
     239
     240
     241##################################################################
     242# Now you can define each stream which will be generated from the
     243# original audio and video stream. Each format has a filename (here
     244# 'test1.mpg'). FFServer will send this stream when answering a
     245# request containing this filename.
     246
     247<Stream test1.mpg>
     248
     249# coming from live feed 'feed1'
     250Feed feed1.ffm
     251
     252# Format of the stream : you can choose among:
     253# mpeg       : MPEG-1 multiplexed video and audio
     254# mpegvideo  : only MPEG-1 video
     255# mp2        : MPEG-2 audio (use AudioCodec to select layer 2 and 3 codec)
     256# ogg        : Ogg format (Vorbis audio codec)
     257# rm         : RealNetworks-compatible stream. Multiplexed audio and video.
     258# ra         : RealNetworks-compatible stream. Audio only.
     259# mpjpeg     : Multipart JPEG (works with Netscape without any plugin)
     260# jpeg       : Generate a single JPEG image.
     261# asf        : ASF compatible streaming (Windows Media Player format).
     262# swf        : Macromedia Flash compatible stream
     263# avi        : AVI format (MPEG-4 video, MPEG audio sound)
     264Format mpeg
     265
     266# Bitrate for the audio stream. Codecs usually support only a few
     267# different bitrates.
     268AudioBitRate 32
     269
     270# Number of audio channels: 1 = mono, 2 = stereo
     271AudioChannels 1
     272
     273# Sampling frequency for audio. When using low bitrates, you should
     274# lower this frequency to 22050 or 11025. The supported frequencies
     275# depend on the selected audio codec.
     276AudioSampleRate 44100
     277
     278# Bitrate for the video stream
     279VideoBitRate 64
     280
     281# Ratecontrol buffer size
     282VideoBufferSize 40
     283
     284# Number of frames per second
     285VideoFrameRate 3
     286
     287# Size of the video frame: WxH (default: 160x128)
     288# The following abbreviations are defined: sqcif, qcif, cif, 4cif, qqvga,
     289# qvga, vga, svga, xga, uxga, qxga, sxga, qsxga, hsxga, wvga, wxga, wsxga,
     290# wuxga, woxga, wqsxga, wquxga, whsxga, whuxga, cga, ega, hd480, hd720,
     291# hd1080
     292VideoSize 160x128
     293
     294# Transmit only intra frames (useful for low bitrates, but kills frame rate).
     295#VideoIntraOnly
     296
     297# If non-intra only, an intra frame is transmitted every VideoGopSize
     298# frames. Video synchronization can only begin at an intra frame.
     299VideoGopSize 12
     300
     301# More MPEG-4 parameters
     302# VideoHighQuality
     303# Video4MotionVector
     304
     305# Choose your codecs:
     306#AudioCodec mp2
     307#VideoCodec mpeg1video
     308
     309# Suppress audio
     310#NoAudio
     311
     312# Suppress video
     313#NoVideo
     314
     315#VideoQMin 3
     316#VideoQMax 31
     317
     318# Set this to the number of seconds backwards in time to start. Note that
     319# most players will buffer 5-10 seconds of video, and also you need to allow
     320# for a keyframe to appear in the data stream.
     321#Preroll 15
     322
     323# ACL:
     324
     325# You can allow ranges of addresses (or single addresses)
     326#ACL ALLOW <first address>
     327
     328# You can deny ranges of addresses (or single addresses)
     329#ACL DENY <first address>
     330
     331# You can repeat the ACL allow/deny as often as you like. It is on a per
     332# stream basis. The first match defines the action. If there are no matches,
     333# then the default is the inverse of the last ACL statement.
     334#
     335# Thus 'ACL allow localhost' only allows access from localhost.
     336# 'ACL deny 1.0.0.0 1.255.255.255' would deny the whole of network 1 and
     337# allow everybody else.
     338
     339</Stream>
     340
     341
     342##################################################################
     343# Example streams
     344
     345
     346# Multipart JPEG
     347
     348#<Stream test.mjpg>
     349#Feed feed1.ffm
     350#Format mpjpeg
     351#VideoFrameRate 2
     352#VideoIntraOnly
     353#NoAudio
     354#Strict -1
     355#</Stream>
     356
     357
     358# Single JPEG
     359
     360#<Stream test.jpg>
     361#Feed feed1.ffm
     362#Format jpeg
     363#VideoFrameRate 2
     364#VideoIntraOnly
     365##VideoSize 352x240
     366#NoAudio
     367#Strict -1
     368#</Stream>
     369
     370
     371# Flash
     372
     373#<Stream test.swf>
     374#Feed feed1.ffm
     375#Format swf
     376#VideoFrameRate 2
     377#VideoIntraOnly
     378#NoAudio
     379#</Stream>
     380
     381
     382# ASF compatible
     383
     384<Stream test.asf>
     385Feed feed1.ffm
     386Format asf
     387VideoFrameRate 15
     388VideoSize 352x240
     389VideoBitRate 256
     390VideoBufferSize 40
     391VideoGopSize 30
     392AudioBitRate 64
     393StartSendOnKey
     394</Stream>
     395
     396
     397# MP3 audio
     398
     399#<Stream test.mp3>
     400#Feed feed1.ffm
     401#Format mp2
     402#AudioCodec mp3
     403#AudioBitRate 64
     404#AudioChannels 1
     405#AudioSampleRate 44100
     406#NoVideo
     407#</Stream>
     408
     409
     410# Ogg Vorbis audio
     411
     412#<Stream test.ogg>
     413#Feed feed1.ffm
     414#Title "Stream title"
     415#AudioBitRate 64
     416#AudioChannels 2
     417#AudioSampleRate 44100
     418#NoVideo
     419#</Stream>
     420
     421
     422# Real with audio only at 32 kbits
     423
     424#<Stream test.ra>
     425#Feed feed1.ffm
     426#Format rm
     427#AudioBitRate 32
     428#NoVideo
     429#NoAudio
     430#</Stream>
     431
     432
     433# Real with audio and video at 64 kbits
     434
     435#<Stream test.rm>
     436#Feed feed1.ffm
     437#Format rm
     438#AudioBitRate 32
     439#VideoBitRate 128
     440#VideoFrameRate 25
     441#VideoGopSize 25
     442#NoAudio
     443#</Stream>
     444
     445
     446##################################################################
     447# A stream coming from a file: you only need to set the input
     448# filename and optionally a new format. Supported conversions:
     449#    AVI -> ASF
     450
     451#<Stream file.rm>
     452#File "/usr/local/httpd/htdocs/tlive.rm"
     453#NoAudio
     454#</Stream>
     455
     456#<Stream file.asf>
     457#File "/usr/local/httpd/htdocs/test.asf"
     458#NoAudio
     459#Author "Me"
     460#Copyright "Super MegaCorp"
     461#Title "Test stream from disk"
     462#Comment "Test comment"
     463#</Stream>
     464
     465
     466##################################################################
     467# RTSP examples
     468#
     469# You can access this stream with the RTSP URL:
     470#   rtsp://localhost:5454/test1-rtsp.mpg
     471#
     472# A non-standard RTSP redirector is also created. Its URL is:
     473#   http://localhost:8090/test1-rtsp.rtsp
     474
     475#<Stream test1-rtsp.mpg>
     476#Format rtp
     477#File "/usr/local/httpd/htdocs/test1.mpg"
     478#</Stream>
     479
     480
     481# Transcode an incoming live feed to another live feed,
     482# using libx264 and video presets
     483
     484#<Stream live.h264>
     485#Format rtp
     486#Feed feed1.ffm
     487#VideoCodec libx264
     488#VideoFrameRate 24
     489#VideoBitRate 100
     490#VideoSize 480x272
     491#AVPresetVideo default
     492#AVPresetVideo baseline
     493#AVOptionVideo flags +global_header
     494#
     495#AudioCodec libfaac
     496#AudioBitRate 32
     497#AudioChannels 2
     498#AudioSampleRate 22050
     499#AVOptionAudio flags +global_header
     500#</Stream>
     501
     502##################################################################
     503# SDP/multicast examples
     504#
     505# If you want to send your stream in multicast, you must set the
     506# multicast address with MulticastAddress. The port and the TTL can
     507# also be set.
     508#
     509# An SDP file is automatically generated by ffserver by adding the
     510# 'sdp' extension to the stream name (here
     511# http://localhost:8090/test1-sdp.sdp). You should usually give this
     512# file to your player to play the stream.
     513#
     514# The 'NoLoop' option can be used to avoid looping when the stream is
     515# terminated.
     516
     517#<Stream test1-sdp.mpg>
     518#Format rtp
     519#File "/usr/local/httpd/htdocs/test1.mpg"
     520#MulticastAddress 224.124.0.1
     521#MulticastPort 5000
     522#MulticastTTL 16
     523#NoLoop
     524#</Stream>
     525
     526
     527##################################################################
     528# Special streams
     529
     530# Server status
     531
     532<Stream stat.html>
     533Format status
     534
     535# Only allow local people to get the status
     536ACL allow localhost
     537ACL allow 192.168.0.0 192.168.255.255
     538
     539#FaviconURL http://pond1.gladstonefamily.net:8080/favicon.ico
     540</Stream>
     541
     542
     543# Redirect index.html to the appropriate site
     544
     545<Redirect index.html>
     546URL http://www.ffmpeg.org/
     547</Redirect>
     548}}}
    170549
    171550=== Streaming H.264 video with AAC audio in FLV format ===