=encoding utf8

=head1 NAME

ffserver - ffserver video server

=head1 SYNOPSIS


ffserver [I<options>]


=head1 DESCRIPTION


B<ffserver> is a streaming server for both audio and video.
It supports several live feeds, streaming from files and time shifting
on live feeds. You can seek to positions in the past on each live
feed, provided you specify a big enough feed storage.

B<ffserver> is configured through a configuration file, which
is read at startup. If not explicitly specified, it will read from
F</etc/ffserver.conf>.

B<ffserver> receives prerecorded files or FFM streams from some
B<ffmpeg> instance as input, then streams them over
RTP/RTSP/HTTP.

An B<ffserver> instance will listen on some port as specified
in the configuration file. You can launch one or more instances of
B<ffmpeg> and send one or more FFM streams to the port where
ffserver is expecting to receive them. Alternately, you can make
B<ffserver> launch such B<ffmpeg> instances at startup.

Input streams are called feeds, and each one is specified by a
C<E<lt>FeedE<gt>> section in the configuration file.

For each feed you can have different output streams in various
formats, each one specified by a C<E<lt>StreamE<gt>> section in the
configuration file.


=head1 DETAILED DESCRIPTION


B<ffserver> works by forwarding streams encoded by
B<ffmpeg>, or pre-recorded streams which are read from disk.

Precisely, B<ffserver> acts as an HTTP server, accepting POST
requests from B<ffmpeg> to acquire the stream to publish, and
serving RTSP clients or HTTP clients GET requests with the stream
media content.

A feed is an B<FFM> stream created by B<ffmpeg>, and sent to
a port where B<ffserver> is listening.

Each feed is identified by a unique name, corresponding to the name
of the resource published on B<ffserver>, and is configured by
a dedicated C<Feed> section in the configuration file.

The feed publish URL is given by:
	
	http://<ffserver_ip_address>:<http_port>/<feed_name>


where I<ffserver_ip_address> is the IP address of the machine where
B<ffserver> is installed, I<http_port> is the port number of
the HTTP server (configured through the B<HTTPPort> option), and
I<feed_name> is the name of the corresponding feed defined in the
configuration file.

Each feed is associated to a file which is stored on disk. This stored
file is used to send pre-recorded data to a player as fast as
possible when new content is added in real-time to the stream.

A "live-stream" or "stream" is a resource published by
B<ffserver>, and made accessible through the HTTP protocol to
clients.

A stream can be connected to a feed, or to a file. In the first case,
the published stream is forwarded from the corresponding feed
generated by a running instance of B<ffmpeg>, in the second
case the stream is read from a pre-recorded file.

Each stream is identified by a unique name, corresponding to the name
of the resource served by B<ffserver>, and is configured by
a dedicated C<Stream> section in the configuration file.

The stream access HTTP URL is given by:
	
	http://<ffserver_ip_address>:<http_port>/<stream_name>[<options>]


The stream access RTSP URL is given by:
	
	http://<ffserver_ip_address>:<rtsp_port>/<stream_name>[<options>]


I<stream_name> is the name of the corresponding stream defined in
the configuration file. I<options> is a list of options specified
after the URL which affects how the stream is served by
B<ffserver>. I<http_port> and I<rtsp_port> are the HTTP
and RTSP ports configured with the options I<HTTPPort> and
I<RTSPPort> respectively.

In case the stream is associated to a feed, the encoding parameters
must be configured in the stream configuration. They are sent to
B<ffmpeg> when setting up the encoding. This allows
B<ffserver> to define the encoding parameters used by
the B<ffmpeg> encoders.

The B<ffmpeg> B<override_ffserver> commandline option
allows one to override the encoding parameters set by the server.

Multiple streams can be connected to the same feed.

For example, you can have a situation described by the following
graph:

	
	               _________       __________
	              |         |     |          |
	ffmpeg 1 -----| feed 1  |-----| stream 1 |
	    \         |_________|\    |__________|
	     \                    \
	      \                    \   __________
	       \                    \ |          |
	        \                    \| stream 2 |
	         \                    |__________|
	          \
	           \   _________       __________
	            \ |         |     |          |
	             \| feed 2  |-----| stream 3 |
	              |_________|     |__________|
	
	               _________       __________
	              |         |     |          |
	ffmpeg 2 -----| feed 3  |-----| stream 4 |
	              |_________|     |__________|
	
	               _________       __________
	              |         |     |          |
	              | file 1  |-----| stream 5 |
	              |_________|     |__________|
	




=head2 FFM, FFM2 formats


FFM and FFM2 are formats used by ffserver. They allow storing a wide variety of
video and audio streams and encoding options, and can store a moving time segment
of an infinite movie or a whole movie.

FFM is version specific, and there is limited compatibility of FFM files
generated by one version of ffmpeg/ffserver and another version of
ffmpeg/ffserver. It may work but it is not guaranteed to work.

