]> git.sesse.net Git - ffmpeg/blobdiff - doc/muxers.texi
avformat/hlsenc: deprecate hls_wrap option
[ffmpeg] / doc / muxers.texi
index 806182a148c786b58e3a068834c8e32bd4b9d8ee..4b4dcb29364079fd49915a76d7b54580ddf19693 100644 (file)
@@ -13,8 +13,9 @@ You can disable all the muxers with the configure option
 with the options @code{--enable-muxer=@var{MUXER}} /
 @code{--disable-muxer=@var{MUXER}}.
 
-The option @code{-formats} of the ff* tools will display the list of
-enabled muxers.
+The option @code{-muxers} of the ff* tools will display the list of
+enabled muxers. Use @code{-formats} to view a combined list of
+enabled demuxers and muxers.
 
 A description of some of the currently available muxers follows.
 
@@ -57,6 +58,39 @@ fragmentation or muxer overhead depending on your source. Default value is
 
 @end table
 
+@anchor{avi}
+@section avi
+
+Audio Video Interleaved muxer.
+
+@subsection Options
+
+It accepts the following options:
+
+@table @option
+@item reserve_index_space
+Reserve the specified amount of bytes for the OpenDML master index of each
+stream within the file header. By default additional master indexes are
+embedded within the data packets if there is no space left in the first master
+index and are linked together as a chain of indexes. This index structure can
+cause problems for some use cases, e.g. third-party software strictly relying
+on the OpenDML index specification or when file seeking is slow. Reserving
+enough index space in the file header avoids these problems.
+
+The required index space depends on the output file size and should be about 16
+bytes per gigabyte. When this option is omitted or set to zero the necessary
+index space is guessed.
+
+@item write_channel_mask
+Write the channel layout mask into the audio stream header.
+
+This option is enabled by default. Disabling the channel mask can be useful in
+specific scenarios, e.g. when merging multiple audio streams into one for
+compatibility with software that only supports a single audio stream in AVI
+(see @ref{amerge,,the "amerge" section in the ffmpeg-filters manual,ffmpeg-filters}).
+
+@end table
+
 @anchor{chromaprint}
 @section chromaprint
 
@@ -148,6 +182,13 @@ Place AAC sequence header based on audio stream data.
 @item no_sequence_end
 Disable sequence end tag.
 
+@item no_metadata
+Disable metadata tag.
+
+@item no_duration_filesize
+Disable duration and filesize in metadata when they are equal to zero
+at the end of stream. (Be used to non-seekable living stream).
+
 @item add_keyframe_index
 Used to facilitate seeking; particularly for HTTP pseudo streaming.
 @end table
@@ -401,17 +442,41 @@ parameters. Values containing @code{:} special characters must be
 escaped.
 
 @item hls_wrap @var{wrap}
-Set the number after which the segment filename number (the number
-specified in each segment file) wraps. If set to 0 the number will be
-never wrapped. Default value is 0.
+This is a deprecated option, you can use @code {hls_list_size}
+and @code{hls_flags delete_segments} instead it
 
 This option is useful to avoid to fill the disk with many segment
 files, and limits the maximum number of segment files written to disk
 to @var{wrap}.
 
