From patchwork Wed Aug 24 14:55:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derek Buitenhuis X-Patchwork-Id: 282 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.140.134 with SMTP id o128csp419399vsd; Wed, 24 Aug 2016 08:11:06 -0700 (PDT) X-Received: by 10.194.186.166 with SMTP id fl6mr3222472wjc.44.1472051466559; Wed, 24 Aug 2016 08:11:06 -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 z207si26796473wmc.40.2016.08.24.08.11.02; Wed, 24 Aug 2016 08:11: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; 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 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 055F3689A53; Wed, 24 Aug 2016 18:10:55 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DCAA5689933 for ; Wed, 24 Aug 2016 18:09:42 +0300 (EEST) Received: by mail-wm0-f65.google.com with SMTP id i138so3051748wmf.3 for ; Wed, 24 Aug 2016 08:09:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=tr580DGVsvNYZXGvLBgW9jYo2zZ2AV57lGLeq3EXlPE=; b=UBYitxdClEeLpPpZ3btTGPtnrU+GqVqHGb+CjuQOkKCjsbtgsvQsIXkjfB4trRVUfT GVrjim4LuDSjEJug79gYicBcsU+kCquGtsCejNsi6OwZJjQ4cS1Naj8BlhkJ9ztZc3ra Duh2BCaJ+4lBBo+KAA4RxXTNaMKbfC8oL89HL9o1iLtsZKzi8dN9lEcFs8uHs56DWh6G 8Xt2dK7ygvfwv6Lq951P0R7G8wXiveK2pHCDWf/ZDUvgKbnqA+SvX6+CZxwkw1zBzKZA W0jkbNGBN3CPHt/3z7RGzqhyLa6AbIy1ZdsQ/LTVW1TtnDZwtCVgKaiWKDv6Yuabmw9a NNkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=tr580DGVsvNYZXGvLBgW9jYo2zZ2AV57lGLeq3EXlPE=; b=lZXCGIBZgXptW+EZSuwiyhZtXXJpQqRfm3iY9U7QvQxUx+a9r9sRNXbGJa86jaMCaI 3j9hnhTvfWhDVtQUmUwndtHx5Ot4kMNkb6KxiRP/3kPdMpFxdwBLJePg5OF4VN/7KHiq l4ZYDEURWjqkOV7TRMrlrnfxc2tDplmLijpWAkNTTzPeMqxymVJr2E7sICJWnfIjo1uc +Frw0NGQID0QIUherruJHKxnAWDIgvUbs6aQUh+xAgMS2UIz/um7KIgzX5kV2u4mYbvs Ec5RQUhypoIbRzcTy2mGPdV5bbGsdVDu1HSrDKq/C/zmCYjSSDMrf2zOotL7Yem5C3Na wnXg== X-Gm-Message-State: AE9vXwNPIIxGxQDkqeyrPU1LeWgosFTweSObGhZxlY0jwf7VgyCgldY8A/pnGOczfkzwjw== X-Received: by 10.28.9.210 with SMTP id 201mr3441825wmj.104.1472050558527; Wed, 24 Aug 2016 07:55:58 -0700 (PDT) Received: from vimeo-vm.localdomain ([62.208.37.196]) by smtp.gmail.com with ESMTPSA id t202sm33997886wmt.22.2016.08.24.07.55.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Aug 2016 07:55:57 -0700 (PDT) From: Derek Buitenhuis To: ffmpeg-devel@ffmpeg.org Date: Wed, 24 Aug 2016 15:55:24 +0100 Message-Id: <1472050524-6611-1-git-send-email-derek.buitenhuis@gmail.com> X-Mailer: git-send-email 1.8.3.1 Subject: [FFmpeg-devel] [PATCH] mov: Remove ancient heuristic hack 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: derek.buitenhuis@gmail.com MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" This breaks files with legitimate single-entry edit lists, and the hack, introduced in f03a081df09f9c4798a17d7e24446ed47924b11b, has no link to any known sample in its commit message, nor does it actually fix the problem properly, but instead has a one-off heuristic to try and "fix" them at the expense of breaking legitimate files. Signed-off-by: Derek Buitenhuis --- Let's get this out of the way first: I'm not 'returning to FFmpeg'. I do not intend to be involved in the community again, nor its overall direction and discussions, short of a miracle occurring at VideoLAN Dev Days. Let's please keep this to technical repleis only. I will ignore anything else. I am sending this patch in a professional context, as it is a problem I have run into at work, with legitimate files, produced by x264 and L-SMASH. Example file: http://chromashift.org/samples/delay_problem.mp4 Having the DTS delay output on the first packet itself is important for things like cutting files. The behavioral change can be seen with: $ ffprobe -show_packets delay_problem.mp4 Lastly, I would appreciate it if any replies to this patch set use 'Reply All', to CC me directly, because I am not currently subscribed to this mailing list, and getting proper IDs to use in the In-Reply-To field isn't easy now that Gmane is dead. Cheers, - Derek --- libavformat/mov.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 1bc3800..54c63ad 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -2802,12 +2802,8 @@ static void mov_build_index(MOVContext *mov, AVStream *st) sc->time_offset = start_time - empty_duration; current_dts = -sc->time_offset; if (sc->ctts_count>0 && sc->stts_count>0 && - sc->ctts_data[0].duration / FFMAX(sc->stts_data[0].duration, 1) > 16) { - /* more than 16 frames delay, dts are likely wrong - this happens with files created by iMovie */ - sc->wrong_dts = 1; + sc->ctts_data[0].duration / FFMAX(sc->stts_data[0].duration, 1) > 16) st->codecpar->video_delay = 1; - } } if (!unsupported && st->codecpar->codec_id == AV_CODEC_ID_AAC && start_time > 0) @@ -5352,8 +5348,6 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt) sc->ctts_index++; sc->ctts_sample = 0; } - if (sc->wrong_dts) - pkt->dts = AV_NOPTS_VALUE; } else { int64_t next_dts = (sc->current_sample < st->nb_index_entries) ? st->index_entries[sc->current_sample].timestamp : st->duration;