From patchwork Fri Aug 26 19:49:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasi Inguva X-Patchwork-Id: 311 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.140.134 with SMTP id o128csp559803vsd; Fri, 26 Aug 2016 12:49:48 -0700 (PDT) X-Received: by 10.28.176.5 with SMTP id z5mr448944wme.47.1472240988043; Fri, 26 Aug 2016 12:49:48 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id m133si539625wma.144.2016.08.26.12.49.47; Fri, 26 Aug 2016 12:49:47 -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=@google.com; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DF174689A4D; Fri, 26 Aug 2016 22:49:31 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ua0-f179.google.com (mail-ua0-f179.google.com [209.85.217.179]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 01ABB6897AC for ; Fri, 26 Aug 2016 22:49:18 +0300 (EEST) Received: by mail-ua0-f179.google.com with SMTP id m60so115082818uam.3 for ; Fri, 26 Aug 2016 12:49:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=6sMwS2iXNl4QDfqCzAiVB6Z6t6j3nd34XaB/acYFsgY=; b=KiRmn642VONiCLLbBkOYFyt6iBiVfiIVBaRycC9PPXmDtZeGAxcJAavJj+H9NBHzLM czxUgKYPByEcVC/BAXeMZLoSW91HXXyLBi6mdlAx/1mvkiXUI8hitqtGO3eHrm/ZoEmO UPvYStVPUMjv15gS5NrBw0b3T0CR1QtilsFI1Iy/3Tz33eFtpYWDFhMhlrq7OhryfpHt w4pvzJk/UI8VElUYpFntJMyvncsirVMay0+HdndyVxEm9480EGAzXW4hzPBj0mJNgBiu /4P1ycg3oqpkL3Kea46/qE+tHSkcJj9eH7iZotzQL2HBClKBPSCK+587MRTxVrdGe87y Ml4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=6sMwS2iXNl4QDfqCzAiVB6Z6t6j3nd34XaB/acYFsgY=; b=eacGsyBh50kD8IzdXhiRicARsGsWcEj7VrkLyNoLzFjV2KV8LcZgWSvCtgxgoPW+Q+ mIIV6w15LZKBWVXgi30R0DCDed6krU45xs6ddU8T1GgYO6rWgTqdheTkjf58/5Jv/+8q I1N1KADHnFNctqngLnj4FFI+mX+NJbGF7WhLbznBsLf1xA9vGB45a3jvkoQPVTi/x+x0 sFc0xMHqOg8CF1dtEMQrYWv9xgnkBoO0UIeGbyrtCjV6CFbU0fbVLjHSgJjuiTqMttJC UJDdBX2J36vf+nud0btXg24t6UctB7rHF9NHuwVQ5oxTCtyaoYq3VAj13FxsXhin5ssE 62sw== X-Gm-Message-State: AE9vXwOGpWsXgaPSxGPTrLoOAelXB12HQPUuHet1iW60XVvO3tMzu5IA4EptlfGSSzXSW7faxBoT8o32A1mksSLZ X-Received: by 10.176.4.11 with SMTP id 11mr3413270uav.66.1472240960446; Fri, 26 Aug 2016 12:49:20 -0700 (PDT) MIME-Version: 1.0 Received: by 10.31.153.207 with HTTP; Fri, 26 Aug 2016 12:49:19 -0700 (PDT) In-Reply-To: <20160825220105.GF5460@nb4> References: <20160814132424.GB26860@leki> <1471313097-26998-1-git-send-email-isasi@google.com> <1471313097-26998-2-git-send-email-isasi@google.com> <20160824230109.GP5460@nb4> <20160825023726.GR5460@nb4> <20160825220105.GF5460@nb4> From: Sasi Inguva Date: Fri, 26 Aug 2016 12:49:19 -0700 Message-ID: To: FFmpeg development discussions and patches X-Content-Filtered-By: Mailman/MimeDel 2.1.20 Subject: Re: [FFmpeg-devel] [PATCH 4/4] lavf/mov: Add support for edit list parsing. 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" I think there is some bug in mp3 decoder which is making skip samples -1431655766 for ~/tickets/5528/fire.mp3 . For now I have removed the assert from the 3rd commit. For the file one.mov , I think the audio has edit list with start time correspending to the second sample - (which should be media time 1024 if I guess correctly). This indicates that the first sample be used for encoder delay. Previously without edit list parsing , we used to offset the start_dts by -1024 to make the second sample timestamp start from zero. sc->time_offset = start_time - empty_duration; - current_dts = -sc->time_offset; if (sc->ctts_count>0 && sc->stts_count>0 && But now edit list parsing handles the rebasing of timestamps to zero, because it will assign increasing timestamps starting from zero, to samples present in the edit list. Because the first sample is not in the edit list, we mark it as DISCARD, which flag av_decode_audio4 will look at and decode-and-discard that frame. So it wouldn't matter what the first sample timestamp should be assigned because it is anyway discarded after decode. I am sure when you do ./ffprobe -show_frames -print_format compact one.mov , you won't get the first audio sample at all and second audio sample will start from zero timestamp. If I can get a link to the file, I can get a deeper look but I am almost sure that this is what is happening. Attaching the modified 3rd patch again. On Thu, Aug 25, 2016 at 3:01 PM, Michael Niedermayer wrote: > On Thu, Aug 25, 2016 at 12:31:19PM -0700, Sasi Inguva wrote: > > oops. thanks for pointing that out. Even in our version of ffmpeg, that > > assert doesn't get compiled so we never catched it. That assert logic is > > not correct anymore. At the end of one edit list there can be frames > marked > > as discard, for which we would keep increasing the timestamp even if they > > are marked as discard, so that when the timestamps are rerodered to > compute > > PTS B-frames get the correct PTS. But the next edit list should always > > start with the timestamp of the last-non-discarded frame of the previous > > edit list. Hence we will get non-increasing timestamps added as index > > entries. > > > > The test may have passed for you before, because before that line was > > assert(..) instead of av_assert1(...) so maybe that line wasn't getting > > compiled before. Attaching the 4 patches again. > > patchset breaks timestamps for audio: > ./ffmpeg -i matrixbench_mpeg2.mpg -t 0.1 one.mov > ./ffprobe -show_packets -print_format compact one.mov > packet|codec_type=video|stream_index=0|pts=0|pts_time= > 0.000000|dts=-1024|dts_time=-0.080000|duration=512|duration_time=0.040000| > convergence_duration=N/A|convergence_duration_time=N/A| > size=9368|pos=36|flags=K > packet|codec_type=video|stream_index=0|pts=1024|pts_ > time=0.080000|dts=-512|dts_time=-0.040000|duration=512| > duration_time=0.040000|convergence_duration=N/A| > convergence_duration_time=N/A|size=2190|pos=9404|flags=_ > packet|codec_type=audio|stream_index=1|pts=0|pts_time= > 0.000000|dts=0|dts_time=0.000000|duration=N/A|duration_ > time=N/A|convergence_duration=N/A|convergence_duration_time= > N/A|size=323|pos=11594|flags=K > packet|codec_type=video|stream_index=0|pts=512|pts_ > time=0.040000|dts=0|dts_time=0.000000|duration=512|duration_time=0.040000| > convergence_duration=N/A|convergence_duration_time=N/A| > size=1328|pos=11894|flags=_ > packet|codec_type=audio|stream_index=1|pts=0|pts_time= > 0.000000|dts=0|dts_time=0.000000|duration=1024|duration_ > time=0.021333|convergence_duration=N/A|convergence_ > duration_time=N/A|size=261|pos=13222|flags=K > > if you look at the audio stream 2 packets have the same pts, that > looks wrong, previously the first packet had -1024 > > [...] > > > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > I do not agree with what you have to say, but I'll defend to the death your > right to say it. -- Voltaire > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > From 4f91db6f34070f0e02ce224badaffa8c4d69d900 Mon Sep 17 00:00:00 2001 From: Sasi Inguva Date: Wed, 24 Aug 2016 18:30:01 -0700 Subject: [PATCH 2/4] avformat/avframe.h: Add a flag in AVIndexEntry to discard frame after decoding. Signed-off-by: Sasi Inguva --- libavformat/avformat.h | 3 +++ libavformat/version.h | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 3ee7051..d943ae1 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -814,6 +814,9 @@ typedef struct AVIndexEntry { * is known */ #define AVINDEX_KEYFRAME 0x0001 +#define AVINDEX_DISCARD_FRAME 0x0002 /** + * Flag is used to indicate which frame should be discarded after decoding. + */ int flags:2; int size:30; //Yeah, trying to keep the size of this small to reduce memory requirements (it is 24 vs. 32 bytes due to possible 8-byte alignment). int min_distance; /**< Minimum distance between this and the previous keyframe, used to avoid unneeded searching. */ diff --git a/libavformat/version.h b/libavformat/version.h index 88fd4cc..34226ca 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -32,7 +32,7 @@ // Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium) // Also please add any ticket numbers that you believe might be affected here #define LIBAVFORMAT_VERSION_MAJOR 57 -#define LIBAVFORMAT_VERSION_MINOR 48 +#define LIBAVFORMAT_VERSION_MINOR 49 #define LIBAVFORMAT_VERSION_MICRO 100 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ -- 2.8.0.rc3.226.g39d4020