3

Is it possible to have .ts files named by date/time (any format) instead of sequence number when using the HLS muxer? If so, how can it be done?

ffmpeg -i - -hls-some-option-here test_stream.m3u8

test_stream_20141116174310.ts
test_stream_20141116174312.ts
test_stream_20141116174314.ts
test_stream_20141116174316.ts
Brad
  • 6,629

2 Answers2

3

See the segment muxer, which provides a more generic and flexible implementation of a segmenter, and can be used to perform HLS segmentation.

The segment muxer supports strftime expansion with -strftime 1 (disabled by default). This allows segments to be named by time creation.

From man ffmpeg-formats:

strftime 1|0

Use the strftime function to define the name of the new segments to write. If this is selected, the output segment name must contain a strftime function template. Default value is 0.

Example:

ffmpeg -i input.mkv -codec copy -map 0 -f ssegment -strftime 1 \
-segment_list test_stream.m3u8 -segment_time 10 test_stream_%Y%m%d%H%M%S.ts

stream_segment is a variant of the muxer used to write to streaming output formats, i.e. which do not require global headers, and is recommended for outputting e.g. to MPEG transport stream segments. ssegment is a shorter alias for stream_segment.

llogan
  • 63,280
2

There is no option for adding timestamp in ts file using ffmpeg. Only option left is making changes in ffmpeg code. You can modify libavformat/segment.c file. Modify entry->filename variable in segment_file() function.

Alam
  • 146