From patchwork Wed Apr 4 08:36:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Dixit, Vishwanath" X-Patchwork-Id: 8311 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.1.70 with SMTP id c67csp4618624jad; Wed, 4 Apr 2018 01:36:59 -0700 (PDT) X-Google-Smtp-Source: AIpwx49whJkc6esGVh7XddLNClEhaXLOLZWdidWJas0UGmWVTx0PmsKL4XopezkmbbnSQQ+jlmhy X-Received: by 10.28.85.200 with SMTP id j191mr7070887wmb.127.1522831019402; Wed, 04 Apr 2018 01:36:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522831019; cv=none; d=google.com; s=arc-20160816; b=xmjIHHm2VF1uAgCBaGOeBzRP/LzgLxBcINGwGT51EiUy2w25pBoaRRPGasVs/wILUc LvuNuQCXi4K4iZikjf6x68WFjf3Fw4TIgOiWds3IxN08O4GPHVZcS1fkavH/ZTMtILi2 hcV+4DjS5Ydfl09gSZgeqGekFGg0VFlhiQok7k+OB8cCmk//J1J0n0jJpf80h3YaSyUo 8sAP4Xqhi8XnU/nK/E1I81xaE0golx9bQJ9cxLFOdo62BwAJiKHjkH5gGBmXo+RnIRjv t8jx+9LMHScpoXfQBqMHeGIeXe9UenzPL5IFmyl7H5tzCoAQK2mNeluVOlNW+Z9ea6it /kSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:feedback-id:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=3uCeW8Sz7Id5kpUacUy4Bnj6PD0y/uNuLqenrXy21ek=; b=o5PZWwfNmruBxmFMU3DE2FEDKEmbLVV2Qx3ExYdFFsDJ4qLDD7Yyjx3e0sikLvAzAQ p3ILtOoRIiHpBVK892++TTz9KYDq+jbTeOiFRaXLBDMicCjbQQZstvWYud+Au9uu23SF C+e7w3OcOi/CZlhn0bujJuMrdGd4J+a4JH8cUZEjygVJMMLhtgkN57VC0oMRUoTReobr O8wSMWc5hHQ6pqGExA3yF4tqblr26jrCK4uyZt5JsdCw+DmzATcCNjvixuNsU9I73VTP J5Xwizq+wcFhxlLMooDM9bNErcgONFrPgwDFrRM8Ly77mMIvV8Rwq0qRnJ5l9ZPfQY30 YNjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@smtpservice.net header.s=m78bu0.a1-4.dyn header.b=tyPMou/T; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=akamai.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 37si3102876wrb.350.2018.04.04.01.36.58; Wed, 04 Apr 2018 01:36:59 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@smtpservice.net header.s=m78bu0.a1-4.dyn header.b=tyPMou/T; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=akamai.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 32DE36891FC; Wed, 4 Apr 2018 11:36:35 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from a1i318.smtp2go.com (a1i318.smtp2go.com [43.228.185.62]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1753C680C0B for ; Wed, 4 Apr 2018 11:36:28 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=smtpservice.net; s=m78bu0.a1-4.dyn; x=1522831914; h=Feedback-ID: X-Smtpcorp-Track:Message-Id:Date:Subject:To:From:Reply-To:Sender: List-Unsubscribe; bh=+DjHb8mjzO40rZ2xpMJh0fFZlesHVwqlkAvxHK2qhjY=; b=tyPMou/T tgJrLFuMMNGoCvpb0UGFAsEmjWmtWUgvKQrXRpn9AhUOt0Xeu7FglgDeejMTzY1a6VFaeClcD0Ssw v2j8rhUYQuQswei+cTPYeHzXdf+x63xFejZrZbMZsx2AWSbZSJE31IlmG0tgDIslfeqwwEXIAWCHG fegHRrbUoztKBgTp5g7t6NE0oWMCQ4Ovx4c1uGXHLa0ksbvcHZitlsaUom4qa8vcaSYPdmiNmwUfi iQDgtN/gYsvNz2DSdOajcvXvwLo/G+1FCpbbEAqij1mXm8brwE2gvaXX86C1X9gaPoRINfY38s6F0 fAiQoylHppryaz7QBJqYfPGGwg==; From: vdixit@akamai.com To: ffmpeg-devel@ffmpeg.org Date: Wed, 4 Apr 2018 14:06:28 +0530 Message-Id: <1522830988-6811-1-git-send-email-vdixit@akamai.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <20180323135220.c2r5jywbpqujad42@gnuage.org> References: <20180323135220.c2r5jywbpqujad42@gnuage.org> X-Smtpcorp-Track: 1f3dIODIIcRYF-.xu6dPl09J Feedback-ID: 337386m:337386asVRLGB:337386saZN3qIJYK:SMTPCORP X-Report-Abuse: Please forward a copy of this message, including all headers, to Subject: [FFmpeg-devel] [PATCH v2 01/11] avformat/dashenc: replacing 'min_seg_duration' with 'seg_duration' X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Vishwanath Dixit MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Vishwanath Dixit --- doc/muxers.texi | 4 +++- libavformat/dashenc.c | 17 ++++++++++++----- libavformat/version.h | 2 +- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/doc/muxers.texi b/doc/muxers.texi index cb75c26..a5358e3 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -226,7 +226,9 @@ ffmpeg -re -i -map 0 -map 0 -c:a libfdk_aac -c:v libx264 @table @option @item -min_seg_duration @var{microseconds} -Set the segment length in microseconds. +Set the segment length in microseconds (will be deprecated, use @var{seg_duration} instead). +@item -seg_duration @var{duration} +Set the segment length in seconds (fractional value can be set). @item -window_size @var{size} Set the maximum number of segments kept in the manifest. @item -extra_window_size @var{size} diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index bdf8c8d..8ef8627 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -95,6 +95,7 @@ typedef struct DASHContext { int window_size; int extra_window_size; int min_seg_duration; + int64_t seg_duration; int remove_at_exit; int use_template; int use_timeline; @@ -871,6 +872,11 @@ static int dash_init(AVFormatContext *s) if (c->single_file) c->use_template = 0; + if (c->min_seg_duration != 5000000) { + av_log(s, AV_LOG_WARNING, "The min_seg_duration option is deprecated and will be removed. Please use the -seg_duration\n"); + c->seg_duration = c->min_seg_duration; + } + av_strlcpy(c->dirname, s->url, sizeof(c->dirname)); ptr = strrchr(c->dirname, '/'); if (ptr) { @@ -974,7 +980,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,8 +1026,8 @@ static int dash_init(AVFormatContext *s) os->segment_index = 1; } - if (!c->has_video && c->min_seg_duration <= 0) { - av_log(s, AV_LOG_WARNING, "no video stream and no min seg duration set\n"); + if (!c->has_video && c->seg_duration <= 0) { + av_log(s, AV_LOG_WARNING, "no video stream and no seg duration set\n"); return AVERROR(EINVAL); } return 0; @@ -1287,7 +1293,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 +1433,8 @@ 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 }, + { "min_seg_duration", "minimum segment duration (in microseconds) (will be deprecated)", OFFSET(min_seg_duration), AV_OPT_TYPE_INT, { .i64 = 5000000 }, 0, INT_MAX, E }, + { "seg_duration", "segment duration (in seconds, fractional value can be set)", OFFSET(seg_duration), AV_OPT_TYPE_DURATION, { .i64 = 5000000 }, 0, INT_MAX, E }, { "remove_at_exit", "remove all segments when finished", OFFSET(remove_at_exit), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, E }, { "use_template", "Use SegmentTemplate instead of SegmentList", OFFSET(use_template), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, E }, { "use_timeline", "Use SegmentTimeline in SegmentTemplate", OFFSET(use_timeline), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, E }, diff --git a/libavformat/version.h b/libavformat/version.h index e28a9e7..aca592b 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -33,7 +33,7 @@ // Also please add any ticket numbers that you believe might be affected here #define LIBAVFORMAT_VERSION_MAJOR 58 #define LIBAVFORMAT_VERSION_MINOR 10 -#define LIBAVFORMAT_VERSION_MICRO 100 +#define LIBAVFORMAT_VERSION_MICRO 101 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ LIBAVFORMAT_VERSION_MINOR, \