FFM2 is extensible while maintaining compatibility and should work between
differing versions of tools. FFM2 is the default.


=head2 Status stream


B<ffserver> supports an HTTP interface which exposes the
current status of the server.

Simply point your browser to the address of the special status stream
specified in the configuration file.

For example if you have:
	
	<Stream status.html>
	Format status
	
	# Only allow local people to get the status
	ACL allow localhost
	ACL allow 192.168.0.0 192.168.255.255
	</Stream>


then the server will post a page with the status information when
the special stream F<status.html> is requested.


=head2 How do I make it work?


As a simple test, just run the following two command lines where INPUTFILE
is some file which you can decode with ffmpeg:

	
	ffserver -f doc/ffserver.conf &
	ffmpeg -i INPUTFILE http://localhost:8090/feed1.ffm


At this point you should be able to go to your Windows machine and fire up
Windows Media Player (WMP). Go to Open URL and enter

	
	    http://<linuxbox>:8090/test.asf


You should (after a short delay) see video and hear audio.

WARNING: trying to stream test1.mpg doesn't work with WMP as it tries to
transfer the entire file before starting to play.
The same is true of AVI files.

You should edit the F<ffserver.conf> file to suit your needs (in
terms of frame rates etc). Then install B<ffserver> and
B<ffmpeg>, write a script to start them up, and off you go.


=head2 What else can it do?


You can replay video from .ffm files that was recorded earlier.
However, there are a number of caveats, including the fact that the
ffserver parameters must match the original parameters used to record the
file. If they do not, then ffserver deletes the file before recording into it.
(Now that I write this, it seems broken).

You can fiddle with many of the codec choices and encoding parameters, and
there are a bunch more parameters that you cannot control. Post a message
to the mailing list if there are some 'must have' parameters. Look in
ffserver.conf for a list of the currently available controls.

It will automatically generate the ASX or RAM files that are often used
in browsers. These files are actually redirections to the underlying ASF
or RM file. The reason for this is that the browser often fetches the
entire file before starting up the external viewer. The redirection files
are very small and can be transferred quickly. [The stream itself is
often 'infinite' and thus the browser tries to download it and never
finishes.]


=head2 Tips


* When you connect to a live stream, most players (WMP, RA, etc) want to
buffer a certain number of seconds of material so that they can display the
signal continuously. However, ffserver (by default) starts sending data
in realtime. This means that there is a pause of a few seconds while the
buffering is being done by the player. The good news is that this can be
cured by adding a '?buffer=5' to the end of the URL. This means that the
stream should start 5 seconds in the past -- and so the first 5 seconds
of the stream are sent as fast as the network will allow. It will then
slow down to real time. This noticeably improves the startup experience.

You can also add a 'Preroll 15' statement into the ffserver.conf that will
add the 15 second prebuffering on all requests that do not otherwise
specify a time. In addition, ffserver will skip frames until a key_frame
is found. This further reduces the startup delay by not transferring data
that will be discarded.


=head2 Why does the ?buffer / Preroll stop working after a time?


It turns out that (on my machine at least) the number of frames successfully
grabbed is marginally less than the number that ought to be grabbed. This
means that the timestamp in the encoded data stream gets behind realtime.
This means that if you say 'Preroll 10', then when the stream gets 10
or more seconds behind, there is no Preroll left.

Fixing this requires a change in the internals of how timestamps are
handled.


=head2 Does the C<?date=> stuff work.


Yes (subject to the limitation outlined above). Also note that whenever you
start ffserver, it deletes the ffm file (if any parameters have changed),
thus wiping out what you had recorded before.

The format of the C<?date=xxxxxx> is fairly flexible. You should use one
of the following formats (the 'T' is literal):

	
	* YYYY-MM-DDTHH:MM:SS     (localtime)
	* YYYY-MM-DDTHH:MM:SSZ    (UTC)


You can omit the YYYY-MM-DD, and then it refers to the current day. However
note that B<?date=16:00:00> refers to 16:00 on the current day -- this
may be in the future and so is unlikely to be useful.

You use this by adding the ?date= to the end of the URL for the stream.
For example:   B<http://localhost:8080/test.asf?date=2002-07-26T23:05:00>.


=head1 OPTIONS


All the numerical options, if not specified otherwise, accept a string
representing a number as input, which may be followed by one of the SI
unit prefixes, for example: 'K', 'M', or 'G'.

If 'i' is appended to the SI unit prefix, the complete prefix will be
interpreted as a unit prefix for binary multiples, which are based on
powers of 1024 instead of powers of 1000. Appending 'B' to the SI unit
prefix multiplies the value by 8. This allows using, for example:
'KB', 'MiB', 'G' and 'B' as number suffixes.

Options which do not take arguments are boolean options, and set the
corresponding value to true. They can be set to false by prefixing
the option name with "no". For example using "-nofoo"
will set the boolean option with name "foo" to false.



