diff options
author | Bodecs Bela <bodecsb@vivanet.hu> | 2016-12-27 10:40:35 +0800 |
---|---|---|
committer | Bodecs Bela <bodecsb@vivanet.hu> | 2016-12-27 10:40:35 +0800 |
commit | 0ff8c6b6d5243becfa73ff6960348a949055617b (patch) | |
tree | f759840fac8a80a177a9f06031d13af3772d80a8 /doc/muxers.texi | |
parent | c7c0046efc3a05e52d0a6da4da9f0beae47c0847 (diff) | |
download | ffmpeg-0ff8c6b6d5243becfa73ff6960348a949055617b.tar.gz |
avformat/hlsenc: strftime identifiers and segment index
in filenames
Putting date/time values into segment filenames is very usefull.
But to produce non-conflicting segment filenames with -use_localtime
option with date/time
values in hls_segment_filename option, sometimes is not enough.
Like in cases when multiple segments produced in the same second.
But hlsenc currently does not make possible to use segment index (%d) at
the
same time whe use_localtime is in effect, due to identifier conflict.
This patch makes possible to use strftime identifiers and still put
segment index (%d) at same time in segment filenames by introducing
second_level_segment_index flag. When -use_localtime is active,
identifier %d is for month day index, so %%d is the segment index
placeholder. This enhanced behaviour only exists when new
second_level_segment_index flag is specified.
For instance putting 'segment_%Y%m%d%H%M%S_%%05d.ts' value into
-hls_segment_filename option and specifing -hls_flags
second_level_segment_index and -use_localtime 1, may produce segment
filename as 'segment_20161230235758_00002.ts'
An example:
ffmpeg -loglevel info -y -f lavfi -i color=c=red:size=640x480:r=25 -f
lavfi -i anullsrc=r=44100:cl=stereo -c:v mpeg2video -g 25 -acodec aac
-cutoff 20000 -ac 2 -ar 44100 -ab 192k -f hls -hls_time 3 -hls_list_size
5 -hls_flags delete_segments+second_level_segment_index -use_localtime 1
-hls_segment_filename "segment_%Y%m%d%H%M%S_%%05d.ts" stream.m3u8
will produce segments filenames:
....
segment_20161227005902_00013.ts
segment_20161227005902_00014.ts
segment_20161227005902_00015.ts
segment_20161227005903_00016.ts
segment_20161227005903_00017.ts
segment_20161227005903_00018.ts
segment_20161227005903_00019.ts
segment_20161227005903_00020.ts
....
Signed-off-by: Bela Bodecs <bodecsb@vivanet.hu>
Diffstat (limited to 'doc/muxers.texi')
-rw-r--r-- | doc/muxers.texi | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/doc/muxers.texi b/doc/muxers.texi index 075b8d3117..3520120471 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -443,12 +443,18 @@ This example will produce the playlist, @file{out.m3u8}, and segment files: @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. +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. +@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 @@ -556,6 +562,9 @@ seeking. This flag should be used with the @code{hls_time} option. @item hls_flags program_date_time Generate @code{EXT-X-PROGRAM-DATE-TIME} tags. +@item hls_flags second_level_segment_index +Makes it possible to use segment indexes as %%d besides date/time values when use_localtime is on. + @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. |