From patchwork Fri Sep 1 19:02:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Timo Rothenpieler X-Patchwork-Id: 4946 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.15.201 with SMTP id 70csp909955jao; Fri, 1 Sep 2017 12:03:15 -0700 (PDT) X-Google-Smtp-Source: ADKCNb59zQqZCxVFB/BhYa566Qa7ajb1c1eEy2AEIGtfoIcGtJv5CMthefaWa/4oFNeI+DWkoXM/ X-Received: by 10.28.28.84 with SMTP id c81mr980484wmc.152.1504292595583; Fri, 01 Sep 2017 12:03:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504292595; cv=none; d=google.com; s=arc-20160816; b=vGDiNx8c8gd1RbCqmJoH1OC3BwyC8Ks0v0CZHMRSW5mNmKRbuxL3g3QdwblB9NaGiA UXSROHQJMj1phzBgAayUhP4lKPbBd+4+NLliYBNm3bi2vcLRg3bF4sr6JhAxxwf0J8iw 3dyeB7E57/AvkP3199vln4hH5jF1RyztaBlJJ17UmO1GRd6yk0rqhQK72VgITKbeuic8 D+tPx/07O51/YNsr3TXoNodmmg4t+9g66OIdP7RqqtLOBTzQTveH5K5xpr/0IYIy7bMe NhtywJoN+dcaruB6DdUjxTm223V5Bdw7WSA6Sw1mYU5hVDbMeC4A8CQXP4xe5ZtbnKa7 qYhw== 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:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=lFWWnXDuu9ZP6zv1Wehs9JrsFbq4xiS52M8YN6wpCls=; b=rsdp2a1C5vFMan2tTn45hvozWbL3u+cn5CGn+mL0ZswsumMu9zAk0Q/ps5l+wlqx3t cEa4dMcluLxsQqjXvbn8kfg38pB65YLOinR2/o0ETE/ghCoAOjecMXr8A7UKOMfeX8G6 WBRBIYPDYTQjGrIUeEtGgEpRPeJgLnJ+Spcm5f2IvQT/at9IHL3JjF5W0JU6IuH3XeiM hGm9gdnjo5fsM4Gf5bApOMr+airXVrzNwx2zBu1AZvMaOdm9HOEh15WGCFrabcUf8FAh c+zkDWiIth9vj8DwbuTZ6mz3McWK881AkclTUNfH3hnSFpYRFPHBG4a34Qs2/1r1jDAi 9jFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@rothenpieler.org header.s=mail header.b=dK6kN3sy; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id t84si577937wmt.37.2017.09.01.12.03.12; Fri, 01 Sep 2017 12:03:15 -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=@rothenpieler.org header.s=mail header.b=dK6kN3sy; 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 274B268A2C0; Fri, 1 Sep 2017 22:03:07 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from btbn.de (btbn.de [5.9.118.179]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A071668A1E0 for ; Fri, 1 Sep 2017 22:03:01 +0300 (EEST) Received: from localhost.localdomain (unknown [IPv6:2a02:8109:43f:959c:ba97:5aff:fe10:ec69]) by btbn.de (Postfix) with ESMTPSA id 9EAEE1479B4; Fri, 1 Sep 2017 21:03:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rothenpieler.org; s=mail; t=1504292582; bh=jYoLgOCwah0n5pBw2ise3a8bImsjb67bQA4jkDtUq7Q=; h=From:To:Cc:Subject:Date; b=dK6kN3syJK/YvDswvNCwi84CmTEJQemhZzrWhCYkpB8FBRRUbqvFotELxWppSrBXR IiIJju46ojPma9n3nzy98pPXW+ZCN5PNuZ5iAuvL+HBdm7Gy9qQ1QrRRoMkyxD2J7v nb3AaUJAKm5pl8MgR2l47Qy6jMNl4pM+ctODvid0= From: Timo Rothenpieler To: ffmpeg-devel@ffmpeg.org Date: Fri, 1 Sep 2017 21:02:54 +0200 Message-Id: <20170901190254.30401-1-timo@rothenpieler.org> X-Mailer: git-send-email 2.14.1 Subject: [FFmpeg-devel] [RFC] ffmpeg: reverse logic for interlaced field ordering heuristic 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: Timo Rothenpieler MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" When re-encoding for example interlaced h264 from mkv into mkv, the field ordering type switches from TT to TB, confusing some players. Same happens on a lot of other cases as well. I have no idea if this is the correct fix for it, but something is definitely going wrong. --- ffmpeg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ffmpeg.c b/ffmpeg.c index ccb6638e0a..41f9bc4fb7 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -1206,7 +1206,7 @@ static void do_video_out(OutputFile *of, avoid any copies. We support temporarily the older method. */ if (in_picture->interlaced_frame) - mux_par->field_order = in_picture->top_field_first ? AV_FIELD_TB:AV_FIELD_BT; + mux_par->field_order = in_picture->top_field_first ? AV_FIELD_TT:AV_FIELD_BB; else mux_par->field_order = AV_FIELD_PROGRESSIVE; pkt.data = (uint8_t *)in_picture; @@ -1226,7 +1226,7 @@ static void do_video_out(OutputFile *of, in_picture->top_field_first = !!ost->top_field_first; if (in_picture->interlaced_frame) { - if (enc->codec->id == AV_CODEC_ID_MJPEG) + if (enc->codec->id != AV_CODEC_ID_MJPEG) mux_par->field_order = in_picture->top_field_first ? AV_FIELD_TT:AV_FIELD_BB; else mux_par->field_order = in_picture->top_field_first ? AV_FIELD_TB:AV_FIELD_BT;