=head2 Stream specifiers

Some options are applied per-stream, e.g. bitrate or codec. Stream specifiers
are used to precisely specify which stream(s) a given option belongs to.

A stream specifier is a string generally appended to the option name and
separated from it by a colon. E.g. C<-codec:a:1 ac3> contains the
C<a:1> stream specifier, which matches the second audio stream. Therefore, it
would select the ac3 codec for the second audio stream.

A stream specifier can match several streams, so that the option is applied to all
of them. E.g. the stream specifier in C<-b:a 128k> matches all audio
streams.

An empty stream specifier matches all streams. For example, C<-codec copy>
or C<-codec: copy> would copy all the streams without reencoding.

Possible forms of stream specifiers are:

=over 4


=item I<stream_index>

Matches the stream with this index. E.g. C<-threads:1 4> would set the
thread count for the second stream to 4.

=item I<stream_type>B<[:>I<stream_index>B<]>

I<stream_type> is one of following: 'v' or 'V' for video, 'a' for audio, 's'
for subtitle, 'd' for data, and 't' for attachments. 'v' matches all video
streams, 'V' only matches video streams which are not attached pictures, video
thumbnails or cover arts.  If I<stream_index> is given, then it matches
stream number I<stream_index> of this type. Otherwise, it matches all
streams of this type.

=item B<p:>I<program_id>B<[:>I<stream_index>B<]>

If I<stream_index> is given, then it matches the stream with number I<stream_index>
in the program with the id I<program_id>. Otherwise, it matches all streams in the
program.

=item B<#>I<stream_id> B<or i:>I<stream_id>

Match the stream by stream id (e.g. PID in MPEG-TS container).

=item B<m:>I<key>B<[:>I<value>B<]>

Matches streams with the metadata tag I<key> having the specified value. If
I<value> is not given, matches streams that contain the given tag with any
value.

=item B<u>

Matches streams with usable configuration, the codec must be defined and the
essential information such as video dimension or audio sample rate must be present.

Note that in B<ffmpeg>, matching by metadata will only work properly for
input files.

=back



=head2 Generic options


These options are shared amongst the ff* tools.


=over 4



=item B<-L>

Show license.


=item B<-h, -?, -help, --help [>I<arg>B<]>

Show help. An optional parameter may be specified to print help about a specific
item. If no argument is specified, only basic (non advanced) tool
options are shown.

Possible values of I<arg> are:

=over 4


=item B<long>

Print advanced tool options in addition to the basic tool options.


=item B<full>

Print complete list of options, including shared and private options
for encoders, decoders, demuxers, muxers, filters, etc.


=item B<decoder=>I<decoder_name>

Print detailed information about the decoder named I<decoder_name>. Use the
B<-decoders> option to get a list of all decoders.


=item B<encoder=>I<encoder_name>

Print detailed information about the encoder named I<encoder_name>. Use the
B<-encoders> option to get a list of all encoders.


=item B<demuxer=>I<demuxer_name>

Print detailed information about the demuxer named I<demuxer_name>. Use the
B<-formats> option to get a list of all demuxers and muxers.


=item B<muxer=>I<muxer_name>

Print detailed information about the muxer named I<muxer_name>. Use the
B<-formats> option to get a list of all muxers and demuxers.


=item B<filter=>I<filter_name>

Print detailed information about the filter name I<filter_name>. Use the
B<-filters> option to get a list of all filters.

=back



=item B<-version>

Show version.


=item B<-formats>

Show available formats (including devices).


=item B<-devices>

Show available devices.


=item B<-codecs>

Show all codecs known to libavcodec.

Note that the term 'codec' is used throughout this documentation as a shortcut
for what is more correctly called a media bitstream format.


=item B<-decoders>

Show available decoders.


=item B<-encoders>

Show all available encoders.


=item B<-bsfs>

Show available bitstream filters.


=item B<-protocols>

Show available protocols.


=item B<-filters>

Show available libavfilter filters.


=item B<-pix_fmts>

Show available pixel formats.


=item B<-sample_fmts>

Show available sample formats.


=item B<-layouts>

Show channel names and standard channel layouts.


=item B<-colors>

Show recognized color names.


=item B<-sources> I<device>B<[,>I<opt1>B<=>I<val1>B<[,>I<opt2>B<=>I<val2>B<]...]>

Show autodetected sources of the intput device.
Some devices may provide system-dependent source names that cannot be autodetected.
The returned list cannot be assumed to be always complete.
	
	ffmpeg -sources pulse,server=192.168.0.4



=item B<-sinks> I<device>B<[,>I<opt1>B<=>I<val1>B<[,>I<opt2>B<=>I<val2>B<]...]>

Show autodetected sinks of the output device.
Some devices may provide system-dependent sink names that cannot be autodetected.
The returned list cannot be assumed to be always complete.
	
	ffmpeg -sinks pulse,server=192.168.0.4



