From: Simone Karin Lehmann <simone@lisanet.de>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH] libavcodec/videotoolboxenc.c: add option to hevc encoder to prioritize speed.
Date: Thu, 14 Apr 2022 08:48:06 +0200
Message-ID: <5D3ED34A-A9B8-4870-B6C1-D462B086BC37@lisanet.de> (raw)
In-Reply-To: <80886934-2099-4FE0-A95D-F9B6658F777F@lisanet.de>
Somehow it seems, that this patch never got onto the mailing list. So may I kindly ask you to review it.
--
Stay hungry, stay foolish
> Am 26.01.2022 um 17:31 schrieb Simone Karin Lehmann <simone@lisanet.de>:
>
>
> The patch adds an option to the hevc_videotoolbox encoder to prioritize speed for Macs with Apple Silicon CPU.
>
> This speeds up encodings up to 50% - 70%. In conjunction with the qcale option -q, visible quality will be unchanged. The increase in file size is very moderate, although still depending on the source material.
>
>
> Signed-off-by: Simone Karin Lehmann <simone@lisanet.de>
> ---
> libavcodec/videotoolboxenc.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
> index 418ff00b8d..ab0dad6cbc 100644
> --- a/libavcodec/videotoolboxenc.c
> +++ b/libavcodec/videotoolboxenc.c
> @@ -236,6 +236,7 @@ typedef struct VTEncContext {
> int allow_sw;
> int require_sw;
> double alpha_quality;
> + int64_t prio_speed;
>
> bool flushing;
> int has_b_frames;
> @@ -1145,6 +1146,17 @@ static int vtenc_create_encoder(AVCodecContext *avctx,
> return AVERROR_EXTERNAL;
> }
>
> + // prioritize speed over quality
> + if (vtctx->prio_speed) {
> + status = VTSessionSetProperty(vtctx->session,
> + kVTCompressionPropertyKey_PrioritizeEncodingSpeedOverQuality,
> + kCFBooleanTrue);
> + if (status) {
> + av_log(avctx, AV_LOG_ERROR, "Error setting PrioritizeEncodingSpeedOverQuality property: %d\n", status);
> + return AVERROR_EXTERNAL;
> + }
> + }
> +
> if ((vtctx->codec_id == AV_CODEC_ID_H264 || vtctx->codec_id == AV_CODEC_ID_HEVC)
> && max_rate > 0) {
> bytes_per_second_value = max_rate >> 3;
> @@ -2744,6 +2756,7 @@ static const AVOption hevc_options[] = {
> { "main10", "Main10 Profile", 0, AV_OPT_TYPE_CONST, { .i64 = HEVC_PROF_MAIN10 }, INT_MIN, INT_MAX, VE, "profile" },
>
> { "alpha_quality", "Compression quality for the alpha channel", OFFSET(alpha_quality), AV_OPT_TYPE_DOUBLE, { .dbl = 0.0 }, 0.0, 1.0, VE },
> + { "prio_speed", "prioritize encoding speed", OFFSET(prio_speed), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
>
> COMMON_OPTIONS
> { NULL },
> --
> 2.32.0 (Apple Git-132)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next parent reply other threads:[~2022-04-14 6:51 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <80886934-2099-4FE0-A95D-F9B6658F777F@lisanet.de>
2022-04-14 6:48 ` Simone Karin Lehmann [this message]
2022-04-14 8:13 ` Thilo Borgmann
2022-04-21 15:42 ` Simone Karin Lehmann
2022-04-22 16:24 ` Andreas Rheinhardt
2022-04-22 16:52 ` Thilo Borgmann
2022-04-23 12:31 ` Simone Karin Lehmann
2022-04-23 15:07 ` Thilo Borgmann
2022-04-23 15:42 ` Simone Karin Lehmann
2022-04-23 19:56 ` Thilo Borgmann
2022-04-23 20:51 ` Simone Karin Lehmann
2022-04-24 10:10 ` Thilo Borgmann
2022-04-25 19:14 ` Rick Kern
2022-04-25 20:33 ` Simone Karin Lehmann
2022-05-01 17:31 ` Simone Karin Lehmann
2022-05-01 18:25 ` Richard Kern
2022-05-01 19:11 ` Simone Karin Lehmann
2022-05-02 15:18 ` Rick Kern
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5D3ED34A-A9B8-4870-B6C1-D462B086BC37@lisanet.de \
--to=simone@lisanet.de \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git