From patchwork Wed Aug 10 01:54:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sasi Inguva X-Patchwork-Id: 137 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.140.67 with SMTP id o64csp347798vsd; Wed, 10 Aug 2016 05:44:29 -0700 (PDT) X-Received: by 10.194.100.129 with SMTP id ey1mr3752875wjb.60.1470833069696; Wed, 10 Aug 2016 05:44:29 -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 w205si7842014wmb.112.2016.08.10.05.44.28; Wed, 10 Aug 2016 05:44:29 -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 C66E768A488; Wed, 10 Aug 2016 05:59:08 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ua0-f169.google.com (unknown [209.85.217.169]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E3C0F68A445 for ; Wed, 10 Aug 2016 04:55:08 +0300 (EEST) Received: by mail-ua0-f169.google.com with SMTP id k90so48462819uak.1 for ; Tue, 09 Aug 2016 18:55:08 -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=rj1fXBeUSjyG4df49+aSTbhxX5z6aQGmyIJKsSyPwpc=; b=lrCo+xXzISn32S6HtSc4u0OHUXDeUgAEwEsfXV3BHwkwz7e7R31phurPnTjFQbsmyz vrmFH4fmkD3PnqaYoE3V3H/KwOCNrmKZZazQikOsZ3bU70fmEPkjeBbmmCb/MeUZLjBh vvLeJC81ECy4It07Obpfzd/JSunSF23jgAPlKG/za48ZGI78WC8vleEtPVsTqN2FIJoX 0aOu4qg+RwYPd04aAug3f0al36muWV/RamqrfhtBX/SY2hC09rrHpKAkNMQcVdYH1cXO n+V1HD/VoG3xe5c89yuuPcpYZqjvL6iTMXOoZO600/2irH+qfaHxEEthyGBwtmpQyR/S b8ww== 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=rj1fXBeUSjyG4df49+aSTbhxX5z6aQGmyIJKsSyPwpc=; b=ecHZvxHJJZazp52Elqu3C/hkKm7eGb/UeBjCl9Vs7fXx8LC4ugZb6k4GhKHOfiECFP GJ/FVnEmpsAEzi/bZN8Z7fqes7oVpdnE50of0XdIcOrde+Y5XxPXlDcKKLgi/4a4Lwcw KIogjnmBaRGlB9csYxBHD1WmXcvE5SBVYpQymty23yvbBxV8iq4xyqXWA2woIG47j5Wv XDwfGtHO97w0nj1K3yhueiR1KzNZ1Cvsdt5tTS5FxvpVD+sMXYWJnXoBT8gahZtH4mYM 7h2Xp7yboxDBPA0iKq+/tZagAvdFDWbjAiGUFbfXDhyoyOYSaecLXCJIYCVvCIFLpmLD 3gkA== X-Gm-Message-State: AEkooutJfZQ+aCSIlVa7KZNoVRlwuKG2SuyS5bXLjJo5UZsiCoYAT2gxY25qO0NIwF4pt7NQyVeFdPzqjBIUvHvT X-Received: by 10.176.69.228 with SMTP id u91mr764357uau.144.1470794096704; Tue, 09 Aug 2016 18:54:56 -0700 (PDT) MIME-Version: 1.0 Received: by 10.31.190.132 with HTTP; Tue, 9 Aug 2016 18:54:55 -0700 (PDT) In-Reply-To: <20160808150946.GE3781@leki> References: <1470442720-16940-1-git-send-email-isasi@google.com> <20160808150946.GE3781@leki> From: Sasi Inguva Date: Tue, 9 Aug 2016 18:54:55 -0700 Message-ID: To: FFmpeg development discussions and patches X-Content-Filtered-By: Mailman/MimeDel 2.1.20 Subject: Re: [FFmpeg-devel] [PATCH] 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" Oops. I messed up with git send-email, and my message didn't occur in reply to this thread. So, here I am typing in Gmail.. Hi Clement and Michael, Sorry that I hadn't started a discussion on the patch before sending it for review. However this patch has been there for years in our ffmpeg version. I simply made some cosmetic changes to prepare it to send for review, hence I haven't wasted much work/time on it. That said, I think that the code we have, correctly decodes almost 100% of the edit list uploads that we receive and I think will be of good use to others, at least on a temporary basis, until a permanent solution can be agreed upon. As can be seen, the API changes to libav{format/codec/util} are very minor. I've fixed all the fate tests, and you can find in this doc https://docs.google.com/document/d/1V2nWYUcKsKv6uycRnknXzAnGjE3mL YcO_5ti5hLHUn8/pub , justifications of existing fate test reference modifications. I have also separated the patch into 4 patches . I messed up with git send-email so those patches got sent as separate mails. I am attaching them as files anyway here. On Mon, Aug 8, 2016 at 8:09 AM, Clément Bœsch wrote: > Hi, > > On Fri, Aug 05, 2016 at 05:18:39PM -0700, Sasi Inguva wrote: > > In YouTube we have long been receiving MOV files from users, which have > non-trivial edit lists (Those edit lists which are not just used to offset > video start from audio start) and multiple edit lists. Recently the uploads > of such files has increased with the introduction of apps that allow video > editing and upload like Vine etc. mov.c in ffmpeg does not have edit list > parsing support i.e. the support for deciding what video/audio packets > should be output with what timestamps, based on edit lists. For this > reason, we had built a basic support for edit list parsing in our version > of ffmpeg, which fixes the AVIndexEntries built by mov_build_index by > looking at edit lists, and introduces new DISCARD flags in AVPacket and > AVFrame to signal to the decoder to discard certain packets. > > > > For a while our edit list support was broken, as in it didn't properly > work for multiple edit lists and it had problems with edit-lists ending on > B-frames. But we've fixed most of these issues in recent times, and we > think that now it is in a good enough condition so that it can be submitted > to HEAD. This will not only help the vast userbase of ffmepg, but will also > help us with staying up-to-date with ffmpeg and also by adding the power of > ffmpeg developer community to our MOV support. So here's a go at it. > > What is supported: > > - multiple edit lists > > - edit lists ending on B-frames > > - zero segment duration edit lists > > > > What is not supported: > > - Changing the rate of playing with edit lists. We basically ignore > MediaRate field of edit. > > > > I have added fate tests too. Here is a no-sign-in required link to the > test files https://drive.google.com/folderview?id=0Bz6XfEJZ- > 9N3R3o3QXNHUGRqbms&usp=sharing. > > First, thanks for working on this. But it would be much much more > appropriate to discuss such changes with developers before engaging > yourself in such heavy development. As you can guess, this issue has been > discussed many times in the past within the project, and a proper solution > had yet to come out of it. It looks like the approach you took was > dismissed in the past from an infrastructure PoV. > > I will have a look to this patch later this week, but please don't follow > this corporate approach when doing such huge contribution. You're risking > too much by doing so (your work could be dismissed, or worse your work > introduce fundamental issues within the project which we'll take years to > fix because $API) > > You can use the mailing list, or simply IRC to have quick talk with us. > > -- > Clément B. > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > From 2131dfda89a7c013cba353fc8f5de79ccb0c23b5 Mon Sep 17 00:00:00 2001 From: Sasi Inguva Date: Tue, 9 Aug 2016 18:11:57 -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 d8a6cf3..8cf1401 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 07df407..f23d427 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 belive might be affected here #define LIBAVFORMAT_VERSION_MAJOR 57 -#define LIBAVFORMAT_VERSION_MINOR 46 +#define LIBAVFORMAT_VERSION_MINOR 47 #define LIBAVFORMAT_VERSION_MICRO 100 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ -- 2.8.0.rc3.226.g39d4020