=item B<-loglevel [repeat+]>I<loglevel> B<| -v [repeat+]>I<loglevel>

Set the logging level used by the library.
Adding "repeat+" indicates that repeated log output should not be compressed
to the first line and the "Last message repeated n times" line will be
omitted. "repeat" can also be used alone.
If "repeat" is used alone, and with no prior loglevel set, the default
loglevel will be used. If multiple loglevel parameters are given, using
'repeat' will not change the loglevel.
I<loglevel> is a string or a number containing one of the following values:

=over 4


=item B<quiet, -8>

Show nothing at all; be silent.

=item B<panic, 0>

Only show fatal errors which could lead the process to crash, such as
and assert failure. This is not currently used for anything.

=item B<fatal, 8>

Only show fatal errors. These are errors after which the process absolutely
cannot continue after.

=item B<error, 16>

Show all errors, including ones which can be recovered from.

=item B<warning, 24>

Show all warnings and errors. Any message related to possibly
incorrect or unexpected events will be shown.

=item B<info, 32>

Show informative messages during processing. This is in addition to
warnings and errors. This is the default value.

=item B<verbose, 40>

Same as C<info>, except more verbose.

=item B<debug, 48>

Show everything, including debugging information.

=item B<trace, 56>


=back


By default the program logs to stderr, if coloring is supported by the
terminal, colors are used to mark errors and warnings. Log coloring
can be disabled setting the environment variable
B<AV_LOG_FORCE_NOCOLOR> or B<NO_COLOR>, or can be forced setting
the environment variable B<AV_LOG_FORCE_COLOR>.
The use of the environment variable B<NO_COLOR> is deprecated and
will be dropped in a following FFmpeg version.


=item B<-report>

Dump full command line and console output to a file named
C<I<program>-I<YYYYMMDD>-I<HHMMSS>.log> in the current
directory.
This file can be useful for bug reports.
It also implies C<-loglevel verbose>.

Setting the environment variable B<FFREPORT> to any value has the
same effect. If the value is a ':'-separated key=value sequence, these
options will affect the report; option values must be escaped if they
contain special characters or the options delimiter ':' (see the
``Quoting and escaping'' section in the ffmpeg-utils manual).

The following options are recognized:

=over 4


=item B<file>

set the file name to use for the report; C<%p> is expanded to the name
of the program, C<%t> is expanded to a timestamp, C<%%> is expanded
to a plain C<%>

=item B<level>

set the log verbosity level using a numerical value (see C<-loglevel>).

=back


For example, to output a report to a file named F<ffreport.log>
using a log level of C<32> (alias for log level C<info>):

	
	FFREPORT=file=ffreport.log:level=32 ffmpeg -i input output


Errors in parsing the environment variable are not fatal, and will not
appear in the report.


=item B<-hide_banner>

Suppress printing banner.

All FFmpeg tools will normally show a copyright notice, build options
and library versions. This option can be used to suppress printing
this information.


=item B<-cpuflags flags (>I<global>B<)>

Allows setting and clearing cpu flags. This option is intended
for testing. Do not use it unless you know what you're doing.
	
	ffmpeg -cpuflags -sse+mmx ...
	ffmpeg -cpuflags mmx ...
	ffmpeg -cpuflags 0 ...

Possible flags for this option are:

=over 4


=item B<x86>


=over 4


=item B<mmx>


=item B<mmxext>


=item B<sse>


=item B<sse2>


=item B<sse2slow>


=item B<sse3>


=item B<sse3slow>


=item B<ssse3>


=item B<atom>


=item B<sse4.1>


=item B<sse4.2>


=item B<avx>


=item B<avx2>


=item B<xop>


=item B<fma3>


=item B<fma4>


=item B<3dnow>


=item B<3dnowext>


=item B<bmi1>


=item B<bmi2>


=item B<cmov>


=back


=item B<ARM>


=over 4


=item B<armv5te>


=item B<armv6>


=item B<armv6t2>


=item B<vfp>


=item B<vfpv3>


=item B<neon>


=item B<setend>


=back


=item B<AArch64>


=over 4


=item B<armv8>


=item B<vfp>


=item B<neon>


=back


=item B<PowerPC>


=over 4


=item B<altivec>


=back


=item B<Specific Processors>


=over 4


=item B<pentium2>


=item B<pentium3>


=item B<pentium4>


=item B<k6>


=item B<k62>


=item B<athlon>


=item B<athlonxp>


=item B<k8>


=back


=back



=item B<-opencl_bench>

This option is used to benchmark all available OpenCL devices and print the
results. This option is only available when FFmpeg has been compiled with
C<--enable-opencl>.