+
+@item hls_start_number_source
+Start the playlist sequence number (@code{#EXT-X-MEDIA-SEQUENCE}) according to the specified source.
+Unless @code{hls_flags single_file} is set, it also specifies source of starting sequence numbers of
+segment and subtitle filenames. In any case, if @code{hls_flags append_list}
+is set and read playlist sequence number is greater than the specified start sequence number,
+then that value will be used as start value.
+
+It accepts the following values:
+
+@table @option
+
+@item generic (default)
+Set the starting sequence numbers according to @var{start_number} option value.
+
+@item epoch
+The start number will be the seconds since epoch (1970-01-01 00:00:00)
+
+@item datetime
+The start number will be based on the current date/time as YYYYmmddHHMMSS. e.g. 20161231235759.
+
+@end table
+
 @item start_number @var{number}
-Start the playlist sequence number from @var{number}. Default value is
-0.
+Start the playlist sequence number (@code{#EXT-X-MEDIA-SEQUENCE}) from the specified @var{number}
+when @var{hls_start_number_source} value is @var{generic}. (This is the default case.)
+Unless @code{hls_flags single_file} is set, it also specifies starting sequence numbers of segment and subtitle filenames.
+Default value is 0.
 
 @item hls_allow_cache @var{allowcache}
 Explicitly set whether the client MAY (1) or MUST NOT (0) cache media segments.
@@ -434,24 +499,46 @@ ffmpeg -i in.nut -hls_segment_filename 'file%03d.ts' out.m3u8
 This example will produce the playlist, @file{out.m3u8}, and segment files:
 @file{file000.ts}, @file{file001.ts}, @file{file002.ts}, etc.
 
+@var{filename} may contain full path or relative path specification,
+but only the file name part without any path info will be contained in the m3u8 segment list.
+Should a relative path be specified, the path of the created segment
+files will be relative to the current working directory.
+When use_localtime_mkdir is set, the whole expanded value of @var{filename} will be written into the m3u8 segment list.
+
+
 @item use_localtime
-Use strftime on @var{filename} to expand the segment filename with localtime.
-The segment number (%d) is not available in this mode.
+Use strftime() on @var{filename} to expand the segment filename with localtime.
+The segment number is also available in this mode, but to use it, you need to specify second_level_segment_index
+hls_flag and %%d will be the specifier.
 @example
 ffmpeg -i in.nut -use_localtime 1 -hls_segment_filename 'file-%Y%m%d-%s.ts' out.m3u8
 @end example
 This example will produce the playlist, @file{out.m3u8}, and segment files:
 @file{file-20160215-1455569023.ts}, @file{file-20160215-1455569024.ts}, etc.
+Note: On some systems/environments, the @code{%s} specifier is not available. See
+  @code{strftime()} documentation.
+@example
+ffmpeg -i in.nut -use_localtime 1 -hls_flags second_level_segment_index -hls_segment_filename 'file-%Y%m%d-%%04d.ts' out.m3u8
+@end example
+This example will produce the playlist, @file{out.m3u8}, and segment files:
+@file{file-20160215-0001.ts}, @file{file-20160215-0002.ts}, etc.
 
 @item use_localtime_mkdir
-Used together with -use_localtime, it will create up to one subdirectory which
+Used together with -use_localtime, it will create all subdirectories which
 is expanded in @var{filename}.
 @example
 ffmpeg -i in.nut -use_localtime 1 -use_localtime_mkdir 1 -hls_segment_filename '%Y%m%d/file-%Y%m%d-%s.ts' out.m3u8
 @end example
 This example will create a directory 201560215 (if it does not exist), and then
 produce the playlist, @file{out.m3u8}, and segment files:
-@file{201560215/file-20160215-1455569023.ts}, @file{201560215/file-20160215-1455569024.ts}, etc.
+@file{20160215/file-20160215-1455569023.ts}, @file{20160215/file-20160215-1455569024.ts}, etc.
+
+@example
+ffmpeg -i in.nut -use_localtime 1 -use_localtime_mkdir 1 -hls_segment_filename '%Y/%m/%d/file-%Y%m%d-%s.ts' out.m3u8
+@end example
+This example will create a directory hierarchy 2016/02/15 (if any of them do not exist), and then
+produce the playlist, @file{out.m3u8}, and segment files:
+@file{2016/02/15/file-20160215-1455569023.ts}, @file{2016/02/15/file-20160215-1455569024.ts}, etc.
 
 
 @item hls_key_info_file @var{key_info_file}
@@ -510,7 +597,12 @@ ffmpeg -f lavfi -re -i testsrc -c:v h264 -hls_flags delete_segments \
   -hls_key_info_file file.keyinfo out.m3u8
 @end example
 
-@item hls_flags single_file
+
+@item hls_flags @var{flags}
+Possible values:
+
+@table @samp
+@item single_file
 If this flag is set, the muxer will store all segments in a single MPEG-TS
 file, and will use byte ranges in the playlist. HLS playlists generated with
 this way will have the version number 4.
@@ -521,34 +613,66 @@ ffmpeg -i in.nut -hls_flags single_file out.m3u8
 Will produce the playlist, @file{out.m3u8}, and a single segment file,
 @file{out.ts}.
 
-@item hls_flags delete_segments
+@item delete_segments
 Segment files removed from the playlist are deleted after a period of time
 equal to the duration of the segment plus the duration of the playlist.
 
-@item hls_flags append_list
+@item append_list
 Append new segments into the end of old segment list,
 and remove the @code{#EXT-X-ENDLIST} from the old segment list.
 
-@item hls_flags round_durations
+@item round_durations
 Round the duration info in the playlist file segment info to integer
 values, instead of using floating point.
 
-@item hls_flags discont_starts
+@item discont_start
 Add the @code{#EXT-X-DISCONTINUITY} tag to the playlist, before the
 first segment's information.
 
-@item hls_flags omit_endlist
+@item omit_endlist
 Do not append the @code{EXT-X-ENDLIST} tag at the end of the playlist.
 
-@item hls_flags split_by_time
+@item split_by_time
 Allow segments to start on frames other than keyframes. This improves
 behavior on some players when the time between keyframes is inconsistent,
 but may make things worse on others, and can cause some oddities during
 seeking. This flag should be used with the @code{hls_time} option.
 
-@item hls_flags program_date_time
+@item program_date_time
 Generate @code{EXT-X-PROGRAM-DATE-TIME} tags.
 
+@item second_level_segment_index
+Makes it possible to use segment indexes as %%d in hls_segment_filename expression
+besides date/time values when use_localtime is on.
+To get fixed width numbers with trailing zeroes, %%0xd format is available where x is the required width.
+
+@item second_level_segment_size
+Makes it possible to use segment sizes (counted in bytes) as %%s in hls_segment_filename
+expression besides date/time values when use_localtime is on.
+To get fixed width numbers with trailing zeroes, %%0xs format is available where x is the required width.
+
+@item second_level_segment_duration
+Makes it possible to use segment duration (calculated  in microseconds) as %%t in hls_segment_filename
+expression besides date/time values when use_localtime is on.
+To get fixed width numbers with trailing zeroes, %%0xt format is available where x is the required width.
+
+@item temp_file
+Write segment data to filename.tmp and rename to filename only once the segment is complete. A webserver
+serving up segments can be configured to reject requests to *.tmp to prevent access to in-progress segments
+before they have been added to the m3u8 playlist.
+
+@example
+ffmpeg -i sample.mpeg \
+   -f hls -hls_time 3 -hls_list_size 5 \
+   -hls_flags second_level_segment_index+second_level_segment_size+second_level_segment_duration \
+   -use_localtime 1 -use_localtime_mkdir 1 -hls_segment_filename "segment_%Y%m%d%H%M%S_%%04d_%%08s_%%013t.ts" stream.m3u8
+@end example
+This will produce segments like this:
+@file{segment_20170102194334_0003_00122200_0000003000000.ts}, @file{segment_20170102194334_0004_00120072_0000003000000.ts} etc.
+
+
+@end table
+
 @item hls_playlist_type event
 Emit @code{#EXT-X-PLAYLIST-TYPE:EVENT} in the m3u8 header. Forces
 @option{hls_list_size} to 0; the playlist can only be appended to.
@@ -1322,9 +1446,6 @@ within the specified duration after the segmenting clock time. This way you
 can make the segmenter more resilient to backward local time jumps, such as
 leap seconds or transition to standard time from daylight savings time.
 
-Assuming that the delay between the packets of your source is less than 0.5
-second you can detect a leap second by specifying 0.5 as the duration.
-
 Default is the maximum possible duration which means starting a new segment
 regardless of the elapsed time since the last clock time.
 
@@ -1478,6 +1599,7 @@ Specify whether to remove all fragments when finished. Default 0 (do not remove)
 
 @end table
 
+@anchor{fifo}
 @section fifo
 
 The fifo pseudo-muxer allows the separation of encoding and muxing by using
@@ -1585,6 +1707,18 @@ with the tee muxer; encoding can be a very expensive process. It is not
 useful when using the libavformat API directly because it is then possible
 to feed the same packets to several muxers directly.
 
+@table @option
+
+@item use_fifo @var{bool}
+If set to 1, slave outputs will be processed in separate thread using @ref{fifo}
+muxer. This allows to compensate for different speed/latency/reliability of
+outputs and setup transparent recovery. By default this feature is turned off.
+
+@item fifo_options
+Options to pass to fifo pseudo-muxer instances. See @ref{fifo}.
+
+@end table
+
 The slave outputs are specified in the file name given to the muxer,
 separated by '|'. If any of the slave name contains the '|' separator,
 leading or trailing spaces or any special character, it must be
@@ -1606,6 +1740,13 @@ output name suffix.
 Specify a list of bitstream filters to apply to the specified
 output.
 
+@item use_fifo @var{bool}
+This allows to override tee muxer use_fifo option for individual slave muxer.
+
+@item fifo_options
+This allows to override tee muxer fifo_options for individual slave muxer.
+See @ref{fifo}.
+
 It is possible to specify to which streams a given bitstream filter
 applies, by appending a stream specifier to the option separated by
 @code{/}. @var{spec} must be a stream specifier (see @ref{Format
@@ -1654,7 +1795,7 @@ keyframes packets, as requested by the MPEG-TS format. The select
 option is applied to @file{out.aac} in order to make it contain only
 audio packets.
 @example
-ffmpeg -i ... -map 0 -flags +global_header -c:v libx264 -c:a aac -strict experimental
+ffmpeg -i ... -map 0 -flags +global_header -c:v libx264 -c:a aac
        -f tee "[bsfs/v=dump_extra]out.ts|[movflags=+faststart]out.mp4|[select=a]out.aac"
 @end example
 
@@ -1663,7 +1804,7 @@ As below, but select only stream @code{a:1} for the audio output. Note
 that a second level escaping must be performed, as ":" is a special
 character used to separate options.
 @example
-ffmpeg -i ... -map 0 -flags +global_header -c:v libx264 -c:a aac -strict experimental
+ffmpeg -i ... -map 0 -flags +global_header -c:v libx264 -c:a aac
        -f tee "[bsfs/v=dump_extra]out.ts|[movflags=+faststart]out.mp4|[select=\'a:1\']out.aac"
 @end example
 @end itemize