From patchwork Sat Dec 4 17:41:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 31965 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp2275232iog; Sat, 4 Dec 2021 09:41:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJzo0pXT7/tdwn+VBJRKsbUKJ+QKSZ8yaRar5p+kQko+X9rA0Mcn2MCKE2+eNlo3IZ+abwIA X-Received: by 2002:aa7:c353:: with SMTP id j19mr37851463edr.227.1638639711440; Sat, 04 Dec 2021 09:41:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1638639711; cv=none; d=google.com; s=arc-20160816; b=Ay39uDOF0Iu8ehZvlOgwEDyCz025Fe5GrPJTwGCEfmMThziW8LgFJvqELsr+gR0F8p 2fdTkbG1DcZu5dOC1fSp3lXyz7R1bkXrO4fojleBnSLuzrr60VXtGGii80118Q9PS4qB 73pLe3k6ZdOKrn3Z3gFGcgeofFuFDCYFT/wkZfdHGc6S/wS0oSqxaYuiwp1DiU4GPhTE FlNY+BdzQQ2CDjvrX/uu/9jt+uI4We29K3rXjHSLnNzDpFtKieuQ0MO2ijy5iNFhJqKZ 2lB8IToejlVa4YEgjeglmzP4TS8Bfz3KAwqrZVJT1jklW10dk4bGdvzTHmdhADoSDdMM H2nQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :delivered-to; bh=S9VbOIslfdY36UcAq/vTLZ7FgAjQlGlBQ4Pu/2Qu7zg=; b=WJM1zKcfbOu2zSAwZbAzQ957/D1fW5SyUs3hjgY9r1r4rOyGqi6GX7lq/mA8PKi9z1 4gIuTnoAIfKU8+hNp9Ew/JAgQZFMZCZCPRMGMk97PJKcstYiJ3gXGugztlFG499AK52j qiJAeuubvoR2uHqAVcaE7Yt9HeuAVBBsSv2e2BhFesQhybB0EjQjmN1iEStTLLM95WjY Anv7myzJmj3gJH+sN7DpHc2RPAustRjcpV35N50S3ljfIMQ05SY/Ky1i+dEmikHm06sG 9zNDuF3NnMIJ5BtrcAV66K8HeN/54m/426aXAqxU9h7PsQHRVJP1Zn+kzrZShz6tsUBk xwgQ== ARC-Authentication-Results: i=1; mx.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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id hc33si10211031ejc.589.2021.12.04.09.41.51; Sat, 04 Dec 2021 09:41:51 -0800 (PST) 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; 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 408FD68AE25; Sat, 4 Dec 2021 19:41:48 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3DF5A68A9FC for ; Sat, 4 Dec 2021 19:41:42 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id A5A3A240507 for ; Sat, 4 Dec 2021 18:41:41 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id nVuewbGe7WjH for ; Sat, 4 Dec 2021 18:41:41 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 262B6240179 for ; Sat, 4 Dec 2021 18:41:41 +0100 (CET) Received: by libav.khirnov.net (Postfix, from userid 1000) id 254763A0631; Sat, 4 Dec 2021 18:41:41 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Sat, 4 Dec 2021 18:41:13 +0100 Message-Id: <20211204174118.19085-1-anton@khirnov.net> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/6] ffmpeg: drop useless framerate assignments 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: QOLTEkCodycQ If the input stream framerate is known, it will be configured on the relevant filtergraph input and get propagated to the output stream in the above line. That makes these assignments redundant. --- fftools/ffmpeg.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 47e6a8683e..1814941266 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -3296,10 +3296,6 @@ static int init_output_stream_encode(OutputStream *ost, AVFrame *frame) if (enc_ctx->codec_type == AVMEDIA_TYPE_VIDEO) { if (!ost->frame_rate.num) ost->frame_rate = av_buffersink_get_frame_rate(ost->filter->filter); - if (ist && !ost->frame_rate.num) - ost->frame_rate = ist->framerate; - if (ist && !ost->frame_rate.num) - ost->frame_rate = ist->st->r_frame_rate; if (ist && !ost->frame_rate.num && !ost->max_frame_rate.num) { ost->frame_rate = (AVRational){25, 1}; av_log(NULL, AV_LOG_WARNING, From patchwork Sat Dec 4 17:41:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 31963 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp2276038iog; Sat, 4 Dec 2021 09:42:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJydha0u4gBHPBxUOArqJkoF5pHtonI91t/h/TNfpG4GyoS4cfuI5gAlGMrB4jl9DULpOBX1 X-Received: by 2002:a17:906:3b54:: with SMTP id h20mr32653149ejf.468.1638639760050; Sat, 04 Dec 2021 09:42:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1638639760; cv=none; d=google.com; s=arc-20160816; b=0hsZA6FRN/gTiEWBI1u04ZMpcrgRsAWT/Z7pUE8sTQsfsdTr04Z2IGzHZRazQZMMhf TroTscIvh8sG0r9tIzT63RuqZdmjBGBL5NAZmxTmBvTd/ilUVbqkQwtDxr168fKwTV0Z dpoFTCZIXMvxan+ebHbTqxNYGutqQffc1TaAGOR4+XUUtFbnZVwkK0/pQUGFc0R96i2g NZCUyvfrw14jnJ3J9KO0Oyofe6YqS0kqvGNm3o5JmiligAwoVfyo7BzFB4jZpov8MFaD SbpLmBue4JW73oI0t1mNMAeSU2JiVTi2LC/QA4bvUgjpu+Cc1CwlMQycoPWqZD5AMZPN pK0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=5Ze84qj7GwnbA9+ODgYFFd1lnRewrQj5E6UBDJBbSSQ=; b=UXfbhyMsFkMT15uUOhVt6G6cH25ZyBe83DjfCHAI9z/6SSTKpxUv5xwXetc/a7orgs XUtcfFTn+ZxTKvaLgdd31kn7e9JtyE7MDrOdbckGN1FCg1cZiI+j64QqZxtbDlB7fkyt i6qpXvPf1iHcz3Lxx+uzbk/ekjJoDztGHS1cG+DS4gojl3vfewVEauzJaIMqoZX5/jOR 47i7BuisOO+7gPYQlJpGlDqzPPi0TDEj3xI010+H2yv7jVm9Cf3Yq29fx5poZygsRUB3 Lk/qrgrCmtIIUY/UUH3yTje+PHnce9+e4WMGxgfthVqJL/2w4e7V7EFB3zZeG70oGn6C mBMA== ARC-Authentication-Results: i=1; mx.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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id f3si8489484ejd.672.2021.12.04.09.42.39; Sat, 04 Dec 2021 09:42:40 -0800 (PST) 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; 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 CAF2268AEA3; Sat, 4 Dec 2021 19:41:53 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A37E068AE87 for ; Sat, 4 Dec 2021 19:41:47 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 9173B240506 for ; Sat, 4 Dec 2021 18:41:44 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id v1gXSQsCE7Rq for ; Sat, 4 Dec 2021 18:41:41 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 281A724017A for ; Sat, 4 Dec 2021 18:41:41 +0100 (CET) Received: by libav.khirnov.net (Postfix, from userid 1000) id 276BE3A02CB; Sat, 4 Dec 2021 18:41:41 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Sat, 4 Dec 2021 18:41:14 +0100 Message-Id: <20211204174118.19085-2-anton@khirnov.net> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211204174118.19085-1-anton@khirnov.net> References: <20211204174118.19085-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/6] ffmpeg: change vsync value to an enum 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: UhPeEDLrxj+8 Stop explicitly defining VSCFR and DROP values, which were never documented. --- fftools/ffmpeg.c | 3 ++- fftools/ffmpeg.h | 16 +++++++++------- fftools/ffmpeg_opt.c | 2 +- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 1814941266..b1549a1096 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -1142,7 +1142,8 @@ static void do_video_out(OutputFile *of, OutputStream *ost, AVFrame *next_picture) { - int ret, format_video_sync; + int ret; + enum VideoSyncMethod format_video_sync; AVPacket *pkt = ost->pkt; AVCodecContext *enc = ost->enc_ctx; AVRational frame_rate; diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index cc7ba9bdca..83e37cbed7 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -47,12 +47,14 @@ #include "libswresample/swresample.h" -#define VSYNC_AUTO -1 -#define VSYNC_PASSTHROUGH 0 -#define VSYNC_CFR 1 -#define VSYNC_VFR 2 -#define VSYNC_VSCFR 0xfe -#define VSYNC_DROP 0xff +enum VideoSyncMethod { + VSYNC_AUTO = -1, + VSYNC_PASSTHROUGH, + VSYNC_CFR, + VSYNC_VFR, + VSYNC_VSCFR, + VSYNC_DROP, +}; #define MAX_STREAMS 1024 /* arbitrary sanity check value */ @@ -605,7 +607,7 @@ extern float dts_error_threshold; extern int audio_volume; extern int audio_sync_method; -extern int video_sync_method; +extern enum VideoSyncMethod video_sync_method; extern float frame_drop_threshold; extern int do_benchmark; extern int do_benchmark_all; diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index 6c2eb53290..585e1018a3 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -146,7 +146,7 @@ float dts_error_threshold = 3600*30; int audio_volume = 256; int audio_sync_method = 0; -int video_sync_method = VSYNC_AUTO; +enum VideoSyncMethod video_sync_method = VSYNC_AUTO; float frame_drop_threshold = 0; int do_benchmark = 0; int do_benchmark_all = 0; From patchwork Sat Dec 4 17:41:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 31961 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp2275488iog; Sat, 4 Dec 2021 09:42:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJztfsJb8SbX0kIUK/X8Jaq3yOFYRnMWVECdQG9Da62MgAzt8N6yui/1ykEnjN+6v2f/Zcf7 X-Received: by 2002:a05:6402:1395:: with SMTP id b21mr37395928edv.299.1638639728727; Sat, 04 Dec 2021 09:42:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1638639728; cv=none; d=google.com; s=arc-20160816; b=b7jQNdww99NOl2pW7IPyH4Ms2rcKU5OiFHTCvhf5F2QSMNIYEQpsOgVPOYpeBNkow/ ep9eWG+zSjxCBk3Okv8Nb47duS8TxMoUeN1DZnouN9iI+hciXwWuJTfMPOjHRb3KfdEo kZyx64auME2eMWJJgbD/MnyBu1pqF7D2nBW6pPSZpFqtTuXQUjrld3ZuQQNvRvXJ+9eu QyPgTf+qSeqxsQXijMGaow3ns2CSOSNH7lPx0qhusXNvM9xzKwZCT0+cedER5q+o2Oav 9NWCd7T6rUdaTSwPCYV9EHNF/pdd9jI9ksdME3DJOnO6PbkQqg+6+z9FG0GvJ1QAN9hS 0ylw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=xtVXlNb1Q9U2MxltJDy/eV1tLJ5GeymPzug7Sf0NN3Y=; b=safbrtI8g3ULz5hCKIeoQvuFbKs8PqnBiTYrgYTX2UV27WixXcP7NbFzS0xmkQS0GI puW+aXLIIKhpKIxahj1QEd/CezEdcMlJv9T/cNSESzqSAnhCEyLx7ttyAny8wjcgvad1 KvdtakHBEApaQTOEH8rcN/eB+Rkzepg7iHniRqnoMFWVn7Al5GPz7dO66Q9Q3q7qwxn/ Cfz+2F3mfaIcbJ1LXqkJp+z/Pq8Yy7V2bW6LkHjfb17lPAt/uuUwTG0mq91CRCzZFHMC Cf1WsV28TeeRumzy1xxQLuAz3HrLg7DkXzQvV0wKFiKAIAn/d7lPQHOFazo8xg+JoD0a Kb6A== ARC-Authentication-Results: i=1; mx.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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id m8si11126013edl.0.2021.12.04.09.42.08; Sat, 04 Dec 2021 09:42:08 -0800 (PST) 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; 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 0404768ACAB; Sat, 4 Dec 2021 19:41:51 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8EF5C68AE3C for ; Sat, 4 Dec 2021 19:41:43 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 0830D2404FE for ; Sat, 4 Dec 2021 18:41:43 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id rktdcrOcTXyo for ; Sat, 4 Dec 2021 18:41:42 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 3369324017C for ; Sat, 4 Dec 2021 18:41:41 +0100 (CET) Received: by libav.khirnov.net (Postfix, from userid 1000) id 2C30A3A073E; Sat, 4 Dec 2021 18:41:41 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Sat, 4 Dec 2021 18:41:15 +0100 Message-Id: <20211204174118.19085-3-anton@khirnov.net> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211204174118.19085-1-anton@khirnov.net> References: <20211204174118.19085-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/6] FATE: stop using numeric arguments to -vsync 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: bSRYQtEM1P52 Symbolic names are always preferable. --- tests/fate/h264.mak | 4 ++-- tests/fate/hevc.mak | 2 +- tests/fate/mov.mak | 4 ++-- tests/fate/mpeg4.mak | 2 +- tests/fate/vcodec.mak | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/fate/h264.mak b/tests/fate/h264.mak index e034e6ae0f..e075b6f67f 100644 --- a/tests/fate/h264.mak +++ b/tests/fate/h264.mak @@ -342,7 +342,7 @@ fate-h264-conformance-frext-freh7_b: CMD = framecrc -i $(TARGET_SAM fate-h264-conformance-frext-frext01_jvc_d: CMD = framecrc -i $(TARGET_SAMPLES)/h264-conformance/FRext/FREXT01_JVC_D.264 fate-h264-conformance-frext-frext02_jvc_c: CMD = framecrc -i $(TARGET_SAMPLES)/h264-conformance/FRext/FREXT02_JVC_C.264 fate-h264-conformance-frext-frext1_panasonic_c: CMD = framecrc -i $(TARGET_SAMPLES)/h264-conformance/FRext/FRExt1_Panasonic.avc -fate-h264-conformance-frext-frext2_panasonic_b: CMD = framecrc -i $(TARGET_SAMPLES)/h264-conformance/FRext/FRExt2_Panasonic.avc -vsync 0 +fate-h264-conformance-frext-frext2_panasonic_b: CMD = framecrc -i $(TARGET_SAMPLES)/h264-conformance/FRext/FRExt2_Panasonic.avc -vsync passthrough fate-h264-conformance-frext-frext3_panasonic_d: CMD = framecrc -i $(TARGET_SAMPLES)/h264-conformance/FRext/FRExt3_Panasonic.avc fate-h264-conformance-frext-frext4_panasonic_a: CMD = framecrc -i $(TARGET_SAMPLES)/h264-conformance/FRext/FRExt4_Panasonic.avc fate-h264-conformance-frext-frext_mmco4_sony_b: CMD = framecrc -i $(TARGET_SAMPLES)/h264-conformance/FRext/FRExt_MMCO4_Sony_B.264 @@ -361,7 +361,7 @@ fate-h264-conformance-frext-hpcadq_brcm_b: CMD = framecrc -i $(TARGET_SAM fate-h264-conformance-frext-hpcafl_bcrm_c: CMD = framecrc -i $(TARGET_SAMPLES)/h264-conformance/FRext/HPCAFL_BRCM_C.264 fate-h264-conformance-frext-hpcaflnl_bcrm_c: CMD = framecrc -i $(TARGET_SAMPLES)/h264-conformance/FRext/HPCAFLNL_BRCM_C.264 fate-h264-conformance-frext-hpcalq_brcm_b: CMD = framecrc -i $(TARGET_SAMPLES)/h264-conformance/FRext/HPCALQ_BRCM_B.264 -fate-h264-conformance-frext-hpcamapalq_bcrm_b: CMD = framecrc -i $(TARGET_SAMPLES)/h264-conformance/FRext/HPCAMAPALQ_BRCM_B.264 -vsync 0 +fate-h264-conformance-frext-hpcamapalq_bcrm_b: CMD = framecrc -i $(TARGET_SAMPLES)/h264-conformance/FRext/HPCAMAPALQ_BRCM_B.264 -vsync passthrough fate-h264-conformance-frext-hpcamolq_brcm_b: CMD = framecrc -i $(TARGET_SAMPLES)/h264-conformance/FRext/HPCAMOLQ_BRCM_B.264 fate-h264-conformance-frext-hpcanl_brcm_c: CMD = framecrc -i $(TARGET_SAMPLES)/h264-conformance/FRext/HPCANL_BRCM_C.264 fate-h264-conformance-frext-hpcaq2lq_brcm_b: CMD = framecrc -i $(TARGET_SAMPLES)/h264-conformance/FRext/HPCAQ2LQ_BRCM_B.264 diff --git a/tests/fate/hevc.mak b/tests/fate/hevc.mak index 2a88eb4690..abe4264662 100644 --- a/tests/fate/hevc.mak +++ b/tests/fate/hevc.mak @@ -239,7 +239,7 @@ $(foreach N,$(HEVC_SAMPLES_444_8BIT),$(eval $(call FATE_HEVC_TEST_444_8BIT,$(N)) $(foreach N,$(HEVC_SAMPLES_444_12BIT),$(eval $(call FATE_HEVC_TEST_444_12BIT,$(N)))) $(foreach N,$(HEVC_SAMPLES_444_12BIT_LARGE),$(eval $(call FATE_HEVC_TEST_444_12BIT_LARGE,$(N)))) -fate-hevc-paramchange-yuv420p-yuv420p10: CMD = framecrc -vsync 0 -i $(TARGET_SAMPLES)/hevc/paramchange_yuv420p_yuv420p10.hevc -sws_flags area+accurate_rnd+bitexact +fate-hevc-paramchange-yuv420p-yuv420p10: CMD = framecrc -vsync passthrough -i $(TARGET_SAMPLES)/hevc/paramchange_yuv420p_yuv420p10.hevc -sws_flags area+accurate_rnd+bitexact FATE_HEVC_LARGE += fate-hevc-paramchange-yuv420p-yuv420p10 tests/data/hevc-mp4.mov: TAG = GEN diff --git a/tests/fate/mov.mak b/tests/fate/mov.mak index 5ca992e181..e956380909 100644 --- a/tests/fate/mov.mak +++ b/tests/fate/mov.mak @@ -94,8 +94,8 @@ fate-mov-neg-firstpts-discard: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_entri # with negative timestamps (skip_samples is not set for Vorbis, so ffmpeg computes start_time as negative if not specified by demuxer). fate-mov-neg-firstpts-discard-vorbis: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_entries stream=start_time -bitexact $(TARGET_SAMPLES)/mov/mov_neg_first_pts_discard_vorbis.mp4 -# Makes sure that expected frames are generated for mov_neg_first_pts_discard.mov with -vsync 1 -fate-mov-neg-firstpts-discard-frames: CMD = framemd5 -flags +bitexact -i $(TARGET_SAMPLES)/mov/mov_neg_first_pts_discard.mov -vsync 1 +# Makes sure that expected frames are generated for mov_neg_first_pts_discard.mov with -vsync cfr +fate-mov-neg-firstpts-discard-frames: CMD = framemd5 -flags +bitexact -i $(TARGET_SAMPLES)/mov/mov_neg_first_pts_discard.mov -vsync cfr # Makes sure that no frame is dropped/duplicated with fps filter due to start_time / duration miscalculations. fate-mov-stream-shorter-than-movie: CMD = framemd5 -flags +bitexact -i $(TARGET_SAMPLES)/mov/mov_stream_shorter_than_movie.mov -vf fps=fps=24 -an diff --git a/tests/fate/mpeg4.mak b/tests/fate/mpeg4.mak index ed6a2fac20..26007f82f0 100644 --- a/tests/fate/mpeg4.mak +++ b/tests/fate/mpeg4.mak @@ -8,7 +8,7 @@ FATE_MPEG4-$(call DEMDEC, H263, H263) := $(addprefix fate-mpeg4-resolution-chang fate-mpeg4-bsf-unpack-bframes: CMD = md5 -i $(TARGET_SAMPLES)/mpeg4/packed_bframes.avi -flags +bitexact -fflags +bitexact -c:v copy -bsf mpeg4_unpack_bframes -f avi FATE_MPEG4-$(call ALLYES, AVI_DEMUXER MPEG4_UNPACK_BFRAMES_BSF AVI_MUXER) += fate-mpeg4-bsf-unpack-bframes -fate-mpeg4-packed: CMD = framecrc -flags +bitexact -idct simple -i $(TARGET_SAMPLES)/mpeg4/packed_bframes.avi -flags +bitexact -fflags +bitexact -vsync 1 +fate-mpeg4-packed: CMD = framecrc -flags +bitexact -idct simple -i $(TARGET_SAMPLES)/mpeg4/packed_bframes.avi -flags +bitexact -fflags +bitexact -vsync cfr FATE_MPEG4-$(call ALLYES, AVI_DEMUXER MPEG4_DECODER) += fate-mpeg4-packed FATE_MPEG4-$(call DEMDEC, M4V, MPEG4) += fate-m4v fate-m4v-cfr diff --git a/tests/fate/vcodec.mak b/tests/fate/vcodec.mak index ef892366eb..2e6d16f1e7 100644 --- a/tests/fate/vcodec.mak +++ b/tests/fate/vcodec.mak @@ -4,8 +4,8 @@ fate-vsynth_lena-%: SRC = tests/data/vsynth_lena.yuv fate-vsynth3-%: SRC = tests/data/vsynth3.yuv fate-vsynth%: CODEC = $(word 3, $(subst -, ,$(@))) fate-vsynth%: FMT = avi -fate-vsynth%: CMD = enc_dec "rawvideo -s 352x288 -pix_fmt yuv420p $(RAWDECOPTS)" $(SRC) $(FMT) "-c $(CODEC) $(ENCOPTS)" rawvideo "-s 352x288 -pix_fmt yuv420p -vsync 0 $(DECOPTS)" "$(KEEP_OVERRIDE)" "$(DECINOPTS)" -fate-vsynth3-%: CMD = enc_dec "rawvideo -s $(FATEW)x$(FATEH) -pix_fmt yuv420p $(RAWDECOPTS)" $(SRC) $(FMT) "-c $(CODEC) $(ENCOPTS)" rawvideo "-s $(FATEW)x$(FATEH) -pix_fmt yuv420p -vsync 0 $(DECOPTS)" "" "$(DECINOPTS)" +fate-vsynth%: CMD = enc_dec "rawvideo -s 352x288 -pix_fmt yuv420p $(RAWDECOPTS)" $(SRC) $(FMT) "-c $(CODEC) $(ENCOPTS)" rawvideo "-s 352x288 -pix_fmt yuv420p -vsync passthrough $(DECOPTS)" "$(KEEP_OVERRIDE)" "$(DECINOPTS)" +fate-vsynth3-%: CMD = enc_dec "rawvideo -s $(FATEW)x$(FATEH) -pix_fmt yuv420p $(RAWDECOPTS)" $(SRC) $(FMT) "-c $(CODEC) $(ENCOPTS)" rawvideo "-s $(FATEW)x$(FATEH) -pix_fmt yuv420p -vsync passthrough $(DECOPTS)" "" "$(DECINOPTS)" fate-vsynth%: CMP_UNIT = 1 fate-vsynth%: REF = $(SRC_PATH)/tests/ref/vsynth/$(@:fate-%=%) From patchwork Sat Dec 4 17:41:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 31962 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp2275376iog; Sat, 4 Dec 2021 09:41:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJyUBvuXO8zVLyTGI5pzxvRqWpxI3ex2qc/2KwOAxvJKB4GpYmmpGWkkG+Bpyxtkvu5B1B5e X-Received: by 2002:a17:906:794a:: with SMTP id l10mr32028654ejo.192.1638639719676; Sat, 04 Dec 2021 09:41:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1638639719; cv=none; d=google.com; s=arc-20160816; b=lEOD0XA4siWU1htqc14qpnqha404v714ehuOo4koj7LPfqM7jxTIeLHC88V3C1doD0 /h3vC/WwrT/m3hpmCa10EM1YEcl2+OHF7dZlv1S5WzITjbiM8Ifd2HbnMQ0DVTsElEbv +nACnrkdyQICWeVgY6Kow2ZP8kI/1poyyfVcNbmHM0/A/gFFiKLzeQcRPWDp77NCGFDV wF2ZBdPTo8h74IPG7deG+Pmzpe/nVBgw+3eMR/WFkYt+RjPdmcgR2EvavbSAARzxrs5U ppId89jaq8FIxgomfXVXDqFuODvkwEtK3wdWPXlydMKeT1zb0lKG+NKmrap6nB8yLrxP r4CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=KOZuXKRLnoKybDsi0vkGplCXK7+if+jUGKOoPmWoZDI=; b=h9E/qBZyYjMuOwDoLgKl8EvBn9WMri2oSzXcxQXCxkMvNc0J6VHpsB4QyVDt1DAEj6 OBBCkhMtTs71f1V4Kk94RdA+YNnMXpWjletIY/9OLEiqxTAUIQv82ev99UYuFFgz5qSC m7Lzr2ddEs8TUTRQlH6du4R8jZw1wnX4AR/0EZZmSqDx+c6LuMJbTbQICyBBkj7/DFaz c70eBceTEJs+1Ts2zYf8OOSQQpaoeFDkcSqFXGayc9/Dw83rYFIDqinc/ksFSBWJW7mc P5R7+BUDEp3Qw+/6rLQDN0DvgfOkKbnmfAGL+8pbo1gSfsv9FO2fRAnIn6BCFehaq0dZ qLSQ== ARC-Authentication-Results: i=1; mx.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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id nc37si13267479ejc.119.2021.12.04.09.41.59; Sat, 04 Dec 2021 09:41:59 -0800 (PST) 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; 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 3029268AE59; Sat, 4 Dec 2021 19:41:50 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B808668A9FC for ; Sat, 4 Dec 2021 19:41:42 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 3AB43240179 for ; Sat, 4 Dec 2021 18:41:42 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id EG7mi-k6_Viv for ; Sat, 4 Dec 2021 18:41:41 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 33E592404FE for ; Sat, 4 Dec 2021 18:41:41 +0100 (CET) Received: by libav.khirnov.net (Postfix, from userid 1000) id 30E0D3A0743; Sat, 4 Dec 2021 18:41:41 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Sat, 4 Dec 2021 18:41:16 +0100 Message-Id: <20211204174118.19085-4-anton@khirnov.net> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211204174118.19085-1-anton@khirnov.net> References: <20211204174118.19085-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/6] ffmpeg: deprecate passing numbers to -vsync 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: S2ro583SGCs5 There is never a reason to do this, using symbolic names is always preferred. --- doc/ffmpeg.texi | 16 +++++++++------- fftools/ffmpeg_opt.c | 7 +++++-- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index 20a547381c..164419cad3 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -1620,23 +1620,25 @@ It is useful for when flow speed of output packets is important, such as live st Read input at native frame rate. This is equivalent to setting @code{-readrate 1}. @item -vsync @var{parameter} Video sync method. -For compatibility reasons old values can be specified as numbers. -Newly added values will have to be specified as strings always. + +For compatibility reasons some of the values can be specified as numbers (shown +in parentheses in the following table). This is deprecated and will stop working +in the future. @table @option -@item 0, passthrough +@item passthrough (0) Each frame is passed with its timestamp from the demuxer to the muxer. -@item 1, cfr +@item cfr (1) Frames will be duplicated and dropped to achieve exactly the requested constant frame rate. -@item 2, vfr +@item vfr (2) Frames are passed through with their timestamp or dropped so as to prevent 2 frames from having the same timestamp. @item drop As passthrough but destroys all timestamps, making the muxer generate fresh timestamps based on frame-rate. -@item -1, auto -Chooses between 1 and 2 depending on muxer capabilities. This is the +@item auto (-1) +Chooses between cfr and vfr depending on muxer capabilities. This is the default method. @end table diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index 585e1018a3..a2a880e8e3 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -1741,7 +1741,7 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in if ((frame_rate || max_frame_rate) && video_sync_method == VSYNC_PASSTHROUGH) - av_log(NULL, AV_LOG_ERROR, "Using -vsync 0 and -r/-fpsmax can produce invalid output files\n"); + av_log(NULL, AV_LOG_ERROR, "Using -vsync passthrough and -r/-fpsmax can produce invalid output files\n"); MATCH_PER_STREAM_OPT(frame_aspect_ratios, str, frame_aspect_ratio, oc, st); if (frame_aspect_ratio) { @@ -3201,8 +3201,11 @@ static int opt_vsync(void *optctx, const char *opt, const char *arg) else if (!av_strcasecmp(arg, "passthrough")) video_sync_method = VSYNC_PASSTHROUGH; else if (!av_strcasecmp(arg, "drop")) video_sync_method = VSYNC_DROP; - if (video_sync_method == VSYNC_AUTO) + if (video_sync_method == VSYNC_AUTO) { video_sync_method = parse_number_or_die("vsync", arg, OPT_INT, VSYNC_AUTO, VSYNC_VFR); + av_log(NULL, AV_LOG_WARNING, "Passing a number to -vsync is deprecated," + " use a string argument as described in the manual.\n"); + } return 0; } From patchwork Sat Dec 4 17:41:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 31964 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp2275670iog; Sat, 4 Dec 2021 09:42:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJyt7XTLDoRaVswEAhvhrishyJroAHjLGmrrN/3trIQQOrI+mF3rR4f1IA8c1CUVWxhLWB+i X-Received: by 2002:a05:6402:5194:: with SMTP id q20mr37143196edd.123.1638639739110; Sat, 04 Dec 2021 09:42:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1638639739; cv=none; d=google.com; s=arc-20160816; b=q+LGueTK3oIO9yLzbcsjp6+dfn5Wyyy402ISoCBedladfKI+4mqPLGJ0jdp+/N0894 yRHQddtcrdO0mFAGvnDJHwXRXQTObjxwIyIk9FWRZ870MLDTE+8lbKrRDVpskPMp/J2b KbBARlxWo8FKbdSLJby6T6wcKkVcKc2yxSfxrkM6CVOMw4b8kd/u38atfJ7afiRh5xvb TtTKcXzFYegng9CStC56x2dP/YGJGFnCt49EeqriB6QT1p+COWkUE2LTcFrJ1E8jl+3D 691hSrf6wb4pexKh8IifEca6GlofyWe5zGkJGQok86ptDb8K6KWW6J/0WtEdHOC6cE/E kkvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=MDbN5T/BPZ7S16YLxl8xqw3D5i63RlgnoYZo99IKHn0=; b=iZ4T0/jxtakZDdAbYcTL+fXo9VReCq7XBrEhs/6/EjBf+KFmKdAUQkkLo5Z1dIfqdG K9/8hpTz+EtbMy1ps0MepT0JCVZyvKsUgdn/GI/RAcW40AUjDV1YukhA9NVgMD6pm/MQ ssTuvxeq2GGpeJvhT7T/gOlKnLKgmu6VgfjubfGyiK+Nk9VAC3uVYXMsWFr7ZYIc5oG1 0EZI3kjonIUhDzaq/xU21bEvMtmSdbl3Ch+VToK+ZtJaGYjPfCLQTMG+3APABlVvbqp8 6b8fqvOSy63tjCiZuy0mSRsxK8GVuPDeqp+BOVA0YmM5p19tFqKbLevDplxXPRdTxVCJ YLkg== ARC-Authentication-Results: i=1; mx.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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id gs18si7946459ejc.679.2021.12.04.09.42.18; Sat, 04 Dec 2021 09:42:19 -0800 (PST) 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; 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 E09C068AE7A; Sat, 4 Dec 2021 19:41:51 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 29AF968A807 for ; Sat, 4 Dec 2021 19:41:44 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 9A19F24017C for ; Sat, 4 Dec 2021 18:41:43 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id Rwz5R2ed84T5 for ; Sat, 4 Dec 2021 18:41:43 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 33B1124017E for ; Sat, 4 Dec 2021 18:41:41 +0100 (CET) Received: by libav.khirnov.net (Postfix, from userid 1000) id 3533A3A0746; Sat, 4 Dec 2021 18:41:41 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Sat, 4 Dec 2021 18:41:17 +0100 Message-Id: <20211204174118.19085-5-anton@khirnov.net> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211204174118.19085-1-anton@khirnov.net> References: <20211204174118.19085-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 5/6] ffmpeg: move setting video sync method to new_video_stream() 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: Zo5hhPp8m+74 do_video_out() is the wrong place for it, since the necessary information is already known when creating the stream and its value should never change. --- fftools/ffmpeg.c | 25 +++---------------------- fftools/ffmpeg.h | 1 + fftools/ffmpeg_opt.c | 24 ++++++++++++++++++++++++ 3 files changed, 28 insertions(+), 22 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index b1549a1096..1936367463 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -1143,7 +1143,6 @@ static void do_video_out(OutputFile *of, AVFrame *next_picture) { int ret; - enum VideoSyncMethod format_video_sync; AVPacket *pkt = ost->pkt; AVCodecContext *enc = ost->enc_ctx; AVRational frame_rate; @@ -1190,28 +1189,10 @@ static void do_video_out(OutputFile *of, nb0_frames = 0; // tracks the number of times the PREVIOUS frame should be duplicated, mostly for variable framerate (VFR) nb_frames = 1; - format_video_sync = video_sync_method; - if (format_video_sync == VSYNC_AUTO) { - if(!strcmp(of->ctx->oformat->name, "avi")) { - format_video_sync = VSYNC_VFR; - } else - format_video_sync = (of->ctx->oformat->flags & AVFMT_VARIABLE_FPS) ? ((of->ctx->oformat->flags & AVFMT_NOTIMESTAMPS) ? VSYNC_PASSTHROUGH : VSYNC_VFR) : VSYNC_CFR; - if ( ist - && format_video_sync == VSYNC_CFR - && input_files[ist->file_index]->ctx->nb_streams == 1 - && input_files[ist->file_index]->input_ts_offset == 0) { - format_video_sync = VSYNC_VSCFR; - } - if (format_video_sync == VSYNC_CFR && copy_ts) { - format_video_sync = VSYNC_VSCFR; - } - } - ost->is_cfr = (format_video_sync == VSYNC_CFR || format_video_sync == VSYNC_VSCFR); - if (delta0 < 0 && delta > 0 && - format_video_sync != VSYNC_PASSTHROUGH && - format_video_sync != VSYNC_DROP) { + ost->vsync_method != VSYNC_PASSTHROUGH && + ost->vsync_method != VSYNC_DROP) { if (delta0 < -0.6) { av_log(NULL, AV_LOG_VERBOSE, "Past duration %f too large\n", -delta0); } else @@ -1221,7 +1202,7 @@ static void do_video_out(OutputFile *of, delta0 = 0; } - switch (format_video_sync) { + switch (ost->vsync_method) { case VSYNC_VSCFR: if (ost->frame_number == 0 && delta0 >= 0.5) { av_log(NULL, AV_LOG_DEBUG, "Not duplicating %d initial frames\n", (int)lrintf(delta0)); diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 83e37cbed7..9b200b806a 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -485,6 +485,7 @@ typedef struct OutputStream { /* video only */ AVRational frame_rate; AVRational max_frame_rate; + enum VideoSyncMethod vsync_method; int is_cfr; int force_fps; int top_field_first; diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index a2a880e8e3..a7bf4c0c00 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -1905,6 +1905,30 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in ost->top_field_first = -1; MATCH_PER_STREAM_OPT(top_field_first, i, ost->top_field_first, oc, st); + ost->vsync_method = video_sync_method; + if (ost->vsync_method == VSYNC_AUTO) { + if (!strcmp(oc->oformat->name, "avi")) { + ost->vsync_method = VSYNC_VFR; + } else { + ost->vsync_method = (oc->oformat->flags & AVFMT_VARIABLE_FPS) ? + ((oc->oformat->flags & AVFMT_NOTIMESTAMPS) ? + VSYNC_PASSTHROUGH : VSYNC_VFR) : + VSYNC_CFR; + } + + if (ost->source_index >= 0 && ost->vsync_method == VSYNC_CFR) { + const InputStream *ist = input_streams[ost->source_index]; + const InputFile *ifile = input_files[ist->file_index]; + + if (ifile->nb_streams == 1 && ifile->input_ts_offset == 0) + ost->vsync_method = VSYNC_VSCFR; + } + + if (ost->vsync_method == VSYNC_CFR && copy_ts) { + ost->vsync_method = VSYNC_VSCFR; + } + } + ost->is_cfr = (ost->vsync_method == VSYNC_CFR || ost->vsync_method == VSYNC_VSCFR); ost->avfilter = get_ost_filters(o, oc, ost); if (!ost->avfilter) From patchwork Sat Dec 4 17:41:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 31966 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp2275853iog; Sat, 4 Dec 2021 09:42:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJzgQwo1rs2V1z7gBt94mDLNnOMGY4WaqC/Crdv1m0r0GKWZaKzlFdURNSuSUoUWPUpr+ZRB X-Received: by 2002:aa7:c9ce:: with SMTP id i14mr36409891edt.300.1638639749840; Sat, 04 Dec 2021 09:42:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1638639749; cv=none; d=google.com; s=arc-20160816; b=v0G0gFZa50daoI+zRH8ZKnpqLXxkVnU6pvyx1zETM/RG4zfpajVja0Jqc/nEuKemdJ WfoledhnkesEAPGnH9PekJANU2iSDLBQ87XJWj2Di6KnHcGL4rrj7a+6S2fXp6c4FYod Gn8xp7tTrMfyow4m3cpDT1SzTVzQpPgov0J16w66HpM/U4i5p1ahLOn47CA1oINNv6SC hgDKn1FBqGK4e1jr6SPQqc52VyfuGStkXZ6CKlwLhqJcL3lAWCS5pU19/2Wbt8wxLfH9 i0SpUZR47D3E8I/YzL0CG4Fg1GRA38+wJlKstgCKJqm5SztcnL1tOg4nwl3FI2bmaEFs UYLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=m464DtZLf97V1gcU4nwJEittsZBNqfpY1ZZuzjQc81U=; b=lIAMeTJ23aDX4dwo2carMdHfXO6flhbb33yaJ47vym0Fnc4XuPA8DyBdR+cFEiczsU b8Pfi2TFmCK5h/+rknXN+wqBNxihIBuBbed6rxMhevIGjb8bGrh5IB8VG6JM6YCc3mQL 6k8lVivHS3WeTLaJfPqPCMkfFuCXC1Qetr4IRLBG+F2PmzREHQakcrt3geMpiQmd41mj AqxKNqkCIPphQMbv3udLTICg9qiwKAvW3f0WbcNJzLMuBYxweYQX5XhXwm+uinJ+nbu7 pbJFamsj5UUDnTMd1Krsk6xj8VRxpxHI/Zh7BT889MfmrtGysk5vlR5lD3mpFEqLZZ0U BMkQ== ARC-Authentication-Results: i=1; mx.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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id hv17si11333875ejc.37.2021.12.04.09.42.29; Sat, 04 Dec 2021 09:42:29 -0800 (PST) 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; 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 D12A868AE87; Sat, 4 Dec 2021 19:41:52 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B8D8C68A807 for ; Sat, 4 Dec 2021 19:41:44 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 3909D24017E for ; Sat, 4 Dec 2021 18:41:44 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id FUX19EJ9Yx1x for ; Sat, 4 Dec 2021 18:41:43 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 63E6E240506 for ; Sat, 4 Dec 2021 18:41:41 +0100 (CET) Received: by libav.khirnov.net (Postfix, from userid 1000) id 395253A0769; Sat, 4 Dec 2021 18:41:41 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Sat, 4 Dec 2021 18:41:18 +0100 Message-Id: <20211204174118.19085-6-anton@khirnov.net> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211204174118.19085-1-anton@khirnov.net> References: <20211204174118.19085-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 6/6] ffmpeg: handle errors in print_sdp() 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: SX9m2CK4s1bk Do not continue as if nothing happened. --- fftools/ffmpeg.c | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 1936367463..11cdf69af0 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -2764,17 +2764,17 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eo return !eof_reached; } -static void print_sdp(void) +static int print_sdp(void) { char sdp[16384]; int i; - int j; + int j, ret; AVIOContext *sdp_pb; AVFormatContext **avc; for (i = 0; i < nb_output_files; i++) { if (!output_files[i]->header_written) - return; + return 0; } avc = av_malloc_array(nb_output_files, sizeof(*avc)); @@ -2787,26 +2787,34 @@ static void print_sdp(void) } } - if (!j) + if (!j) { + av_log(NULL, AV_LOG_ERROR, "No output streams in the SDP.\n"); + ret = AVERROR(EINVAL); goto fail; + } - av_sdp_create(avc, j, sdp, sizeof(sdp)); + ret = av_sdp_create(avc, j, sdp, sizeof(sdp)); + if (ret < 0) + goto fail; if (!sdp_filename) { printf("SDP:\n%s\n", sdp); fflush(stdout); } else { - if (avio_open2(&sdp_pb, sdp_filename, AVIO_FLAG_WRITE, &int_cb, NULL) < 0) { + ret = avio_open2(&sdp_pb, sdp_filename, AVIO_FLAG_WRITE, &int_cb, NULL); + if (ret < 0) { av_log(NULL, AV_LOG_ERROR, "Failed to open sdp file '%s'\n", sdp_filename); - } else { - avio_print(sdp_pb, sdp); - avio_closep(&sdp_pb); - av_freep(&sdp_filename); + goto fail; } + + avio_print(sdp_pb, sdp); + avio_closep(&sdp_pb); + av_freep(&sdp_filename); } fail: av_freep(&avc); + return ret; } static enum AVPixelFormat get_format(AVCodecContext *s, const enum AVPixelFormat *pix_fmts) @@ -2962,8 +2970,13 @@ static int check_init_output_file(OutputFile *of, int file_index) av_dump_format(of->ctx, file_index, of->ctx->url, 1); nb_output_dumped++; - if (sdp_filename || want_sdp) - print_sdp(); + if (sdp_filename || want_sdp) { + ret = print_sdp(); + if (ret < 0) { + av_log(NULL, AV_LOG_ERROR, "Error writing the SDP.\n"); + return ret; + } + } /* flush the muxing queues */ for (i = 0; i < of->ctx->nb_streams; i++) {