When FFmpeg is configured with C<--enable-opencl>, the options for the
global OpenCL context are set via B<-opencl_options>. See the
"OpenCL Options" section in the ffmpeg-utils manual for the complete list of
supported options. Amongst others, these options include the ability to select
a specific platform and device to run the OpenCL code on. By default, FFmpeg
will run on the first device of the first platform. While the options for the
global OpenCL context provide flexibility to the user in selecting the OpenCL
device of their choice, most users would probably want to select the fastest
OpenCL device for their system.

This option assists the selection of the most efficient configuration by
identifying the appropriate device for the user's system. The built-in
benchmark is run on all the OpenCL devices and the performance is measured for
each device. The devices in the results list are sorted based on their
performance with the fastest device listed first. The user can subsequently
invoke B<ffmpeg> using the device deemed most appropriate via
B<-opencl_options> to obtain the best performance for the OpenCL
accelerated code.

Typical usage to use the fastest OpenCL device involve the following steps.

Run the command:
	
	ffmpeg -opencl_bench

Note down the platform ID (I<pidx>) and device ID (I<didx>) of the first
i.e. fastest device in the list.
Select the platform and device using the command:
	
	ffmpeg -opencl_options platform_idx=<pidx>:device_idx=<didx> ...



=item B<-opencl_options options (>I<global>B<)>

Set OpenCL environment options. This option is only available when
FFmpeg has been compiled with C<--enable-opencl>.

I<options> must be a list of I<key>=I<value> option pairs
separated by ':'. See the ``OpenCL Options'' section in the
ffmpeg-utils manual for the list of supported options.

=back



=head2 AVOptions


These options are provided directly by the libavformat, libavdevice and
libavcodec libraries. To see the list of available AVOptions, use the
B<-help> option. They are separated into two categories:

=over 4


=item B<generic>

These options can be set for any container, codec or device. Generic options
are listed under AVFormatContext options for containers/devices and under
AVCodecContext options for codecs.

=item B<private>

These options are specific to the given container, device or codec. Private
options are listed under their corresponding containers/devices/codecs.

=back


For example to write an ID3v2.3 header instead of a default ID3v2.4 to
an MP3 file, use the B<id3v2_version> private option of the MP3
muxer:
	
	ffmpeg -i input.flac -id3v2_version 3 out.mp3


All codec AVOptions are per-stream, and thus a stream specifier
should be attached to them.

Note: the B<-nooption> syntax cannot be used for boolean
AVOptions, use B<-option 0>/B<-option 1>.

Note: the old undocumented way of specifying per-stream AVOptions by
prepending v/a/s to the options name is now obsolete and will be
removed soon.


=head2 Main options



=over 4


=item B<-f> I<configfile>

Read configuration file F<configfile>. If not specified it will
read by default from F</etc/ffserver.conf>.


=item B<-n>

Enable no-launch mode. This option disables all the C<Launch>
directives within the various C<E<lt>FeedE<gt>> sections. Since
B<ffserver> will not launch any B<ffmpeg> instances, you
will have to launch them manually.


=item B<-d>

Enable debug mode. This option increases log verbosity, and directs
log messages to stdout. When specified, the B<CustomLog> option
is ignored.

=back



=head1 CONFIGURATION FILE SYNTAX


B<ffserver> reads a configuration file containing global
options and settings for each stream and feed.

The configuration file consists of global options and dedicated
sections, which must be introduced by "E<lt>I<SECTION_NAME>
I<ARGS>E<gt>" on a separate line and must be terminated by a line in
the form "E<lt>/I<SECTION_NAME>E<gt>". I<ARGS> is optional.

Currently the following sections are recognized: B<Feed>,
B<Stream>, B<Redirect>.

A line starting with C<#> is ignored and treated as a comment.

Name of options and sections are case-insensitive.


=head2 ACL syntax

An ACL (Access Control List) specifies the address which are allowed
to access a given stream, or to write a given feed.

It accepts the folling forms

=over 4


=item *

Allow/deny access to I<address>.
	
	ACL ALLOW <address>
	ACL DENY <address>



=item *

Allow/deny access to ranges of addresses from I<first_address> to
I<last_address>.
	
	ACL ALLOW <first_address> <last_address>
	ACL DENY <first_address> <last_address>


=back


You can repeat the ACL allow/deny as often as you like. It is on a per
stream basis. The first match defines the action. If there are no matches,
then the default is the inverse of the last ACL statement.

Thus 'ACL allow localhost' only allows access from localhost.
'ACL deny 1.0.0.0 1.255.255.255' would deny the whole of network 1 and
allow everybody else.


=head2 Global options


=over 4


=item B<HTTPPort> I<port_number>


=item B<Port> I<port_number>


=item B<RTSPPort> I<port_number>


I<HTTPPort> sets the HTTP server listening TCP port number,
I<RTSPPort> sets the RTSP server listening TCP port number.

I<Port> is the equivalent of I<HTTPPort> and is deprecated.

You must select a different port from your standard HTTP web server if
it is running on the same computer.

