From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id E1CA942C2E for ; Mon, 2 May 2022 16:52:23 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D686068B1CA; Mon, 2 May 2022 19:52:20 +0300 (EEST) Received: from mail-yw1-f174.google.com (mail-yw1-f174.google.com [209.85.128.174]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1FACB688166 for ; Mon, 2 May 2022 19:52:14 +0300 (EEST) Received: by mail-yw1-f174.google.com with SMTP id 00721157ae682-2f7c57ee6feso154430277b3.2 for ; Mon, 02 May 2022 09:52:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=baX5z1sSqtu3J9UcAOF94Te4JQY32wFRI2AOv4/ddLE=; b=A/08fHXp1nQMpnEhDKkccn2EWg4eM3RzJuW2vNz8JWS3K66wFWznFpzJO1RcwbSAsW m2edX7HFfQDlNosGjX0VEnp6CwadRqrJWsIYyJir1pQZKv05XUHDQ5CbjDAdfKXZdDFq f/r07pNO33RzxgvZocYOAUXE5m+M0EPu25ieQ3xsc6eKkWFhCaUB3YgE9LW3+WY9Tnwt E1kyPa3CYJyY3SFLcC8sHWWT1e5MeoK6sFolRaSf6zsIXofU8rQg+8pcGONhFPhI2Zis r52uMFiQ7K+uNRax8wGk7KJPl3qIKEPKas3MIDYVLB7+upi6KLqEYiqmIvUxXGbmsqtQ wuWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=baX5z1sSqtu3J9UcAOF94Te4JQY32wFRI2AOv4/ddLE=; b=qaYBLac6tktneHbZY15PhIgoWf5BLiKgrg5Kn7ITCHUhsmc5/fAx/EHdRi9VokB7bn lRIthg28kJWvwsfK2NT15lTX0cIMMsm3PzuEoEgIaYGDB+jwPGatTpok57phOtUSL1yx /+2ux7X64gue10vn625WsAoFCWcKf0gdow4VVPjFmiBWVfXINVO0s6obIUW+ZpNlVMXR vXpMrE4c6YNSJtx3TUq0ls7CM0EHmw1+eBUrP8Irx06GbJbORLKbzESWZ5fiYCDvlI7L 5bBlEHKyg+7YYu6og84zERVJURAeaI3qTjTaGxDU2awDFlFSF6FSr0hLwVIg5Mwy0iP0 heAg== X-Gm-Message-State: AOAM533uRPRHgYeRvZMQUcwdHRPDE1/kkCsCb5VBHfsEbddaLk9MU39s pVKF8S5yPzwQjjSb/eceT4ShIOo5s1J28OFgU4q6qPGq X-Google-Smtp-Source: ABdhPJxjbOA8/ZwALOPGolYkqOl+qlkYKw/Prhz7pW2f43nmDZ3wCnV4NKlavBvcQvFnH9hpaQ2BqpS2dNFpDGVEmzU= X-Received: by 2002:a81:5594:0:b0:2f8:f39c:4cfc with SMTP id j142-20020a815594000000b002f8f39c4cfcmr8957642ywb.495.1651510332286; Mon, 02 May 2022 09:52:12 -0700 (PDT) MIME-Version: 1.0 References: <20220421032251.9866-1-gsun@roblox.com> In-Reply-To: <20220421032251.9866-1-gsun@roblox.com> From: Guangyu Sun Date: Mon, 2 May 2022 09:52:01 -0700 Message-ID: To: FFmpeg development discussions and patches X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: Re: [FFmpeg-devel] [PATCH] avformat/oggparsevorbis: Ignore duration of the first packet X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On Wed, Apr 20, 2022 at 8:22 PM Guangyu Sun wrote: > The decoded Data is not returned from the first frame; it must be used > to 'prime' the decode engine. The duration of the first packet should > be ignored also by the container, to make sure the total duration is > trimmed correctly. > > This commit fixes #6367. > > dd if=/dev/zero of=./silence.raw count=1 bs=500 > oggenc --raw silence.raw --output=silence.ogg > oggdec --raw --output silence.oggdec.raw silence.ogg > ffmpeg -codec:a libvorbis -i silence.ogg -f s16le -codec:a pcm_s16le > silence.libvorbis.ffmpeg.raw > ffmpeg -i silence.ogg -f s16le -codec:a pcm_s16le silence.native.ffmpeg.raw > ls -l *.raw > > Signed-off-by: Guangyu Sun > --- > libavformat/oggparsevorbis.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/libavformat/oggparsevorbis.c b/libavformat/oggparsevorbis.c > index 289900f7cf..1f922b3c7e 100644 > --- a/libavformat/oggparsevorbis.c > +++ b/libavformat/oggparsevorbis.c > @@ -479,6 +479,13 @@ static int vorbis_packet(AVFormatContext *s, int idx) > flags = 0; > } > os->pduration = duration; > + /* Data is not returned from the first frame; it must be used to > 'prime' > + * the decode engine. The duration of the first packet should be > ignored > + * also by the container, to make sure the total duration is > trimmed > + * correctly. > + */ > + if ((!os->lastpts || os->lastpts == AV_NOPTS_VALUE) && os->segp > == 1) > + os->pduration = 0; > } > > /* final packet handling > -- > 2.30.1 > > Ping. This patch fixes audio duration mis-match after transcoding a small ogg/vorbis file. Thanks, Guangyu _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".