[FFmpeg-devel] [PATCH 1/2] avformat/hlsenc: add hls_segment_options correct the segment options name

Steven Liu lq at chinaffmpeg.org
Wed Nov 17 13:34:44 EET 2021


From: Steven Liu <liuqi05 at kuaishou.com>

Because the hls_ts_options will be misunderstand by user that only can
be used in mpegts segments option. So add this option for segments.

Signed-off-by: Steven Liu <liuqi05 at kuaishou.com>
---
 doc/muxers.texi      | 4 ++++
 libavformat/hlsenc.c | 1 +
 2 files changed, 5 insertions(+)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index 7eee8c1be6..287ea569fd 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -919,6 +919,10 @@ This example will create a directory hierarchy 2016/02/15 (if any of them do not
 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.
 
+ at item hls_segment_options @var{options_list}
+Set output format options using a :-separated list of key=value
+parameters. Values containing @code{:} special characters must be
+escaped.
 
 @item hls_key_info_file @var{key_info_file}
 Use the information in @var{key_info_file} for segment encryption. The first
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 98608a834a..db0a4675fd 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -3107,6 +3107,7 @@ static const AVOption options[] = {
     {"hls_allow_cache", "explicitly set whether the client MAY (1) or MUST NOT (0) cache media segments", OFFSET(allowcache), AV_OPT_TYPE_INT, {.i64 = -1}, INT_MIN, INT_MAX, E},
     {"hls_base_url",  "url to prepend to each playlist entry",   OFFSET(baseurl), AV_OPT_TYPE_STRING, {.str = NULL},  0, 0,       E},
     {"hls_segment_filename", "filename template for segment files", OFFSET(segment_filename),   AV_OPT_TYPE_STRING, {.str = NULL},            0,       0,         E},
+    {"hls_segment_options","set segments files format options of hls", OFFSET(format_options), AV_OPT_TYPE_DICT, {.str = NULL},  0, 0,    E},
     {"hls_segment_size", "maximum size per segment file, (in bytes)",  OFFSET(max_seg_size),    AV_OPT_TYPE_INT,    {.i64 = 0},               0,       INT_MAX,   E},
     {"hls_key_info_file",    "file with key URI and key file path", OFFSET(key_info_file),      AV_OPT_TYPE_STRING, {.str = NULL},            0,       0,         E},
     {"hls_enc",    "enable AES128 encryption support", OFFSET(encrypt),      AV_OPT_TYPE_BOOL, {.i64 = 0},            0,       1,         E},
-- 
2.25.0



More information about the ffmpeg-devel mailing list