If not specified, no corresponding server will be created.


=item B<HTTPBindAddress> I<ip_address>


=item B<BindAddress> I<ip_address>


=item B<RTSPBindAddress> I<ip_address>

Set address on which the HTTP/RTSP server is bound. Only useful if you
have several network interfaces.

I<BindAddress> is the equivalent of I<HTTPBindAddress> and is
deprecated.


=item B<MaxHTTPConnections> I<n>

Set number of simultaneous HTTP connections that can be handled. It
has to be defined I<before> the B<MaxClients> parameter,
since it defines the B<MaxClients> maximum limit.

Default value is 2000.


=item B<MaxClients> I<n>

Set number of simultaneous requests that can be handled. Since
B<ffserver> is very fast, it is more likely that you will want
to leave this high and use B<MaxBandwidth>.

Default value is 5.


=item B<MaxBandwidth> I<kbps>

Set the maximum amount of kbit/sec that you are prepared to consume
when streaming to clients.

Default value is 1000.


=item B<CustomLog> I<filename>

Set access log file (uses standard Apache log file format). '-' is the
standard output.

If not specified B<ffserver> will produce no log.

In case the commandline option B<-d> is specified this option is
ignored, and the log is written to standard output.


=item B<NoDaemon>

Set no-daemon mode. This option is currently ignored since now
B<ffserver> will always work in no-daemon mode, and is
deprecated.


=item B<UseDefaults>


=item B<NoDefaults>

Control whether default codec options are used for the all streams or not.
Each stream may overwrite this setting for its own. Default is I<UseDefaults>.
The lastest occurrence overrides previous if multiple definitions.

=back



=head2 Feed section


A Feed section defines a feed provided to B<ffserver>.

Each live feed contains one video and/or audio sequence coming from an
B<ffmpeg> encoder or another B<ffserver>. This sequence
may be encoded simultaneously with several codecs at several
resolutions.

A feed instance specification is introduced by a line in the form:
	
	<Feed FEED_FILENAME>


where I<FEED_FILENAME> specifies the unique name of the FFM stream.

The following options are recognized within a Feed section.


=over 4


=item B<File> I<filename>


=item B<ReadOnlyFile> I<filename>

Set the path where the feed file is stored on disk.

If not specified, the F</tmp/FEED.ffm> is assumed, where
I<FEED> is the feed name.

If B<ReadOnlyFile> is used the file is marked as read-only and
it will not be deleted or updated.


=item B<Truncate>

Truncate the feed file, rather than appending to it. By default
B<ffserver> will append data to the file, until the maximum
file size value is reached (see B<FileMaxSize> option).


=item B<FileMaxSize> I<size>

Set maximum size of the feed file in bytes. 0 means unlimited. The
postfixes C<K> (2^10), C<M> (2^20), and C<G> (2^30) are
recognized.

Default value is 5M.


=item B<Launch> I<args>

Launch an B<ffmpeg> command when creating B<ffserver>.

I<args> must be a sequence of arguments to be provided to an
B<ffmpeg> instance. The first provided argument is ignored, and
it is replaced by a path with the same dirname of the B<ffserver>
instance, followed by the remaining argument and terminated with a
path corresponding to the feed.

When the launched process exits, B<ffserver> will launch
another program instance.

In case you need a more complex B<ffmpeg> configuration,
e.g. if you need to generate multiple FFM feeds with a single
B<ffmpeg> instance, you should launch B<ffmpeg> by hand.

This option is ignored in case the commandline option B<-n> is
specified.


=item B<ACL> I<spec>

Specify the list of IP address which are allowed or denied to write
the feed. Multiple ACL options can be specified.

=back



=head2 Stream section


A Stream section defines a stream provided by B<ffserver>, and
identified by a single name.

The stream is sent when answering a request containing the stream
name.

A stream section must be introduced by the line:
	
	<Stream STREAM_NAME>


where I<STREAM_NAME> specifies the unique name of the stream.

The following options are recognized within a Stream section.

Encoding options are marked with the I<encoding> tag, and they are
used to set the encoding parameters, and are mapped to libavcodec
encoding options. Not all encoding options are supported, in
particular it is not possible to set encoder private options. In order
to override the encoding options specified by B<ffserver>, you
can use the B<ffmpeg> B<override_ffserver> commandline
option.

Only one of the B<Feed> and B<File> options should be set.


=over 4


=item B<Feed> I<feed_name>

Set the input feed. I<feed_name> must correspond to an existing
feed defined in a C<Feed> section.

When this option is set, encoding options are used to setup the
encoding operated by the remote B<ffmpeg> process.


=item B<File> I<filename>

Set the filename of the pre-recorded input file to stream.

When this option is set, encoding options are ignored and the input
file content is re-streamed as is.


=item B<Format> I<format_name>

Set the format of the output stream.

