From patchwork Wed Sep 1 13:36:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 29938 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp566704iov; Wed, 1 Sep 2021 06:37:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwAzMLvFpEJs/Cub3nGOA3TyTS7v/dLnacctetSi55ZWFynMxTMNyIgd8pufClOpNV4WaPq X-Received: by 2002:a17:906:3745:: with SMTP id e5mr37067311ejc.400.1630503426195; Wed, 01 Sep 2021 06:37: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 a70si20774003edf.142.2021.09.01.06.37.04; Wed, 01 Sep 2021 06:37: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=@outlook.com header.s=selector1 header.b=rlyclI1e; arc=fail (body hash mismatch); 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 sp=QUARANTINE dis=NONE) header.from=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2611C68A4FA; Wed, 1 Sep 2021 16:37:00 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05olkn2093.outbound.protection.outlook.com [40.92.89.93]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 167ED68A181 for ; Wed, 1 Sep 2021 16:36:53 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IEvUO6i3tKWImosSkFcrqSJEz3g3+QXLRjaFwuH9eUzlraGidgQ5IVKyzEwQsQ5FogHco2Avp6W4GMRJmvo35HlgTU1w1PjbOBE+AK+G0RIEuKIuM4Bm0YWOK9yO08o7swZyptU2BErVY/sROfCkQgNtvqfneYzl9rPv7lCeobsX+LPde6WZJiufmztoVYmtv3jTi7R7TIbKMDmcXZMwB6nSb9yeCLZ4ylXEfnrCLOkkYahVBtUlEaHySGKxuCXKhrUBjGtmcHPG3ilToPWOK6Dw4QC2MYr+gVjiJZHRTnZD5qC0VicGc/1l0NtNpTMn+nAUaYMp4Lvm1RaDdW/paQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HsTIYhBe2GB/4WfQZTgg7+YQywOiFY/t+z/IzTXIn50=; b=Ia8vU9w0O05HbNMVAYj2s0L3yMvXfHvtH5P9imhRuS6DTHdJ4MfHPe+ZJA1NsudFPrXK73bIjCT/woEEBQENiZQY0hvxCt+FVqDd+5ZdUR0x1VwVZ9sTgDFuOCnVyTgueZf5Dud3n0sRxqOyjRsj+k/pj0GdN/0lIgQVTYXl5VSSj7YeGeH6+wlFMNDn0L9z5H3fbglFioxdZiZwUWvAI1iHsaOc+3/H4BbWdAqBbHaUhsH4nQCxyeFBOLPqA3iEy66so+PfXaX/j0IkETxvtMF9BWxhyWGz9RJPFdpe9n6uAQaSx9GHEDGOAGxKfLShKrG3SjjtxAJY1VBSdEfxPw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HsTIYhBe2GB/4WfQZTgg7+YQywOiFY/t+z/IzTXIn50=; b=rlyclI1eB6NbJ+4pJusOREGu4iq/y2SqCHoipZnWkA3s0VCF338Dih0XOchm53yOrUu1yIKSyBAA6wmLcuZ+hpF5dd53veznFcn0S4kIJexg5iQM0cFl6FgniW3tnWUqqeJltPQ0CYn6Eynlw7PD3X1KAuUjZ2TFey4ojMMUtJ38I5olP0nS6SWpgmPyhwZN6GUXcHAjXu3Z2fSgd4oVlamHlCOuSxGGIOj5+X8FQCstZ9AncXeg+ydi5Vyyq9ni5LK8IpjLLQGIkVx87ty3oN/3JZ5PXnAEgnKi2QPrHNUCxuXhowLDPyRTxRm+VyymRljp08TVeCpMu2rZY2zMnA== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM6PR03MB3607.eurprd03.prod.outlook.com (2603:10a6:209:34::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.23; Wed, 1 Sep 2021 13:36:51 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::f8b5:1ef2:89b2:f8c5]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::f8b5:1ef2:89b2:f8c5%7]) with mapi id 15.20.4457.024; Wed, 1 Sep 2021 13:36:51 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 1 Sep 2021 15:36:42 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 X-TMN: [qdD1vkBqstnD7VJ51cGUkOcpzInd7DVg] X-ClientProxiedBy: PR3P251CA0023.EURP251.PROD.OUTLOOK.COM (2603:10a6:102:b5::10) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20210901133642.2041484-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.142.38) by PR3P251CA0023.EURP251.PROD.OUTLOOK.COM (2603:10a6:102:b5::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.19 via Frontend Transport; Wed, 1 Sep 2021 13:36:50 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cb4cc171-9920-4097-a380-08d96d4d8dc3 X-MS-Exchange-SLBlob-MailProps: ZTmCor6bjd/mOweUk0FdmHPygxUS0qAHD33HZrjC+QWD+XJfwtBLK08rAdvBX8UYWIeGBUa6qGg0VWsdQ7jl2NjsLE+VGoJ/upjk+8Tlsvmh5bwsl5cqa+SdtGRD27c9qsO/fMI0c8tFvcxHQ/v1oeIOnpzOOx+90IFilkWBIPzqQEQrWx8lPdPBlXqNADC/6vss1mjxnC10FkhPRSB8TH6FrL2uoqLAJapaFdeNws4yqPdKwlfwKr5AUPbBLozXrvB60nrAqcRYJavFQ/11E271nCjD3c5ZojzIkMdckJuUV0nUEi0EPriWvAn7b8X5rxUOYAl/uYKppuidKDKam6ZwBKiuiURMqcJmNhsvYBZpILQjvICwXIDi4K6gZaaI34qDpaZc9Sz7m4KOIghH2EErCpbr8K0tUsJkEOA+/vtY6N79GFRAm8l1/LIOqTkXhHs7vu6kBBXvb17Qayh44uIQPJkH1be76ZZIe2FMrXiLB7ib6IH/H8L7RVGYrKB0mXqOjOoE568UeJKerIwSPopovPCH2bjngCb0yhs1EmLTwdZ7NGkh4BQ5PeoMS1Gjy5dlLc2xU8Rj5YGMXGKVu3sHQuUhKiEesQxaAp7fNXNErbn9qwuq6+McMv8CW5Fo3gpbsEegdlkultIfdHu2hfyhT2IsnAsMckYg0TODDq26vyPyPzh3T3Zhx3exXYJUF+o73QHPPBYsJ4jdIUIpOmUNVTiCxmZNCW5g28Qq78yNk3HSl/IJtYUWQNQy83F6GTz4jya6UiTkF6A9hsxEJm1LrJYY+FtT6G725ycF7ZWF6HZyaFdgYnVWYpDPNMkp X-MS-TrafficTypeDiagnostic: AM6PR03MB3607: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: L95m8tDKMr0OKWwZtBlLOeNhZMXtRMoru87EwOqdz2F+9PbuTpDQR0QeyVMpShJqqqM7qv5wc+ha+yVm/tzXNpJ6wQdqHjxG3yaGDQAk6t4OfX5UUqfXPmdsofGkyQiczmWOVBD6QbxAl8Z2YzaZlH8duM/oNlFB32YTlkXInLt7e38+KSvtsSqGZr7fl8wRLov5YEC0e8GLPvWzrjAB5AyHFOpGHTA04KrlMTSqzRhwp1OTaknh375swh6cPlapCQ86LVvkBaMND6HHe6E6AFnI8yv6ZZkWDwC/x5td7+Ji9XQEv98fEgYPWQhTv5tXlFHBwkMSPkM+8qzhDzYwHtQLSphq+q7ReyKwmlJuyO6SQvAhGDVeFqpYn7NfsgWWnxmOcA/tv9y2LTQ0oHfkIlOec6nLW5t1cJIcUM4CFE8ICMr52gl16hBA2KMkFvWe4SbnQg/PtJb1lJOcyf4FT+2jNpc4Dc9nGLA0h9hXpnM= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: L6uoo0geDMnQwQeO9jTY8T69PNGwhgdwV8UbWR95nYisARKx9o3fEJFMGuquGgqtdee6WahZdV6X3DADiSym5BaggwkzpkTlpIu6CXI72vLPjmguCl4aXbFIprrqHyiWoDQYSDgtRRfVtlaZxW1deA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: cb4cc171-9920-4097-a380-08d96d4d8dc3 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Sep 2021 13:36:51.2952 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR03MB3607 Subject: [FFmpeg-devel] [PATCH] Revert "ffmpeg: force 128k default audio bitrate if nothing is specified and there is no specific default" 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 Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: WiYOM0Lpjrg3 This reverts commit 628a73f8f3768513fa6152c98d54842cf2ae1aad. At the time of said commit there was talk of removing the audio bitrate "ab" option to bring FFmpeg in line with what Libav has done in 2012 in commit 041cd5a0c55e02dd3b9a2419644b03103819c3d3. By having different option flags for the "ab" and the ordinay bitrate "b" option is is possible to have different default bitrates for audio and video. In order to maintain this behaviour and not break user scripts the commit to be reverted added code to ffmpeg.c that set the bitrate value to the audio default for audio codecs, but only if AVCodec.defaults didn't exist (as in this case the default would be codec-default and not affected by the "ab" removal). This had the downside of being an API violation, because AVCodec.defaults is not a public field. Given that the "ab" option and its audio-specific default value have never been removed, said API violation can be simply fixed by reverting said commit. Signed-off-by: Andreas Rheinhardt --- There are a few more instances of fftools violating the API besides this one and the one in [1]: a) ffprobe accesses AVProgram.start_time and AVProgram.end_time. I only see two options here: Don't report these values or make them public. b) cmdutils accesses AVFilter.process_command. This could be fixed by adding an AVFILTER_FLAG_SUPPORT_COMMANDS and checking for that instead. c) ffplay checks for AVInputFormat.read_seek and the seeking flags to determine whether seeking is available. The way it does this seems wrong: It checks for whether any (not all!) of the default seeking methods (binary, generic, byte seek) is disabled and for whether there is a dedicated read_seek function. This could be fixed by adding a flag for AVInputFormats that tells whether seeking is supported (we could even distinguish the cases of "files of this format are usually well seekable" (e.g. because they usually contain an index) and "seeking is not that good, but works" (because e.g. it is just the generic seeking code that reads all packets linearly). Given that the seeking flags (with the exception of AVFMT_NO_BYTE_SEEK) are actually implementation details that are probably only public because there were no internal flags for AVInputFormat until recently this should be done at the same time as deprecating these fields. [1]: https://ffmpeg.org/pipermail/ffmpeg-devel/2021-September/284647.html fftools/ffmpeg.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index b0ce7c7c32..ecff156529 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -3571,11 +3571,6 @@ static int init_output_stream(OutputStream *ost, AVFrame *frame, } if (!av_dict_get(ost->encoder_opts, "threads", NULL, 0)) av_dict_set(&ost->encoder_opts, "threads", "auto", 0); - if (ost->enc->type == AVMEDIA_TYPE_AUDIO && - !codec->defaults && - !av_dict_get(ost->encoder_opts, "b", NULL, 0) && - !av_dict_get(ost->encoder_opts, "ab", NULL, 0)) - av_dict_set(&ost->encoder_opts, "b", "128000", 0); ret = hw_device_setup_for_encode(ost); if (ret < 0) {