1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-19 05:49:09 +02:00
FFmpeg/libavformat
Bodecs Bela 0ff8c6b6d5 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>
2016-12-27 10:40:35 +08:00
..
2016-07-03 04:37:48 +02:00
2016-10-17 20:41:26 +02:00
2016-12-08 18:25:30 +01:00
2016-03-13 16:06:09 +01:00
2016-06-19 18:51:39 +02:00
2016-06-19 18:51:39 +02:00
2016-07-17 13:10:27 -03:00
2016-10-21 19:41:09 +02:00
2016-11-26 11:28:22 +08:00
2016-05-04 18:16:21 +02:00
2016-05-04 18:16:21 +02:00
2016-07-15 10:25:02 +02:00
2016-12-22 22:47:06 +01:00
2016-09-10 16:40:47 -07:00
2016-11-08 22:27:11 +01:00
2016-05-21 18:49:45 +02:00
2016-11-07 00:51:49 +01:00
2016-11-10 01:18:43 +01:00
2016-11-07 00:51:49 +01:00
2016-07-02 09:30:40 +02:00
2016-10-09 20:09:00 +02:00
2016-07-17 13:10:27 -03:00
2016-12-20 13:32:15 +01:00
2016-11-23 00:57:10 +01:00
2016-10-20 19:54:54 +02:00
2016-11-23 01:16:42 +01:00
2016-07-17 13:10:27 -03:00
2016-11-02 01:16:23 -05:00
2016-06-25 15:53:11 -05:00
2016-05-03 15:45:10 +02:00
2016-10-09 20:09:00 +02:00
2016-08-04 16:25:40 -03:00
2016-11-07 00:51:49 +01:00