From patchwork Sun Jul 29 08:11:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Jan_Ekstr=C3=B6m?= X-Patchwork-Id: 9836 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:104:0:0:0:0:0 with SMTP id c4-v6csp2638958jad; Sun, 29 Jul 2018 01:12:06 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcf9JmqzunK2e/n4+vIHVGImAj8zgiFDXHeJh3zdmNy8oLORhxRMGFcNen6wuhUwryM7qye X-Received: by 2002:a1c:ec86:: with SMTP id h6-v6mr10840439wmi.53.1532851926259; Sun, 29 Jul 2018 01:12:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532851926; cv=none; d=google.com; s=arc-20160816; b=OmCVSrJb/MUTMd3e6BWKKgNAQ+8CQVFnkR3ZESEHiSVGl9TzYNXQJa1iqD7Vn2iqQg VcdO42XmZm7PnTIjoLhjnFdppAjSORBMW5ublHTKfkTdeehgRZGtSaxl+YQrmh231JQ0 Mnog9kmZMXsHNTM6AUkW1D5mwk6nRU/A5m2JV96vpF/pmj7QLFyEWCUXpz0ji3tJyfHq 7A5QUYqqoULYxkfyFo+3eUd6IAzEWTznxLiICLQ4Uh8wCYRsZNmfBLwaQKS2pf4n9S50 aMkjfd9gXrea3TrhEO8SbbVWeCmc+WHcaLSnmL6zZ+cacuoI8ueIUUdlJey451loTJ0j h6yg== 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:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=PR4z1s6isikcpRc+zihmPW2FqVDnf3rLm2tLmGJpWPk=; b=k/K5gzUxx/oivQda+kEzLmuStgyW/sFJ/7K4txf76trjoIt3ECY+enB8767r6aAiAT UdmJ6X2ewVwr4LyqCxH1b7upnMp1Yf0ima/1RyzAMrgxqhnXmJUglxUDP1OvCWnCcYOD epyR5pvGYSVpPvVepEio3NwZ7hjRNEQNVNDYLndarUiCBtAH/eU0uPB78zSL5h2q9nTA 7BgSQT+6jvEngbBgT/cAdXZntEPn7NwuEhC+cT/40HUE7giycfgxH9ukMP1h2CeAQZiI czHl5XSD8rie7DzsNYHNtud/OJHkqLda/1mpSTWRVzI7QVz0v7gDCh4OXqwvI7KbmVXj pFww== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=Or8wmHzL; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id j2-v6si5143536wrb.257.2018.07.29.01.12.05; Sun, 29 Jul 2018 01:12:06 -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=@gmail.com header.s=20161025 header.b=Or8wmHzL; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 44AC668A28A; Sun, 29 Jul 2018 11:11:47 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com [209.85.208.171]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 351ED689CC6 for ; Sun, 29 Jul 2018 11:11:41 +0300 (EEST) Received: by mail-lj1-f171.google.com with SMTP id p6-v6so7836164ljc.5 for ; Sun, 29 Jul 2018 01:11:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=6Q8vjJ3s715Fn8qtvHDdqK9I2BeOUHNu6BJWlgCkUuU=; b=Or8wmHzL8v0YTRCPUCHQTYYWsO1JyUEwhSYlp8NObx+860URGPeYYW/Do6nfmBJ6wH q2VMVfCFXoAzTr1xFJ71bdDKdUK/qCKkvjqJmXSMNvTdFHESUT5gdzLZxrK8WqHgN5Qu pKZGP0holvmYF+7LlPLKIGJjLCRgmY8nSgH1ZToM9Rs2BmhAirVP0mGL8rNFLmrRBskE S3dnABMA+MYg7U+/dPnd8Z1qpbjsc6c8rObccXJ2kbbIqQ0cm6nVFOxoqcqtsi2edIY/ yFaCa6Rb3N/gYMG1B6a+WNMWwq5c1OBuqL0Qiret/8dro4AyQ/oC6gUsq+FJpMXydDOa 6JPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=6Q8vjJ3s715Fn8qtvHDdqK9I2BeOUHNu6BJWlgCkUuU=; b=JDxDKhVRVrXoUtzJD2bKcE8RyJcOqsXNJoAAvGoXOTI7MbrGUctFxUCaDvzYOrykRi gtQ8pd45hjy0an9wI4DP5316klMbrrM7wzsLSUbaTt8SSpeZR9jCnAH/596eUljL9NnH bF8TrkJ9qsLUvJWJJ6Mp53MPgNZCf/9ewiUIhXImOS87tXL5Se3jqBFTP5xQeXMX3Xyc mlRbGopSuvhjBiBqo/xzMc9tVm7wPym5fB0bw5f4hVaIKO3gU5CoNo23hx4bPdjtZI+h RxP3emuXcYeSz+0T96z38T2jzNkvbX3/uAg930itLl4CqjUZZ+bcOj1S+6zPFSgF4Pe5 KlJA== X-Gm-Message-State: AOUpUlGq+8KhNOkW27Fz9zWu47N7jFnS6rWbsrbMF1cExyb+xi5gzfpg aa6gNb04pATXcldIysyU16lhQ2WS X-Received: by 2002:a2e:82cc:: with SMTP id n12-v6mr9393103ljh.58.1532851916599; Sun, 29 Jul 2018 01:11:56 -0700 (PDT) Received: from localhost.localdomain ([2001:999:51:d542:5060:acac:487b:a829]) by smtp.gmail.com with ESMTPSA id p88-v6sm1472261ljp.90.2018.07.29.01.11.55 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 29 Jul 2018 01:11:55 -0700 (PDT) From: =?UTF-8?q?Jan=20Ekstr=C3=B6m?= To: ffmpeg-devel@ffmpeg.org Date: Sun, 29 Jul 2018 11:11:53 +0300 Message-Id: <20180729081153.29602-1-jeebjp@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180725235138.27380-1-jeebjp@gmail.com> References: <20180725235138.27380-1-jeebjp@gmail.com> Subject: [FFmpeg-devel] [PATCH v2] avformat/movenc: implicitly enable negative CTS offsets for ismv 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" ISMV lacks any sort of edit list support, as well as tfxd is effectively the PTS of the fragment for most intents and purposes. Thus, if b-frames are requested without negative CTS offsets you end up with N frames' worth of delay (tfxd PTS plus the CTS offset of the first sample). Negative CTS offsets enable the first sample to have CTS=DTS, and thus a/v desync due to b-frame reorder delay is avoided. --- doc/muxers.texi | 2 ++ libavformat/movenc.c | 2 +- tests/ref/fate/movenc | 4 ++-- tests/ref/lavf/ismv | 6 +++--- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/doc/muxers.texi b/doc/muxers.texi index 33f1f7bbaf..268c152023 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -1344,6 +1344,8 @@ be negative. This enables the initial sample to have DTS/CTS of zero, and reduces the need for edit lists for some cases such as video tracks with B-frames. Additionally, eases conformance with the DASH-IF interoperability guidelines. + +This option is implicitly set when writing ismv (Smooth Streaming) files. @item -write_prft Write producer time reference box (PRFT) with a specified time source for the NTP field in the PRFT box. Set value as @samp{wallclock} to specify timesource diff --git a/libavformat/movenc.c b/libavformat/movenc.c index d530f40cab..14f85eb2a7 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -6049,7 +6049,7 @@ static int mov_init(AVFormatContext *s) /* Set other implicit flags immediately */ if (mov->mode == MODE_ISM) mov->flags |= FF_MOV_FLAG_EMPTY_MOOV | FF_MOV_FLAG_SEPARATE_MOOF | - FF_MOV_FLAG_FRAGMENT; + FF_MOV_FLAG_FRAGMENT | FF_MOV_FLAG_NEGATIVE_CTS_OFFSETS; if (mov->flags & FF_MOV_FLAG_DASH) mov->flags |= FF_MOV_FLAG_FRAGMENT | FF_MOV_FLAG_EMPTY_MOOV | FF_MOV_FLAG_DEFAULT_BASE_MOOF; diff --git a/tests/ref/fate/movenc b/tests/ref/fate/movenc index 872796ebce..5e8f324ea3 100644 --- a/tests/ref/fate/movenc +++ b/tests/ref/fate/movenc @@ -17,10 +17,10 @@ write_data len 20, time nopts, type header atom ftyp write_data len 1171, time nopts, type header atom - write_data len 728, time 0, type sync atom moof write_data len 828, time nopts, type unknown atom - -write_data len 728, time 1013106, type sync atom moof +write_data len 728, time 1046439, type sync atom moof write_data len 812, time nopts, type unknown atom - write_data len 148, time nopts, type trailer atom - -1f37c1a8e01651e8bebcd66f00b6a226 4435 ismv +49bf122c4c732a344ef68b58acd19be5 4435 ismv write_data len 36, time nopts, type header atom ftyp write_data len 1123, time nopts, type header atom - write_data len 796, time 0, type sync atom moof diff --git a/tests/ref/lavf/ismv b/tests/ref/lavf/ismv index f29b5ff3ef..7b4a466096 100644 --- a/tests/ref/lavf/ismv +++ b/tests/ref/lavf/ismv @@ -1,9 +1,9 @@ -a9ccbb4cd1436d222ef4425567b4e03d *./tests/data/lavf/lavf.ismv +96053075a3f60d271131fe2d0765c267 *./tests/data/lavf/lavf.ismv 312542 ./tests/data/lavf/lavf.ismv ./tests/data/lavf/lavf.ismv CRC=0x9d9a638a -440d85f9fd5b9f63c2676638782b5c15 *./tests/data/lavf/lavf.ismv +7022701b4c693bc4ffe1e9f96dd82a02 *./tests/data/lavf/lavf.ismv 321448 ./tests/data/lavf/lavf.ismv ./tests/data/lavf/lavf.ismv CRC=0xe8130120 -a9ccbb4cd1436d222ef4425567b4e03d *./tests/data/lavf/lavf.ismv +96053075a3f60d271131fe2d0765c267 *./tests/data/lavf/lavf.ismv 312542 ./tests/data/lavf/lavf.ismv ./tests/data/lavf/lavf.ismv CRC=0x9d9a638a