Must be the name of a format recognized by FFmpeg. If set to
B<status>, it is treated as a status stream.


=item B<InputFormat> I<format_name>

Set input format. If not specified, it is automatically guessed.


=item B<Preroll> I<n>

Set this to the number of seconds backwards in time to start. Note that
most players will buffer 5-10 seconds of video, and also you need to allow
for a keyframe to appear in the data stream.

Default value is 0.


=item B<StartSendOnKey>

Do not send stream until it gets the first key frame. By default
B<ffserver> will send data immediately.


=item B<MaxTime> I<n>

Set the number of seconds to run. This value set the maximum duration
of the stream a client will be able to receive.

A value of 0 means that no limit is set on the stream duration.


=item B<ACL> I<spec>

Set ACL for the stream.


=item B<DynamicACL> I<spec>



=item B<RTSPOption> I<option>



=item B<MulticastAddress> I<address>



=item B<MulticastPort> I<port>



=item B<MulticastTTL> I<integer>



=item B<NoLoop>



=item B<FaviconURL> I<url>

Set favicon (favourite icon) for the server status page. It is ignored
for regular streams.


=item B<Author> I<value>


=item B<Comment> I<value>


=item B<Copyright> I<value>


=item B<Title> I<value>

Set metadata corresponding to the option. All these options are
deprecated in favor of B<Metadata>.


=item B<Metadata> I<key>B< >I<value>

Set metadata value on the output stream.


=item B<UseDefaults>


=item B<NoDefaults>

Control whether default codec options are used for the stream or not.
Default is I<UseDefaults> unless disabled globally.


=item B<NoAudio>


=item B<NoVideo>

Suppress audio/video.


=item B<AudioCodec> I<codec_name> B<(>I<encoding,audio>B<)>

Set audio codec.


=item B<AudioBitRate> I<rate> B<(>I<encoding,audio>B<)>

Set bitrate for the audio stream in kbits per second.


=item B<AudioChannels> I<n> B<(>I<encoding,audio>B<)>

Set number of audio channels.


=item B<AudioSampleRate> I<n> B<(>I<encoding,audio>B<)>

Set sampling frequency for audio. When using low bitrates, you should
lower this frequency to 22050 or 11025. The supported frequencies
depend on the selected audio codec.


=item B<AVOptionAudio [>I<codec>B<:]>I<option>B< >I<value> B<(>I<encoding,audio>B<)>

Set generic or private option for audio stream.
Private option must be prefixed with codec name or codec must be defined before.


=item B<AVPresetAudio> I<preset> B<(>I<encoding,audio>B<)>

Set preset for audio stream.


=item B<VideoCodec> I<codec_name> B<(>I<encoding,video>B<)>

Set video codec.


=item B<VideoBitRate> I<n> B<(>I<encoding,video>B<)>

Set bitrate for the video stream in kbits per second.


=item B<VideoBitRateRange> I<range> B<(>I<encoding,video>B<)>

Set video bitrate range.

A range must be specified in the form I<minrate>-I<maxrate>, and
specifies the B<minrate> and B<maxrate> encoding options
expressed in kbits per second.


=item B<VideoBitRateRangeTolerance> I<n> B<(>I<encoding,video>B<)>

Set video bitrate tolerance in kbits per second.


=item B<PixelFormat> I<pixel_format> B<(>I<encoding,video>B<)>

Set video pixel format.


=item B<Debug> I<integer> B<(>I<encoding,video>B<)>

Set video B<debug> encoding option.


=item B<Strict> I<integer> B<(>I<encoding,video>B<)>

Set video B<strict> encoding option.


=item B<VideoBufferSize> I<n> B<(>I<encoding,video>B<)>

Set ratecontrol buffer size, expressed in KB.


=item B<VideoFrameRate> I<n> B<(>I<encoding,video>B<)>

Set number of video frames per second.


=item B<VideoSize (>I<encoding,video>B<)>

Set size of the video frame, must be an abbreviation or in the form
I<W>xI<H>.  See B<the Video size section
in the ffmpeg-utils(1) manual>.

Default value is C<160x128>.


=item B<VideoIntraOnly (>I<encoding,video>B<)>

Transmit only intra frames (useful for low bitrates, but kills frame rate).


=item B<VideoGopSize> I<n> B<(>I<encoding,video>B<)>

If non-intra only, an intra frame is transmitted every VideoGopSize
frames. Video synchronization can only begin at an intra frame.


=item B<VideoTag> I<tag> B<(>I<encoding,video>B<)>

Set video tag.


=item B<VideoHighQuality (>I<encoding,video>B<)>


=item B<Video4MotionVector (>I<encoding,video>B<)>



=item B<BitExact (>I<encoding,video>B<)>

Set bitexact encoding flag.


=item B<IdctSimple (>I<encoding,video>B<)>

Set simple IDCT algorithm.


=item B<Qscale> I<n> B<(>I<encoding,video>B<)>

