Muxers
******

Muxers are configured elements in FFmpeg which allow writing multimedia streams to a particular type of file.

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

You can disable all the muxers with the configure option --disable-muxers and selectively enable / disable single muxers with the options --enable-muxer=MUXER / --disable-muxer=MUXER.

The option -formats of the ff* tools will display the list of enabled muxers.

A description of some of the currently available muxers follows.

image2
======

Image file muxer.

This muxer writes video frames to multiple image files specified by a pattern.

The pattern may contain the string "%d" or "%0Nd", which specifies the position of the characters representing a numbering in the filenames. If the form "%d0Nd" is used, the string representing the number in each filename is 0-padded to N digits. The literal character '%' can be specified in the pattern with the string "%%".

If the pattern contains "%d" or "%0Nd", the first filename of the file list specified will contain the number 1, all the following numbers will be sequential.

The pattern may contain a suffix which is used to automatically determine the format of the image files to write.

For example the pattern "img-%03d.bmp" will specify a sequence of filenames of the form img-001.bmp, img-002.bmp, ..., img-010.bmp, etc. The pattern "img%%-%d.jpg" will specify a sequence of filenames of the form img%-1.jpg, img%-2.jpg, ..., img%-10.jpg, etc.

The following example shows how to use ffmpeg for creating a sequence of files img-001.jpeg, img-002.jpeg, ..., taking one image every second from the input video:

     ffmpeg -i in.avi -r 1 -f image2 'img-%03d.jpeg'

Note that with ffmpeg, if the format is not specified with the -f option and the output filename specifies an image file format, the image2 muxer is automatically selected, so the previous command can be written as:

     ffmpeg -i in.avi -r 1 'img-%03d.jpeg'

Note also that the pattern must not necessarily contain "%d" or "%0Nd", for example to create a single image file img.jpeg from the input video you can employ the command:

     ffmpeg -i in.avi -f image2 -vframes 1 img.jpeg

mpegts
======

MPEG transport stream muxer.

This muxer implements ISO 13818-1 and part of ETSI EN 300 468.

The muxer options are:

-mpegts_original_network_id NUMBER
     Set the original_network_id (default 0x0001). This is unique identifier of a network in DVB. Its main use is in the unique identification of a service through the path Original_Network_ID, Transport_Stream_ID.

-mpegts_transport_stream_id NUMBER
     Set the transport_stream_id (default 0x0001). This identifies a transponder in DVB.

-mpegts_service_id NUMBER
     Set the service_id (default 0x0001) also known as program in DVB.

-mpegts_pmt_start_pid NUMBER
     Set the first PID for PMT (default 0x1000, max 0x1f00).

-mpegts_start_pid NUMBER
     Set the first PID for data packets (default 0x0100, max 0x0f00).

The recognized metadata settings in mpegts muxer are service_provider and service_name. If they are not set the default for service_provider is "FFmpeg" and the default for service_name is "Service01".

     ffmpeg -i file.mpg -acodec copy -vcodec copy \
          -mpegts_original_network_id 0x1122 \
          -mpegts_transport_stream_id 0x3344 \
          -mpegts_service_id 0x5566 \
          -mpegts_pmt_start_pid 0x1500 \
          -mpegts_start_pid 0x150 \
          -metadata service_provider="Some provider" \
          -metadata service_name="Some Channel" \
          -y out.ts