[FFmpeg-devel] [PATCH 01/11] avformat/dashenc: renamed 'min_seg_duration' to 'seg_duration'

Dixit, Vishwanath vdixit at akamai.com
Wed Apr 4 11:56:31 EEST 2018



On 3/23/18 7:22 PM, Aurelien Jacobs wrote:
> On Fri, Mar 23, 2018 at 02:32:30PM +0800, Steven Liu wrote:
>>
>>
>>> On 23 Mar 2018, at 13:20, vdixit at akamai.com wrote:
>>>
>>> From: Vishwanath Dixit <vdixit at akamai.com>
>>>
>>> ---
>>> doc/muxers.texi       |  2 +-
>>> libavformat/dashenc.c | 10 +++++-----
>>> 2 files changed, 6 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/doc/muxers.texi b/doc/muxers.texi
>>> index cb75c26..65eec92 100644
>>> --- a/doc/muxers.texi
>>> +++ b/doc/muxers.texi
>>> @@ -225,7 +225,7 @@ ffmpeg -re -i <input> -map 0 -map 0 -c:a libfdk_aac -c:v libx264
>>> @end example
>>>
>>> @table @option
>>> - at item -min_seg_duration @var{microseconds}
>>> + at item -seg_duration @var{microseconds}
>>> Set the segment length in microseconds.
>>> @item -window_size @var{size}
>>> Set the maximum number of segments kept in the manifest.
>>> diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
>>> index bdf8c8d..bdd5b56 100644
>>> --- a/libavformat/dashenc.c
>>> +++ b/libavformat/dashenc.c
>>> @@ -94,7 +94,7 @@ typedef struct DASHContext {
>>>     int nb_as;
>>>     int window_size;
>>>     int extra_window_size;
>>> -    int min_seg_duration;
>>> +    int seg_duration;
>>>     int remove_at_exit;
>>>     int use_template;
>>>     int use_timeline;
>>> @@ -974,7 +974,7 @@ static int dash_init(AVFormatContext *s)
>>>             else
>>>                 av_dict_set(&opts, "movflags", "frag_custom+dash+delay_moov", 0);
>>>         } else {
>>> -            av_dict_set_int(&opts, "cluster_time_limit", c->min_seg_duration / 1000, 0);
>>> +            av_dict_set_int(&opts, "cluster_time_limit", c->seg_duration / 1000, 0);
>>>             av_dict_set_int(&opts, "cluster_size_limit", 5 * 1024 * 1024, 0); // set a large cluster size limit
>>>             av_dict_set_int(&opts, "dash", 1, 0);
>>>             av_dict_set_int(&opts, "dash_track_number", i + 1, 0);
>>> @@ -1020,7 +1020,7 @@ static int dash_init(AVFormatContext *s)
>>>         os->segment_index = 1;
>>>     }
>>>
>>> -    if (!c->has_video && c->min_seg_duration <= 0) {
>>> +    if (!c->has_video && c->seg_duration <= 0) {
>>>         av_log(s, AV_LOG_WARNING, "no video stream and no min seg duration set\n");
>>>         return AVERROR(EINVAL);
>>>     }
>>> @@ -1287,7 +1287,7 @@ static int dash_write_packet(AVFormatContext *s, AVPacket *pkt)
>>>     if ((!c->has_video || st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) &&
>>>         pkt->flags & AV_PKT_FLAG_KEY && os->packets_written &&
>>>         av_compare_ts(pkt->pts - os->start_pts, st->time_base,
>>> -                      c->min_seg_duration, AV_TIME_BASE_Q) >= 0) {
>>> +                      c->seg_duration, AV_TIME_BASE_Q) >= 0) {
>>>         int64_t prev_duration = c->last_duration;
>>>
>>>         c->last_duration = av_rescale_q(pkt->pts - os->start_pts,
>>> @@ -1427,7 +1427,7 @@ static const AVOption options[] = {
>>>     { "adaptation_sets", "Adaptation sets. Syntax: id=0,streams=0,1,2 id=1,streams=3,4 and so on", OFFSET(adaptation_sets), AV_OPT_TYPE_STRING, { 0 }, 0, 0, AV_OPT_FLAG_ENCODING_PARAM },
>>>     { "window_size", "number of segments kept in the manifest", OFFSET(window_size), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, E },
>>>     { "extra_window_size", "number of segments kept outside of the manifest before removing from disk", OFFSET(extra_window_size), AV_OPT_TYPE_INT, { .i64 = 5 }, 0, INT_MAX, E },
>>> -    { "min_seg_duration", "minimum segment duration (in microseconds)", OFFSET(min_seg_duration), AV_OPT_TYPE_INT, { .i64 = 5000000 }, 0, INT_MAX, E },
>>> +    { "seg_duration", "minimum segment duration (in microseconds)", OFFSET(seg_duration), AV_OPT_TYPE_INT, { .i64 = 5000000 }, 0, INT_MAX, E },
>>
>> No, you can make the min_seg_duration deprecated, leave a warning message, update the info into the document, and add set_duration here, bump the version.
>> So that can give the user some time to change the options from min_seg_duration to seg_duration.
>
> This is probably also a good oportunity to change seg_duration to
> AV_OPT_TYPE_DURATION.
Thanks for this input. I have made the suggested update. Revised patch is here: https://patchwork.ffmpeg.org/patch/8311/ 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel





More information about the ffmpeg-devel mailing list