From patchwork Wed Sep 28 09:55:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 38411 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b1c:b0:96:9ee8:5cfd with SMTP id c28csp93607pzh; Wed, 28 Sep 2022 02:58:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7i9IvRJntvnSi+dvfny5jHi+9B9JZ4QiCGzlRbt7QYkGsw2DwJgH6z9XecD5xm3kFGSacb X-Received: by 2002:a17:907:d8e:b0:783:a4f0:1052 with SMTP id go14-20020a1709070d8e00b00783a4f01052mr11469968ejc.41.1664359100847; Wed, 28 Sep 2022 02:58:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664359100; cv=none; d=google.com; s=arc-20160816; b=Z06FnfQaFKUPLq/7Zoq+t4DvpuN5FEuWTtm7RAUAxueK8C4h1gIwxF0LTd7Qe5MxcV 9yKYqszOxUotEUhwNMb22sE9zcJ9ZWZMnKqF7dP6oFU5BweWh7iH7TzdyjQfnugD293J ol/vea4lT1tWsE68HY/Joyh9SXiEPunB83NnaD4ZDdh8JNqrQObcw+vUmXF8MT/Bhm9K OXTDS+b+tIcvtICoHHggtVB0mYHy0ZMDLPCOQmxMj082LrU3oYrP6Pwumjt0RZiJV+Ah dLrgEmiAXlWU8xk5TxRtifQpQLNvn2BnvY/3qRajwvi96vNPY8um33OFCxGFO2Y/4SWn Oc7g== 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=8vofKsMGjg9uoaWdjOT+eDsdgvVRtt3/Fk1dcCtfDsw=; b=0Kf+T8VLSOVXsGrzLNQgvyHLLPNBmgV92h8eePeRTU9QO7DBlpuYYKrug2976u+xxN 6gd4jpEp5ruAXP4W5oxx7zJRho62Zejl55z/QySZWNKevFql4eFzWrRjgUm6PyWAVEPr Gc2EVXhYvZ82ppqLpInAXrC+2KqtpXrWr32NkHuzql2+giWVGHqWjgrFFI91Hp9ey9+3 HH2Zi/6JM+yBU0pNhNKtcp+kTbq7c449fzAEb/YfkplQ5p8AkiQVu4b+q8WGiZX9ZNT/ B9s+CePs3cVanO0BXPzZ8s0S+Uex6jxW5UpxiyyTmHJOFKVzuBVMBS4yZOdaUYCihHGV htvg== 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 wi7-20020a170906fd4700b007826de24087si2975389ejb.228.2022.09.28.02.58.20; Wed, 28 Sep 2022 02:58:20 -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; 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 E431668BBF8; Wed, 28 Sep 2022 12:58:09 +0300 (EEST) 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 5F62068BBD8 for ; Wed, 28 Sep 2022 12:58:02 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 9FE1C240183 for ; Wed, 28 Sep 2022 11:58:01 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id gXL3wHGI5h9u for ; Wed, 28 Sep 2022 11:58:01 +0200 (CEST) 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 E59312400F4 for ; Wed, 28 Sep 2022 11:58:00 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 305553A014F for ; Wed, 28 Sep 2022 11:58:01 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Wed, 28 Sep 2022 11:55:48 +0200 Message-Id: <20220928095556.28209-1-anton@khirnov.net> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/9] fftools/ffmpeg: drop the -async option 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: mZgNrW8BBmEr It has been deprecated in favor of the aresample filter for almost 10 years. Another thing this option can do is drop audio timestamps and have them generated by the encoding code or the muxer, but - for encoding, this can already be done with the setpts filter - for muxing this should almost never be done as timestamp generation by the muxer is deprecated, but people who really want to do this can use the setts bitstream filter --- doc/ffmpeg.texi | 12 ------------ fftools/ffmpeg.c | 2 +- fftools/ffmpeg.h | 1 - fftools/ffmpeg_filter.c | 10 ---------- fftools/ffmpeg_mux.c | 3 +-- fftools/ffmpeg_opt.c | 3 --- 6 files changed, 2 insertions(+), 29 deletions(-) diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index 42440d93b4..e9020b30d5 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -1697,18 +1697,6 @@ The default is -1.1. One possible usecase is to avoid framedrops in case of noisy timestamps or to increase frame drop precision in case of exact timestamps. -@item -async @var{samples_per_second} -Audio sync method. "Stretches/squeezes" the audio stream to match the timestamps, -the parameter is the maximum samples per second by which the audio is changed. --async 1 is a special case where only the start of the audio stream is corrected -without any later correction. - -Note that the timestamps may be further modified by the muxer, after this. -For example, in the case that the format option @option{avoid_negative_ts} -is enabled. - -This option has been deprecated. Use the @code{aresample} audio filter instead. - @item -adrift_threshold @var{time} Set the minimum difference between timestamps and audio data (in seconds) to trigger adding/dropping samples to make it match the timestamps. This option effectively is diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 69716de6b6..f84701ec75 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -1048,7 +1048,7 @@ static void do_audio_out(OutputFile *of, OutputStream *ost, if (!check_recording_time(ost)) return; - if (frame->pts == AV_NOPTS_VALUE || audio_sync_method < 0) + if (frame->pts == AV_NOPTS_VALUE) frame->pts = ost->sync_opts; ost->sync_opts = frame->pts + frame->nb_samples; diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index ede0b2bd96..8acc83e92a 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -656,7 +656,6 @@ extern float audio_drift_threshold; extern float dts_delta_threshold; extern float dts_error_threshold; -extern int audio_sync_method; extern enum VideoSyncMethod video_sync_method; extern float frame_drop_threshold; extern int do_benchmark; diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index 17928cea2c..82abb38a93 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -892,16 +892,6 @@ static int configure_input_audio_filter(FilterGraph *fg, InputFilter *ifilter, last_filter = filt_ctx; \ } while (0) - if (audio_sync_method > 0) { - char args[256] = {0}; - - av_strlcatf(args, sizeof(args), "async=%d", audio_sync_method); - av_strlcatf(args, sizeof(args), ":min_hard_comp=%f", audio_drift_threshold); - if (!fg->reconfiguration) - av_strlcatf(args, sizeof(args), ":first_pts=0"); - AUTO_INSERT_FILTER_INPUT("-async", "aresample", args); - } - snprintf(name, sizeof(name), "trim for input stream %d:%d", ist->file_index, ist->st->index); if (copy_ts) { diff --git a/fftools/ffmpeg_mux.c b/fftools/ffmpeg_mux.c index b781e1f5a6..395f7cc89f 100644 --- a/fftools/ffmpeg_mux.c +++ b/fftools/ffmpeg_mux.c @@ -102,8 +102,7 @@ static int write_packet(OutputFile *of, OutputStream *ost, AVPacket *pkt) goto fail; } - if ((st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && ost->vsync_method == VSYNC_DROP) || - (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && audio_sync_method < 0)) + if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && ost->vsync_method == VSYNC_DROP) pkt->pts = pkt->dts = AV_NOPTS_VALUE; if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index 5febe319e4..8f57b699f1 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -157,7 +157,6 @@ float audio_drift_threshold = 0.1; float dts_delta_threshold = 10; float dts_error_threshold = 3600*30; -int audio_sync_method = 0; enum VideoSyncMethod video_sync_method = VSYNC_AUTO; float frame_drop_threshold = 0; int do_benchmark = 0; @@ -3910,8 +3909,6 @@ const OptionDef options[] = { "set video sync method globally; deprecated, use -fps_mode", "" }, { "frame_drop_threshold", HAS_ARG | OPT_FLOAT | OPT_EXPERT, { &frame_drop_threshold }, "frame drop threshold", "" }, - { "async", HAS_ARG | OPT_INT | OPT_EXPERT, { &audio_sync_method }, - "audio sync method", "" }, { "adrift_threshold", HAS_ARG | OPT_FLOAT | OPT_EXPERT, { &audio_drift_threshold }, "audio drift threshold", "threshold" }, { "copyts", OPT_BOOL | OPT_EXPERT, { ©_ts },