Enable constant quality encoding, and set video qscale (quantization
scale) value, expressed in I<n> QP units.


=item B<VideoQMin> I<n> B<(>I<encoding,video>B<)>


=item B<VideoQMax> I<n> B<(>I<encoding,video>B<)>

Set video qmin/qmax.


=item B<VideoQDiff> I<integer> B<(>I<encoding,video>B<)>

Set video B<qdiff> encoding option.


=item B<LumiMask> I<float> B<(>I<encoding,video>B<)>


=item B<DarkMask> I<float> B<(>I<encoding,video>B<)>

Set B<lumi_mask>/B<dark_mask> encoding options.


=item B<AVOptionVideo [>I<codec>B<:]>I<option>B< >I<value> B<(>I<encoding,video>B<)>

Set generic or private option for video stream.
Private option must be prefixed with codec name or codec must be defined before.


=item B<AVPresetVideo> I<preset> B<(>I<encoding,video>B<)>

Set preset for video stream.

I<preset> must be the path of a preset file.

=back



=head3 Server status stream


A server status stream is a special stream which is used to show
statistics about the B<ffserver> operations.

It must be specified setting the option B<Format> to
B<status>.


=head2 Redirect section


A redirect section specifies where to redirect the requested URL to
another page.

A redirect section must be introduced by the line:
	
	<Redirect NAME>


where I<NAME> is the name of the page which should be redirected.

It only accepts the option B<URL>, which specify the redirection
URL.


=head1 STREAM EXAMPLES



=over 4


=item *

Multipart JPEG
	
	<Stream test.mjpg>
	Feed feed1.ffm
	Format mpjpeg
	VideoFrameRate 2
	VideoIntraOnly
	NoAudio
	Strict -1
	</Stream>



=item *

Single JPEG
	
	<Stream test.jpg>
	Feed feed1.ffm
	Format jpeg
	VideoFrameRate 2
	VideoIntraOnly
	VideoSize 352x240
	NoAudio
	Strict -1
	</Stream>



=item *

Flash
	
	<Stream test.swf>
	Feed feed1.ffm
	Format swf
	VideoFrameRate 2
	VideoIntraOnly
	NoAudio
	</Stream>



=item *

ASF compatible
	
	<Stream test.asf>
	Feed feed1.ffm
	Format asf
	VideoFrameRate 15
	VideoSize 352x240
	VideoBitRate 256
	VideoBufferSize 40
	VideoGopSize 30
	AudioBitRate 64
	StartSendOnKey
	</Stream>



=item *

MP3 audio
	
	<Stream test.mp3>
	Feed feed1.ffm
	Format mp2
	AudioCodec mp3
	AudioBitRate 64
	AudioChannels 1
	AudioSampleRate 44100
	NoVideo
	</Stream>



=item *

Ogg Vorbis audio
	
	<Stream test.ogg>
	Feed feed1.ffm
	Metadata title "Stream title"
	AudioBitRate 64
	AudioChannels 2
	AudioSampleRate 44100
	NoVideo
	</Stream>



=item *

Real with audio only at 32 kbits
	
	<Stream test.ra>
	Feed feed1.ffm
	Format rm
	AudioBitRate 32
	NoVideo
	</Stream>



=item *

Real with audio and video at 64 kbits
	
	<Stream test.rm>
	Feed feed1.ffm
	Format rm
	AudioBitRate 32
	VideoBitRate 128
	VideoFrameRate 25
	VideoGopSize 25
	</Stream>



=item *

For stream coming from a file: you only need to set the input filename
and optionally a new format.

	
	<Stream file.rm>
	File "/usr/local/httpd/htdocs/tlive.rm"
	NoAudio
	</Stream>


	
	<Stream file.asf>
	File "/usr/local/httpd/htdocs/test.asf"
	NoAudio
	Metadata author "Me"
	Metadata copyright "Super MegaCorp"
	Metadata title "Test stream from disk"
	Metadata comment "Test comment"
	</Stream>


=back





=head1 SEE ALSO



ffserver-all(1),
the F<doc/ffserver.conf> example, ffmpeg(1), ffplay(1), ffprobe(1),
ffmpeg-utils(1), ffmpeg-scaler(1), ffmpeg-resampler(1),
ffmpeg-codecs(1), ffmpeg-bitstream-filters(1), ffmpeg-formats(1),
ffmpeg-devices(1), ffmpeg-protocols(1), ffmpeg-filters(1)


=head1 AUTHORS


The FFmpeg developers.

For details about the authorship, see the Git history of the project
(git://source.ffmpeg.org/ffmpeg), e.g. by typing the command
B<git log> in the FFmpeg source directory, or browsing the
online repository at E<lt>B<http://source.ffmpeg.org>E<gt>.

Maintainers for the specific components are listed in the file
F<MAINTAINERS> in the source code tree.



