mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-28 20:53:54 +02:00
avformat/hlsenc: rename option from use_localtime to strftime
fix ticket: 7393 indent option name to segment Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
This commit is contained in:
parent
17c635e605
commit
fbd8746efa
@ -617,7 +617,7 @@ This example will produce the playlist, @file{out.m3u8}, and segment files:
|
||||
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.
|
||||
When strftime_mkdir is set, the whole expanded value of @var{filename} will be written into the m3u8 segment list.
|
||||
|
||||
When @code{var_stream_map} is set with two or more variant streams, the
|
||||
@var{filename} pattern must contain the string "%v", this string specifies
|
||||
@ -646,34 +646,40 @@ This example will produce the playlists segment file sets:
|
||||
@file{vs1/file_000.ts}, @file{vs1/file_001.ts}, @file{vs1/file_002.ts}, etc.
|
||||
|
||||
@item use_localtime
|
||||
Same as strftime option, will be deprecated.
|
||||
|
||||
@item strftime
|
||||
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
|
||||
ffmpeg -i in.nut -strftime 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
|
||||
ffmpeg -i in.nut -strftime 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 all subdirectories which
|
||||
Same as strftime_mkdir option, will be deprecated .
|
||||
|
||||
@item strftime_mkdir
|
||||
Used together with -strftime_mkdir, 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
|
||||
ffmpeg -i in.nut -strftime 1 -strftime_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{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
|
||||
ffmpeg -i in.nut -strftime 1 -strftime_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:
|
||||
@ -833,24 +839,24 @@ 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.
|
||||
besides date/time values when strftime 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.
|
||||
expression besides date/time values when strftime 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.
|
||||
expression besides date/time values when strftime is on.
|
||||
To get fixed width numbers with trailing zeroes, %%0xt format is available where x is the required width.
|
||||
|
||||
@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
|
||||
-strftime 1 -strftime_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.
|
||||
|
@ -877,17 +877,17 @@ static int sls_flag_check_duration_size_index(HLSContext *hls)
|
||||
|
||||
if (hls->flags & HLS_SECOND_LEVEL_SEGMENT_DURATION) {
|
||||
av_log(hls, AV_LOG_ERROR,
|
||||
"second_level_segment_duration hls_flag requires use_localtime to be true\n");
|
||||
"second_level_segment_duration hls_flag requires strftime to be true\n");
|
||||
ret = AVERROR(EINVAL);
|
||||
}
|
||||
if (hls->flags & HLS_SECOND_LEVEL_SEGMENT_SIZE) {
|
||||
av_log(hls, AV_LOG_ERROR,
|
||||
"second_level_segment_size hls_flag requires use_localtime to be true\n");
|
||||
"second_level_segment_size hls_flag requires strfime to be true\n");
|
||||
ret = AVERROR(EINVAL);
|
||||
}
|
||||
if (hls->flags & HLS_SECOND_LEVEL_SEGMENT_INDEX) {
|
||||
av_log(hls, AV_LOG_ERROR,
|
||||
"second_level_segment_index hls_flag requires use_localtime to be true\n");
|
||||
"second_level_segment_index hls_flag requires strftime to be true\n");
|
||||
ret = AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
@ -1513,7 +1513,7 @@ static int hls_start(AVFormatContext *s, VariantStream *vs)
|
||||
vs->basename, 'd', vs->sequence) < 1) {
|
||||
#endif
|
||||
av_free(filename);
|
||||
av_log(oc, AV_LOG_ERROR, "Invalid segment filename template '%s', you can try to use -use_localtime 1 with it\n", vs->basename);
|
||||
av_log(oc, AV_LOG_ERROR, "Invalid segment filename template '%s', you can try to use -strftime 1 with it\n", vs->basename);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
ff_format_set_url(oc, filename);
|
||||
@ -1529,7 +1529,7 @@ static int hls_start(AVFormatContext *s, VariantStream *vs)
|
||||
tm = localtime_r(&now0, &tmpbuf);
|
||||
ff_format_set_url(oc, buf);
|
||||
if (!strftime(oc->url, bufsize, vs->basename, tm)) {
|
||||
av_log(oc, AV_LOG_ERROR, "Could not get segment filename with use_localtime\n");
|
||||
av_log(oc, AV_LOG_ERROR, "Could not get segment filename with strftime\n");
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
@ -1561,7 +1561,7 @@ static int hls_start(AVFormatContext *s, VariantStream *vs)
|
||||
vs->basename, 'd', vs->sequence) < 1) {
|
||||
#endif
|
||||
av_free(filename);
|
||||
av_log(oc, AV_LOG_ERROR, "Invalid segment filename template '%s' you can try to use -use_localtime 1 with it\n", vs->basename);
|
||||
av_log(oc, AV_LOG_ERROR, "Invalid segment filename template '%s' you can try to use -strftime 1 with it\n", vs->basename);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
ff_format_set_url(oc, filename);
|
||||
@ -2863,8 +2863,14 @@ static const AVOption options[] = {
|
||||
{"second_level_segment_size", "include segment size in segment filenames when use_localtime", 0, AV_OPT_TYPE_CONST, {.i64 = HLS_SECOND_LEVEL_SEGMENT_SIZE }, 0, UINT_MAX, E, "flags"},
|
||||
{"periodic_rekey", "reload keyinfo file periodically for re-keying", 0, AV_OPT_TYPE_CONST, {.i64 = HLS_PERIODIC_REKEY }, 0, UINT_MAX, E, "flags"},
|
||||
{"independent_segments", "add EXT-X-INDEPENDENT-SEGMENTS, whenever applicable", 0, AV_OPT_TYPE_CONST, { .i64 = HLS_INDEPENDENT_SEGMENTS }, 0, UINT_MAX, E, "flags"},
|
||||
{"use_localtime", "set filename expansion with strftime at segment creation", OFFSET(use_localtime), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, E },
|
||||
{"use_localtime_mkdir", "create last directory component in strftime-generated filename", OFFSET(use_localtime_mkdir), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, E },
|
||||
#if FF_API_HLS_USE_LOCALTIME
|
||||
{"use_localtime", "set filename expansion with strftime at segment creation(will be deprecated )", OFFSET(use_localtime), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, E },
|
||||
#endif
|
||||
{"strftime", "set filename expansion with strftime at segment creation", OFFSET(use_localtime), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, E },
|
||||
#if FF_API_HLS_USE_LOCALTIME
|
||||
{"use_localtime_mkdir", "create last directory component in strftime-generated filename(will be deprecated)", OFFSET(use_localtime_mkdir), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, E },
|
||||
#endif
|
||||
{"strftime_mkdir", "create last directory component in strftime-generated filename", OFFSET(use_localtime_mkdir), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, E },
|
||||
{"hls_playlist_type", "set the HLS playlist type", OFFSET(pl_type), AV_OPT_TYPE_INT, {.i64 = PLAYLIST_TYPE_NONE }, 0, PLAYLIST_TYPE_NB-1, E, "pl_type" },
|
||||
{"event", "EVENT playlist", 0, AV_OPT_TYPE_CONST, {.i64 = PLAYLIST_TYPE_EVENT }, INT_MIN, INT_MAX, E, "pl_type" },
|
||||
{"vod", "VOD playlist", 0, AV_OPT_TYPE_CONST, {.i64 = PLAYLIST_TYPE_VOD }, INT_MIN, INT_MAX, E, "pl_type" },
|
||||
|
@ -32,8 +32,8 @@
|
||||
// Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium)
|
||||
// Also please add any ticket numbers that you believe might be affected here
|
||||
#define LIBAVFORMAT_VERSION_MAJOR 58
|
||||
#define LIBAVFORMAT_VERSION_MINOR 17
|
||||
#define LIBAVFORMAT_VERSION_MICRO 106
|
||||
#define LIBAVFORMAT_VERSION_MINOR 18
|
||||
#define LIBAVFORMAT_VERSION_MICRO 100
|
||||
|
||||
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
|
||||
LIBAVFORMAT_VERSION_MINOR, \
|
||||
@ -70,6 +70,9 @@
|
||||
#ifndef FF_API_HLS_WRAP
|
||||
#define FF_API_HLS_WRAP (LIBAVFORMAT_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_HLS_USE_LOCALTIME
|
||||
#define FF_API_HLS_USE_LOCALTIME (LIBAVFORMAT_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_LAVF_KEEPSIDE_FLAG
|
||||
#define FF_API_LAVF_KEEPSIDE_FLAG (LIBAVFORMAT_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user