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; }