Example


ffmpeg -f v4l2 -i /dev/video0 \
       -f alsa -i hw:0 \
       -map 0:0 \
       -c:v libvpx-vp9 \
       -s 640x360 -keyint_min 30 -g 30 \
       -f webm_chunk \
       -header webm_live_video_360.hdr \
       -chunk_start_index 1 \
       webm_live_video_360_%d.chk \
       -map 1:0 \
       -c:a libvorbis \
       -b:a 128k \
       -f webm_chunk \
       -header webm_live_audio_128.hdr \
       -chunk_start_index 1 \
       -audio_chunk_duration 1000 \
       webm_live_audio_128_%d.chk

FFmpeg is able to dump metadata from media files into a simple UTF-8-encoded INI-like text file and then load it back using the metadata muxer/demuxer.

The file format is as follows:

    A file consists of a header and a number of metadata tags divided into sections, each on its own line.

    The header is a ';FFMETADATA' string, followed by a version number (now 1).

    Metadata tags are of the form 'key=value'

    Immediately after header follows global metadata

    After global metadata there may be sections with per-stream/per-chapter metadata.

    A section starts with the section name in uppercase (i.e. STREAM or CHAPTER) in brackets ('[', ']') and ends with next section or end of file.

    At the beginning of a chapter section there may be an optional timebase to be used for start/end values. It must be in form 'TIMEBASE=num/den', where num and den are integers. If the timebase is missing then start/end times are assumed to be in nanoseconds.

    Next a chapter section must contain chapter start and end times in form 'START=num', 'END=num', where num is a positive integer.

    Empty lines and lines starting with ';' or '#' are ignored.

    Metadata keys or values containing special characters ('=', ';', '#', '\' and a newline) must be escaped with a backslash '\'.

    Note that whitespace in metadata (e.g. 'foo = bar') is considered to be a part of the tag (in the example above key is 'foo ', value is ' bar').

A ffmetadata file might look like this:

;FFMETADATA1
title=bike\\shed
;this is a comment
artist=FFmpeg troll team
[CHAPTER]
TIMEBASE=1/1000
START=0
#chapter ends at 0:01:00
END=60000
title=chapter \#1
[STREAM]
title=multi\
line

By using the ffmetadata muxer and demuxer it is possible to extract metadata from an input file to an ffmetadata file, and then transcode the file into an output file with the edited ffmetadata file.

Extracting an ffmetadata file with 'ffmpeg' goes as follows:

ffmpeg -i INPUT -f ffmetadata FFMETADATAFILE

Reinserting edited metadata information from the FFMETADATAFILE file can be done as:

ffmpeg -i INPUT -i FFMETADATAFILE -map_metadata 1 -codec copy OUTPUT

The libavformat library provides some generic global options, which can be set on all the protocols. In addition each protocol may support so-called private options, which are specific for that component.

Options may be set by specifying -option value in the FFmpeg tools, or by setting the value explicitly in the AVFormatContext options or using the 'libavutil/opt.h' API for programmatic use.

The list of supported options follows:

'protocol_whitelist list (input)'

Set a ","-separated list of allowed protocols. "ALL" matches all protocols. Protocols prefixed by "-" are disabled. All protocols are allowed by default but protocols used by an another protocol (nested protocols) are restricted to a per protocol subset.

Protocols are configured elements in FFmpeg that enable access to resources that require specific protocols.

When you configure your FFmpeg build, all the supported protocols are enabled by default. You can list all available ones using the configure option "-list-protocols".

You can disable all the protocols using the configure option "-disable-protocols", and selectively enable a protocol using the option "-enable-protocol=PROTOCOL", or you can disable a particular protocol using the option "-disable-protocol=PROTOCOL".

The option "-protocols" of the ff* tools will display the list of supported protocols.

All protocols accept the following options:

'rw_timeout'

Maximum time to wait for (network) read/write operations to complete, in microseconds.

A description of the currently available protocols follows.