git: 6f28de3ee690 - main - multimedia/ffmpeg4: Undeprecate and update to 4.4.6
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 18 Mar 2026 12:40:50 UTC
The branch main has been updated by makc:
URL: https://cgit.FreeBSD.org/ports/commit/?id=6f28de3ee690ff7cc9e41ef133e1ed68b9851a37
commit 6f28de3ee690ff7cc9e41ef133e1ed68b9851a37
Author: Thibault Payet <monwarez@mailoo.org>
AuthorDate: 2026-03-18 12:40:24 +0000
Commit: Max Brazhnikov <makc@FreeBSD.org>
CommitDate: 2026-03-18 12:40:24 +0000
multimedia/ffmpeg4: Undeprecate and update to 4.4.6
Pass maintainetship from multimedia@ to submitter.
PR: 293842
---
multimedia/ffmpeg4/Makefile | 8 +-
multimedia/ffmpeg4/distinfo | 6 +-
multimedia/ffmpeg4/files/patch-configure | 63 ++--
multimedia/ffmpeg4/files/patch-doc-Makefile | 4 +-
.../ffmpeg4/files/patch-libavcodec_libsvtav1.c | 361 +++++++++++++++++-
multimedia/ffmpeg4/files/patch-libavdevice_v4l2.c | 18 -
multimedia/ffmpeg4/files/patch-libavformat_rtsp.c | 8 +-
multimedia/ffmpeg4/files/patch-libavutil-common.h | 4 +-
multimedia/ffmpeg4/files/patch-libavutil-x86-asm.h | 4 +-
.../files/patch-libswscale_ppc_yuv2rgb__altivec.c | 15 -
multimedia/ffmpeg4/files/patch-svtav1 | 410 +--------------------
multimedia/ffmpeg4/files/patch-vmaf | 26 +-
12 files changed, 393 insertions(+), 534 deletions(-)
diff --git a/multimedia/ffmpeg4/Makefile b/multimedia/ffmpeg4/Makefile
index e5cb726577fb..d288339f368c 100644
--- a/multimedia/ffmpeg4/Makefile
+++ b/multimedia/ffmpeg4/Makefile
@@ -1,20 +1,16 @@
PORTNAME= ffmpeg
-PORTVERSION= 4.4.4
-PORTREVISION= 30
+PORTVERSION= 4.4.6
CATEGORIES= multimedia audio net
MASTER_SITES= https://ffmpeg.org/releases/
PKGNAMESUFFIX= 4
-MAINTAINER= multimedia@FreeBSD.org
+MAINTAINER= monwarez@mailoo.org
COMMENT= Realtime audio/video encoder/converter and streaming server (legacy 4.* series)
WWW= https://ffmpeg.org/
LICENSE= GPLv2+ LGPL21+
LICENSE_COMB= multi
-DEPRECATED= Outdated and unsupported version, consider migrating to multimedia/ffmpeg
-EXPIRATION_DATE=2026-06-30
-
BUILD_DEPENDS= ${BUILD_DEPENDS_${ARCH}}
BUILD_DEPENDS_aarch64= as:devel/binutils
BUILD_DEPENDS_amd64= nasm:devel/nasm
diff --git a/multimedia/ffmpeg4/distinfo b/multimedia/ffmpeg4/distinfo
index 287f9dba3d86..ab830e49aada 100644
--- a/multimedia/ffmpeg4/distinfo
+++ b/multimedia/ffmpeg4/distinfo
@@ -1,6 +1,6 @@
-TIMESTAMP = 1681325571
-SHA256 (ffmpeg-4.4.4.tar.xz) = e80b380d595c809060f66f96a5d849511ef4a76a26b76eacf5778b94c3570309
-SIZE (ffmpeg-4.4.4.tar.xz) = 9565584
+TIMESTAMP = 1773592763
+SHA256 (ffmpeg-4.4.6.tar.xz) = 2290461f467c08ab801731ed412d8e724a5511d6c33173654bd9c1d2e25d0617
+SIZE (ffmpeg-4.4.6.tar.xz) = 9575932
SHA256 (0001-lavc-svt_hevc-add-libsvt-hevc-encoder-wrapper.patch) = 376ea23e9d876390fbca936c80cb437bb9daa6232ff65df0ea91673e18b739ff
SIZE (0001-lavc-svt_hevc-add-libsvt-hevc-encoder-wrapper.patch) = 24259
SHA256 (0002-doc-Add-libsvt_hevc-encoder-docs.patch) = d16589efc4be2602a9f436e9938cfee0cc7b5ccd7a4a6b41c0c9a59ae0859fda
diff --git a/multimedia/ffmpeg4/files/patch-configure b/multimedia/ffmpeg4/files/patch-configure
index 6135beab7ee8..87000d4090d5 100644
--- a/multimedia/ffmpeg4/files/patch-configure
+++ b/multimedia/ffmpeg4/files/patch-configure
@@ -1,43 +1,22 @@
---- configure.orig 2023-04-12 18:52:51 UTC
+https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/3d29724c008d
+
+--- configure.orig 2026-03-15 17:13:37 UTC
+++ configure
-@@ -3784,13 +3784,7 @@ target_os_default=$(tolower $(uname -s))
- host_os=$target_os_default
-
- # machine
--if test "$target_os_default" = aix; then
-- arch_default=$(uname -p)
-- strip_default="strip -X32_64"
-- nm_default="nm -g -X32_64"
--else
-- arch_default=$(uname -m)
--fi
-+arch_default=$(uname -p)
- cpu="generic"
- intrinsics="none"
-
-@@ -5387,6 +5381,7 @@ case $target_os in
- disable symver
- ;;
- freebsd)
-+ enable section_data_rel_ro
- ;;
- bsd/os)
- add_extralibs -lpoll -lgnugetopt
-@@ -6369,7 +6369,7 @@ enabled libfribidi && require_pkg_config libfri
- enabled libfontconfig && require_pkg_config libfontconfig fontconfig "fontconfig/fontconfig.h" FcInit
- enabled libfreetype && require_pkg_config libfreetype freetype2 "ft2build.h FT_FREETYPE_H" FT_Init_FreeType
- enabled libfribidi && require_pkg_config libfribidi fribidi fribidi.h fribidi_version_info
--enabled libglslang && require_cpp libglslang glslang/SPIRV/GlslangToSpv.h "glslang::TIntermediate*" -lglslang -lMachineIndependent -lOSDependent -lHLSL -lOGLCompiler -lGenericCodeGen -lSPVRemapper -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lpthread -lstdc++
-+enabled libglslang && require_cpp libglslang glslang/SPIRV/GlslangToSpv.h "glslang::TIntermediate*" -lglslang -lMachineIndependent -lOSDependent -lGenericCodeGen -lSPVRemapper -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lpthread -lstdc++
- enabled libgme && { check_pkg_config libgme libgme gme/gme.h gme_new_emu ||
- require libgme gme/gme.h gme_new_emu -lgme -lstdc++; }
- enabled libgsm && { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do
-@@ -6758,7 +6753,7 @@ enabled vulkan &&
-
- if enabled x86; then
- case $target_os in
-- mingw32*|mingw64*|win32|win64|linux|cygwin*)
-+ freebsd|mingw32*|mingw64*|win32|win64|linux|cygwin*)
- ;;
- *)
- disable ffnvcodec cuvid nvdec nvenc
+@@ -3668,7 +3668,7 @@ vidstabtransform_filter_deps="libvidstab"
+ vaguedenoiser_filter_deps="gpl"
+ vidstabdetect_filter_deps="libvidstab"
+ vidstabtransform_filter_deps="libvidstab"
+-libvmaf_filter_deps="libvmaf pthreads"
++libvmaf_filter_deps="libvmaf"
+ zmq_filter_deps="libzmq"
+ zoompan_filter_deps="swscale"
+ zscale_filter_deps="libzimg const_nan"
+@@ -6460,7 +6460,7 @@ enabled libvidstab && require_pkg_config libvid
+ enabled libuavs3d && require_pkg_config libuavs3d "uavs3d >= 1.1.41" uavs3d.h uavs3d_decode
+ enabled libv4l2 && require_pkg_config libv4l2 libv4l2 libv4l2.h v4l2_ioctl
+ enabled libvidstab && require_pkg_config libvidstab "vidstab >= 0.98" vid.stab/libvidstab.h vsMotionDetectInit
+-enabled libvmaf && require_pkg_config libvmaf "libvmaf >= 1.5.2" libvmaf.h compute_vmaf
++enabled libvmaf && require_pkg_config libvmaf "libvmaf >= 2.0.0" libvmaf.h vmaf_init
+ enabled libvo_amrwbenc && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc
+ enabled libvorbis && require_pkg_config libvorbis vorbis vorbis/codec.h vorbis_info_init &&
+ require_pkg_config libvorbisenc vorbisenc vorbis/vorbisenc.h vorbis_encode_init
diff --git a/multimedia/ffmpeg4/files/patch-doc-Makefile b/multimedia/ffmpeg4/files/patch-doc-Makefile
index 52ab4033ad98..118989b96e85 100644
--- a/multimedia/ffmpeg4/files/patch-doc-Makefile
+++ b/multimedia/ffmpeg4/files/patch-doc-Makefile
@@ -1,6 +1,6 @@
---- doc/Makefile.orig 2015-06-19 20:44:35 UTC
+--- doc/Makefile.orig 2025-03-12 11:48:35 UTC
+++ doc/Makefile
-@@ -145,7 +145,7 @@ install-html: $(HTMLPAGES)
+@@ -119,7 +119,7 @@ ifdef CONFIG_MANPAGES
endif
ifdef CONFIG_MANPAGES
diff --git a/multimedia/ffmpeg4/files/patch-libavcodec_libsvtav1.c b/multimedia/ffmpeg4/files/patch-libavcodec_libsvtav1.c
index 36eb954b63e1..77d50cf0ccea 100644
--- a/multimedia/ffmpeg4/files/patch-libavcodec_libsvtav1.c
+++ b/multimedia/ffmpeg4/files/patch-libavcodec_libsvtav1.c
@@ -1,16 +1,361 @@
-https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/d1ed5c06e3ed
-
---- libavcodec/libsvtav1.c.orig 2024-08-01 23:22:48 UTC
+--- libavcodec/libsvtav1.c.orig 2025-05-17 13:52:31 UTC
+++ libavcodec/libsvtav1.c
-@@ -389,7 +389,11 @@ static av_cold int eb_enc_init(AVCodecContext *avctx)
+@@ -60,17 +60,20 @@ typedef struct SvtContext {
+ EOS_STATUS eos_flag;
- svt_enc->eos_flag = EOS_NOT_REACHED;
+ // User options.
++ AVDictionary *svtav1_opts;
++#if FF_API_SVTAV1_OPTS
+ int hierarchical_level;
+ int la_depth;
+- int enc_mode;
+- int rc_mode;
+ int scd;
+- int qp;
-+#if SVT_AV1_CHECK_VERSION(3, 0, 0)
-+ svt_ret = svt_av1_enc_init_handle(&svt_enc->svt_handle, &svt_enc->enc_params);
+ int tier;
+
+ int tile_columns;
+ int tile_rows;
++#endif
++ int enc_mode;
++ int crf;
++ int qp;
+ } SvtContext;
+
+ static const struct {
+@@ -147,11 +150,136 @@ static int config_enc_params(EbSvtAv1EncConfiguration
+ {
+ SvtContext *svt_enc = avctx->priv_data;
+ const AVPixFmtDescriptor *desc;
++ AVDictionaryEntry *en = NULL;
+
++ // Update param from options
++#if FF_API_SVTAV1_OPTS
++ if (svt_enc->hierarchical_level >= 0)
++ param->hierarchical_levels = svt_enc->hierarchical_level;
++ if (svt_enc->tier >= 0)
++ param->tier = svt_enc->tier;
++ if (svt_enc->scd >= 0)
++ param->scene_change_detection = svt_enc->scd;
++ if (svt_enc->tile_columns >= 0)
++ param->tile_columns = svt_enc->tile_columns;
++ if (svt_enc->tile_rows >= 0)
++ param->tile_rows = svt_enc->tile_rows;
++
++ if (svt_enc->la_depth >= 0)
++ param->look_ahead_distance = svt_enc->la_depth;
++#endif
++
++ if (svt_enc->enc_mode >= 0)
++ param->enc_mode = svt_enc->enc_mode;
++
++ if (avctx->bit_rate) {
++ param->target_bit_rate = avctx->bit_rate;
++ if (avctx->rc_max_rate != avctx->bit_rate)
++ param->rate_control_mode = 1;
++ else
++ param->rate_control_mode = 2;
++
++ param->max_qp_allowed = avctx->qmax;
++ param->min_qp_allowed = avctx->qmin;
++ }
++ param->max_bit_rate = avctx->rc_max_rate;
++ if (avctx->bit_rate && avctx->rc_buffer_size)
++ param->maximum_buffer_size_ms = avctx->rc_buffer_size * 1000LL / avctx->bit_rate;
++
++ if (svt_enc->crf > 0) {
++ param->qp = svt_enc->crf;
++ param->rate_control_mode = 0;
++ } else if (svt_enc->qp > 0) {
++ param->qp = svt_enc->qp;
++ param->rate_control_mode = 0;
++#if SVT_AV1_CHECK_VERSION(4, 0, 0)
++ param->aq_mode = 0;
+#else
- svt_ret = svt_av1_enc_init_handle(&svt_enc->svt_handle, svt_enc, &svt_enc->enc_params);
++ param->enable_adaptive_quantization = 0;
++#endif
++ }
++
++ desc = av_pix_fmt_desc_get(avctx->pix_fmt);
++ param->color_primaries = avctx->color_primaries;
++ param->matrix_coefficients = (desc->flags & AV_PIX_FMT_FLAG_RGB) ?
++ AVCOL_SPC_RGB : avctx->colorspace;
++ param->transfer_characteristics = avctx->color_trc;
++
++ if (avctx->color_range != AVCOL_RANGE_UNSPECIFIED)
++ param->color_range = avctx->color_range == AVCOL_RANGE_JPEG;
++ else
++ param->color_range = !!(desc->flags & AV_PIX_FMT_FLAG_RGB);
++
++#if SVT_AV1_CHECK_VERSION(1, 0, 0)
++ if (avctx->chroma_sample_location != AVCHROMA_LOC_UNSPECIFIED) {
++ const char *name =
++ av_chroma_location_name(avctx->chroma_sample_location);
++
++ switch (avctx->chroma_sample_location) {
++ case AVCHROMA_LOC_LEFT:
++ param->chroma_sample_position = EB_CSP_VERTICAL;
++ break;
++ case AVCHROMA_LOC_TOPLEFT:
++ param->chroma_sample_position = EB_CSP_COLOCATED;
++ break;
++ default:
++ if (!name)
++ break;
++
++ av_log(avctx, AV_LOG_WARNING,
++ "Specified chroma sample location %s is unsupported "
++ "on the AV1 bit stream level. Usage of a container that "
++ "allows passing this information - such as Matroska - "
++ "is recommended.\n",
++ name);
++ break;
++ }
++ }
+#endif
++
++ if (avctx->profile != FF_PROFILE_UNKNOWN)
++ param->profile = avctx->profile;
++
++ if (avctx->level != FF_LEVEL_UNKNOWN)
++ param->level = avctx->level;
++
++ if (avctx->gop_size > 0)
++ param->intra_period_length = avctx->gop_size - 1;
++
++ if (avctx->framerate.num > 0 && avctx->framerate.den > 0) {
++ param->frame_rate_numerator = avctx->framerate.num;
++ param->frame_rate_denominator = avctx->framerate.den;
++ } else {
++ param->frame_rate_numerator = avctx->time_base.den;
++ param->frame_rate_denominator = avctx->time_base.num * avctx->ticks_per_frame;
++ }
++
++ /* 2 = IDR, closed GOP, 1 = CRA, open GOP */
++ param->intra_refresh_type = avctx->flags & AV_CODEC_FLAG_CLOSED_GOP ? 2 : 1;
++
++#if SVT_AV1_CHECK_VERSION(0, 9, 1)
++ while ((en = av_dict_get(svt_enc->svtav1_opts, "", en, AV_DICT_IGNORE_SUFFIX))) {
++ EbErrorType ret = svt_av1_enc_parse_parameter(param, en->key, en->value);
++ if (ret != EB_ErrorNone) {
++ int level = (avctx->err_recognition & AV_EF_EXPLODE) ? AV_LOG_ERROR : AV_LOG_WARNING;
++ av_log(avctx, level, "Error parsing option %s: %s.\n", en->key, en->value);
++ if (avctx->err_recognition & AV_EF_EXPLODE)
++ return AVERROR(EINVAL);
++ }
++ }
++#else
++ if ((en = av_dict_get(svt_enc->svtav1_opts, "", NULL, AV_DICT_IGNORE_SUFFIX))) {
++ int level = (avctx->err_recognition & AV_EF_EXPLODE) ? AV_LOG_ERROR : AV_LOG_WARNING;
++ av_log(avctx, level, "svt-params needs libavcodec to be compiled with SVT-AV1 "
++ "headers >= 0.9.1.\n");
++ if (avctx->err_recognition & AV_EF_EXPLODE)
++ return AVERROR(ENOSYS);
++ }
++#endif
++
+ param->source_width = avctx->width;
+ param->source_height = avctx->height;
+
+- desc = av_pix_fmt_desc_get(avctx->pix_fmt);
+ param->encoder_bit_depth = desc->comp[0].depth;
+
+ if (desc->log2_chroma_w == 1 && desc->log2_chroma_h == 1)
+@@ -165,12 +293,6 @@ static int config_enc_params(EbSvtAv1EncConfiguration
+ return AVERROR(EINVAL);
+ }
+
+- if (avctx->profile != FF_PROFILE_UNKNOWN)
+- param->profile = avctx->profile;
+-
+- if (avctx->level != FF_LEVEL_UNKNOWN)
+- param->level = avctx->level;
+-
+ if ((param->encoder_color_format == EB_YUV422 || param->encoder_bit_depth > 10)
+ && param->profile != FF_PROFILE_AV1_PROFESSIONAL ) {
+ av_log(avctx, AV_LOG_WARNING, "Forcing Professional profile\n");
+@@ -180,40 +302,21 @@ static int config_enc_params(EbSvtAv1EncConfiguration
+ param->profile = FF_PROFILE_AV1_HIGH;
+ }
+
+- // Update param from options
+- param->hierarchical_levels = svt_enc->hierarchical_level;
+- param->enc_mode = svt_enc->enc_mode;
+- param->tier = svt_enc->tier;
+- param->rate_control_mode = svt_enc->rc_mode;
+- param->scene_change_detection = svt_enc->scd;
+- param->qp = svt_enc->qp;
++ avctx->bit_rate = param->rate_control_mode > 0 ?
++ param->target_bit_rate : 0;
++ avctx->rc_max_rate = param->max_bit_rate;
++ avctx->rc_buffer_size = param->maximum_buffer_size_ms * avctx->bit_rate / 1000LL;
+
+- param->target_bit_rate = avctx->bit_rate;
++ if (avctx->bit_rate || avctx->rc_max_rate || avctx->rc_buffer_size) {
++ AVCPBProperties *cpb_props = ff_add_cpb_side_data(avctx);
++ if (!cpb_props)
++ return AVERROR(ENOMEM);
+
+- if (avctx->gop_size > 0)
+- param->intra_period_length = avctx->gop_size - 1;
+-
+- if (avctx->framerate.num > 0 && avctx->framerate.den > 0) {
+- param->frame_rate_numerator = avctx->framerate.num;
+- param->frame_rate_denominator = avctx->framerate.den;
+- } else {
+- param->frame_rate_numerator = avctx->time_base.den;
+- param->frame_rate_denominator = avctx->time_base.num * avctx->ticks_per_frame;
++ cpb_props->buffer_size = avctx->rc_buffer_size;
++ cpb_props->max_bitrate = avctx->rc_max_rate;
++ cpb_props->avg_bitrate = avctx->bit_rate;
+ }
+
+- if (param->rate_control_mode) {
+- param->max_qp_allowed = avctx->qmax;
+- param->min_qp_allowed = avctx->qmin;
+- }
+-
+- param->intra_refresh_type = 2; /* Real keyframes only */
+-
+- if (svt_enc->la_depth >= 0)
+- param->look_ahead_distance = svt_enc->la_depth;
+-
+- param->tile_columns = svt_enc->tile_columns;
+- param->tile_rows = svt_enc->tile_rows;
+-
+ return 0;
+ }
+
+@@ -262,7 +365,7 @@ static av_cold int eb_enc_init(AVCodecContext *avctx)
+
+ svt_enc->eos_flag = EOS_NOT_REACHED;
+
+- svt_ret = svt_av1_enc_init_handle(&svt_enc->svt_handle, svt_enc, &svt_enc->enc_params);
++ svt_ret = svt_av1_enc_init_handle(&svt_enc->svt_handle, &svt_enc->enc_params);
if (svt_ret != EB_ErrorNone) {
return svt_print_error(avctx, svt_ret, "Error initializing encoder handle");
}
+@@ -326,11 +429,8 @@ static int eb_send_frame(AVCodecContext *avctx, const
+ if (svt_enc->eos_flag == EOS_SENT)
+ return 0;
+
+- headerPtrLast.n_alloc_len = 0;
+- headerPtrLast.n_filled_len = 0;
+- headerPtrLast.n_tick_count = 0;
+- headerPtrLast.p_app_private = NULL;
+- headerPtrLast.p_buffer = NULL;
++ memset(&headerPtrLast, 0, sizeof(headerPtrLast));
++ headerPtrLast.pic_type = EB_AV1_INVALID_PICTURE;
+ headerPtrLast.flags = EB_BUFFERFLAG_EOS;
+
+ svt_av1_enc_send_picture(svt_enc->svt_handle, &headerPtrLast);
+@@ -346,6 +446,16 @@ static int eb_send_frame(AVCodecContext *avctx, const
+ headerPtr->p_app_private = NULL;
+ headerPtr->pts = frame->pts;
+
++ switch (frame->pict_type) {
++ case AV_PICTURE_TYPE_I:
++ headerPtr->pic_type = EB_AV1_KEY_PICTURE;
++ break;
++ default:
++ // Actually means auto, or default.
++ headerPtr->pic_type = EB_AV1_INVALID_PICTURE;
++ break;
++ }
++
+ svt_av1_enc_send_picture(svt_enc->svt_handle, headerPtr);
+
+ return 0;
+@@ -468,21 +578,22 @@ static const AVOption options[] = {
+ #define OFFSET(x) offsetof(SvtContext, x)
+ #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
+ static const AVOption options[] = {
+- { "hielevel", "Hierarchical prediction levels setting", OFFSET(hierarchical_level),
+- AV_OPT_TYPE_INT, { .i64 = 4 }, 3, 4, VE , "hielevel"},
++#if FF_API_SVTAV1_OPTS
++ { "hielevel", "Hierarchical prediction levels setting (Deprecated, use svtav1-params)", OFFSET(hierarchical_level),
++ AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 4, VE | AV_OPT_FLAG_DEPRECATED , "hielevel"},
+ { "3level", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 3 }, INT_MIN, INT_MAX, VE, "hielevel" },
+ { "4level", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 4 }, INT_MIN, INT_MAX, VE, "hielevel" },
+
+- { "la_depth", "Look ahead distance [0, 120]", OFFSET(la_depth),
+- AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 120, VE },
++ { "la_depth", "Look ahead distance [0, 120] (Deprecated, use svtav1-params)", OFFSET(la_depth),
++ AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 120, VE | AV_OPT_FLAG_DEPRECATED },
+
+- { "preset", "Encoding preset [0, 8]",
+- OFFSET(enc_mode), AV_OPT_TYPE_INT, { .i64 = MAX_ENC_PRESET }, 0, MAX_ENC_PRESET, VE },
+-
+- { "tier", "Set operating point tier", OFFSET(tier),
+- AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE, "tier" },
++ { "tier", "Set operating point tier (Deprecated, use svtav1-params)", OFFSET(tier),
++ AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE | AV_OPT_FLAG_DEPRECATED, "tier" },
+ { "main", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, 0, 0, VE, "tier" },
+ { "high", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, 0, 0, VE, "tier" },
++#endif
++ { "preset", "Encoding preset",
++ OFFSET(enc_mode), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, MAX_ENC_PRESET, VE },
+
+ FF_AV1_PROFILE_OPTS
+
+@@ -514,21 +625,20 @@ static const AVOption options[] = {
+ { LEVEL("7.3", 73) },
+ #undef LEVEL
+
+- { "rc", "Bit rate control mode", OFFSET(rc_mode),
+- AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 3, VE , "rc"},
+- { "cqp", "Constant quantizer", 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, INT_MIN, INT_MAX, VE, "rc" },
+- { "vbr", "Variable Bit Rate, use a target bitrate for the entire stream", 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, INT_MIN, INT_MAX, VE, "rc" },
+- { "cvbr", "Constrained Variable Bit Rate, use a target bitrate for each GOP", 0, AV_OPT_TYPE_CONST,{ .i64 = 2 }, INT_MIN, INT_MAX, VE, "rc" },
++ { "crf", "Constant Rate Factor value", OFFSET(crf),
++ AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 63, VE },
++ { "qp", "Initial Quantizer level value", OFFSET(qp),
++ AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 63, VE },
++#if FF_API_SVTAV1_OPTS
++ { "sc_detection", "Scene change detection (Deprecated, use svtav1-params)", OFFSET(scd),
++ AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, VE | AV_OPT_FLAG_DEPRECATED },
+
+- { "qp", "Quantizer to use with cqp rate control mode", OFFSET(qp),
+- AV_OPT_TYPE_INT, { .i64 = 50 }, 0, 63, VE },
++ { "tile_columns", "Log2 of number of tile columns to use (Deprecated, use svtav1-params)", OFFSET(tile_columns), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 4, VE | AV_OPT_FLAG_DEPRECATED },
++ { "tile_rows", "Log2 of number of tile rows to use (Deprecated, use svtav1-params)", OFFSET(tile_rows), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 6, VE | AV_OPT_FLAG_DEPRECATED },
++#endif
+
+- { "sc_detection", "Scene change detection", OFFSET(scd),
+- AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
++ { "svtav1-params", "Set the SVT-AV1 configuration using a :-separated list of key=value parameters", OFFSET(svtav1_opts), AV_OPT_TYPE_DICT, { 0 }, 0, 0, VE },
+
+- { "tile_columns", "Log2 of number of tile columns to use", OFFSET(tile_columns), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 4, VE},
+- { "tile_rows", "Log2 of number of tile rows to use", OFFSET(tile_rows), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 6, VE},
+-
+ {NULL},
+ };
+
+@@ -540,9 +650,10 @@ static const AVCodecDefault eb_enc_defaults[] = {
+ };
+
+ static const AVCodecDefault eb_enc_defaults[] = {
+- { "b", "7M" },
++ { "b", "0" },
++ { "flags", "+cgop" },
+ { "g", "-1" },
+- { "qmin", "0" },
++ { "qmin", "1" },
+ { "qmax", "63" },
+ { NULL },
+ };
+@@ -557,12 +668,11 @@ AVCodec ff_libsvtav1_encoder = {
+ .receive_packet = eb_receive_packet,
+ .close = eb_enc_close,
+ .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_OTHER_THREADS,
+- .caps_internal = FF_CODEC_CAP_AUTO_THREADS,
++ .caps_internal = FF_CODEC_CAP_AUTO_THREADS | FF_CODEC_CAP_INIT_CLEANUP,
+ .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P,
+ AV_PIX_FMT_YUV420P10,
+ AV_PIX_FMT_NONE },
+ .priv_class = &class,
+ .defaults = eb_enc_defaults,
+- .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
+ .wrapper_name = "libsvtav1",
+ };
diff --git a/multimedia/ffmpeg4/files/patch-libavdevice_v4l2.c b/multimedia/ffmpeg4/files/patch-libavdevice_v4l2.c
deleted file mode 100644
index 8518fadce3af..000000000000
--- a/multimedia/ffmpeg4/files/patch-libavdevice_v4l2.c
+++ /dev/null
@@ -1,18 +0,0 @@
-- ioctl() prototype on BSDs follows Version 7 AT&T UNIX
-
---- libavdevice/v4l2.c.orig 2019-04-21 04:37:17 UTC
-+++ libavdevice/v4l2.c
-@@ -95,10 +95,10 @@ struct video_data {
- int (*open_f)(const char *file, int oflag, ...);
- int (*close_f)(int fd);
- int (*dup_f)(int fd);
--#ifdef __GLIBC__
-- int (*ioctl_f)(int fd, unsigned long int request, ...);
--#else
-+#if defined(__sun) || defined(__BIONIC__) || defined(__musl__) /* POSIX-like */
- int (*ioctl_f)(int fd, int request, ...);
-+#else
-+ int (*ioctl_f)(int fd, unsigned long int request, ...);
- #endif
- ssize_t (*read_f)(int fd, void *buffer, size_t n);
- void *(*mmap_f)(void *start, size_t length, int prot, int flags, int fd, int64_t offset);
diff --git a/multimedia/ffmpeg4/files/patch-libavformat_rtsp.c b/multimedia/ffmpeg4/files/patch-libavformat_rtsp.c
index 7cd751dbd79c..e56281ecea34 100644
--- a/multimedia/ffmpeg4/files/patch-libavformat_rtsp.c
+++ b/multimedia/ffmpeg4/files/patch-libavformat_rtsp.c
@@ -1,6 +1,6 @@
---- libavformat/rtsp.c.orig 2016-10-27 16:17:40 UTC
+--- libavformat/rtsp.c.orig 2025-05-17 13:52:31 UTC
+++ libavformat/rtsp.c
-@@ -1614,7 +1614,12 @@ int ff_rtsp_make_setup_request(AVFormatC
+@@ -1672,7 +1672,12 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, con
}
if (ttl > 0)
snprintf(optbuf, sizeof(optbuf), "?ttl=%d", ttl);
@@ -14,7 +14,7 @@
namebuf, sizeof(namebuf), NULL, 0, NI_NUMERICHOST);
ff_url_join(url, sizeof(url), "rtp", NULL, namebuf,
port, "%s", optbuf);
-@@ -1830,8 +1835,13 @@ redirect:
+@@ -1906,8 +1911,13 @@ redirect:
goto fail;
}
if (!getpeername(tcp_fd, (struct sockaddr*) &peer, &peer_len)) {
@@ -30,7 +30,7 @@
}
/* request options supported by the server; this also detects server
-@@ -2310,7 +2320,11 @@ static int sdp_read_header(AVFormatConte
+@@ -2425,7 +2435,11 @@ static int sdp_read_header(AVFormatContext *s)
AVDictionary *opts = map_to_opts(rt);
err = getnameinfo((struct sockaddr*) &rtsp_st->sdp_ip,
diff --git a/multimedia/ffmpeg4/files/patch-libavutil-common.h b/multimedia/ffmpeg4/files/patch-libavutil-common.h
index 2c8c84e6d372..4baccfda1089 100644
--- a/multimedia/ffmpeg4/files/patch-libavutil-common.h
+++ b/multimedia/ffmpeg4/files/patch-libavutil-common.h
@@ -1,6 +1,6 @@
---- libavutil/common.h.orig 2015-06-19 20:44:53 UTC
+--- libavutil/common.h.orig 2025-05-17 13:52:31 UTC
+++ libavutil/common.h
-@@ -49,6 +49,10 @@
+@@ -50,6 +50,10 @@
# define AV_NE(be, le) (le)
#endif
diff --git a/multimedia/ffmpeg4/files/patch-libavutil-x86-asm.h b/multimedia/ffmpeg4/files/patch-libavutil-x86-asm.h
index 71e31a029955..7f9a7d5e59f1 100644
--- a/multimedia/ffmpeg4/files/patch-libavutil-x86-asm.h
+++ b/multimedia/ffmpeg4/files/patch-libavutil-x86-asm.h
@@ -1,6 +1,6 @@
---- libavutil/x86/asm.h.orig 2015-06-19 20:44:54 UTC
+--- libavutil/x86/asm.h.orig 2023-11-09 23:38:51 UTC
+++ libavutil/x86/asm.h
-@@ -71,7 +71,7 @@ typedef int32_t x86_reg;
+@@ -72,7 +72,7 @@ typedef int x86_reg;
typedef int x86_reg;
#endif
diff --git a/multimedia/ffmpeg4/files/patch-libswscale_ppc_yuv2rgb__altivec.c b/multimedia/ffmpeg4/files/patch-libswscale_ppc_yuv2rgb__altivec.c
deleted file mode 100644
index 38ff9087b842..000000000000
--- a/multimedia/ffmpeg4/files/patch-libswscale_ppc_yuv2rgb__altivec.c
+++ /dev/null
@@ -1,15 +0,0 @@
-Error:
-libswscale/ppc/yuv2rgb_altivec.c:288:36: error: redeclaration of 'vec_xl' must have the 'overloadable' attribute
-static inline vector unsigned char vec_xl(signed long long offset, const ubyte *addr)
-
---- libswscale/ppc/yuv2rgb_altivec.c.orig 2021-04-08 21:28:40 UTC
-+++ libswscale/ppc/yuv2rgb_altivec.c
-@@ -284,7 +284,7 @@ static inline void cvtyuvtoRGB(SwsContext *c, vector s
- * ------------------------------------------------------------------------------
- */
-
--#if !HAVE_VSX
-+#if !HAVE_VSX && !defined(__clang__)
- static inline vector unsigned char vec_xl(signed long long offset, const ubyte *addr)
- {
- const vector unsigned char *v_addr = (const vector unsigned char *) (addr + offset);
diff --git a/multimedia/ffmpeg4/files/patch-svtav1 b/multimedia/ffmpeg4/files/patch-svtav1
index dc32623e0d6a..65596fd6cbd2 100644
--- a/multimedia/ffmpeg4/files/patch-svtav1
+++ b/multimedia/ffmpeg4/files/patch-svtav1
@@ -1,38 +1,4 @@
-https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/04b89e8ae33b
-https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/64e2fb3f9d89
-https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/0463f5d6d56d
-https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/c5f314309067
-https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/c33b4048859a
-https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/a2b090da7932
-https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/1dddb930aaf0
-https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/4e47ebf38b97
-https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/50bc87263576
-https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/d794b36a7788
-https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/51c0b9e829be
-https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/e3c4442b249a
-https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/6fd1533057ff
-https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/ded0334d214f
-https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/70887d44ffa3
-https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/fe100bc556d7
-https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/fb70e0611bd7
-https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/031f1561cd28
-https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/1c6fd7d756af
-https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/96748ac54f99
-https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/fe196fd29a67
-https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/a5d4c398b411
-
---- configure.orig 2021-10-24 20:47:11 UTC
-+++ configure
-@@ -6430,7 +6430,7 @@ enabled libsrt && require_pkg_config libsrt
- enabled libssh && require_pkg_config libssh libssh libssh/sftp.h sftp_init
- enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init
- enabled libsrt && require_pkg_config libsrt "srt >= 1.3.0" srt/srt.h srt_socket
--enabled libsvtav1 && require_pkg_config libsvtav1 "SvtAv1Enc >= 0.8.4" EbSvtAv1Enc.h svt_av1_enc_init_handle
-+enabled libsvtav1 && require_pkg_config libsvtav1 "SvtAv1Enc >= 0.9.0" EbSvtAv1Enc.h svt_av1_enc_init_handle
- enabled libtensorflow && require libtensorflow tensorflow/c/c_api.h TF_Version -ltensorflow
- enabled libtesseract && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate
- enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
---- doc/encoders.texi.orig 2021-10-24 20:47:07 UTC
+--- doc/encoders.texi.orig 2025-05-17 13:52:31 UTC
+++ doc/encoders.texi
@@ -1754,28 +1754,15 @@ Set the operating point tier.
@item tier
@@ -87,379 +53,7 @@ https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/a5d4c398b411
@end table
---- libavcodec/libsvtav1.c.orig 2021-10-24 20:47:07 UTC
-+++ libavcodec/libsvtav1.c
-@@ -60,17 +60,20 @@ typedef struct SvtContext {
- EOS_STATUS eos_flag;
-
- // User options.
-+ AVDictionary *svtav1_opts;
-+#if FF_API_SVTAV1_OPTS
- int hierarchical_level;
- int la_depth;
-- int enc_mode;
-- int rc_mode;
- int scd;
-- int qp;
-
- int tier;
-
- int tile_columns;
- int tile_rows;
-+#endif
-+ int enc_mode;
-+ int crf;
-+ int qp;
- } SvtContext;
-
- static const struct {
-@@ -120,16 +123,12 @@ static int alloc_buffer(EbSvtAv1EncConfiguration *conf
-
- static int alloc_buffer(EbSvtAv1EncConfiguration *config, SvtContext *svt_enc)
- {
-- const int pack_mode_10bit =
-- (config->encoder_bit_depth > 8) && (config->compressed_ten_bit_format == 0) ? 1 : 0;
-- const size_t luma_size_8bit =
-- config->source_width * config->source_height * (1 << pack_mode_10bit);
-- const size_t luma_size_10bit =
-- (config->encoder_bit_depth > 8 && pack_mode_10bit == 0) ? luma_size_8bit : 0;
-+ const size_t luma_size = config->source_width * config->source_height *
-+ (config->encoder_bit_depth > 8 ? 2 : 1);
-
- EbSvtIOFormat *in_data;
-
-- svt_enc->raw_size = (luma_size_8bit + luma_size_10bit) * 3 / 2;
-+ svt_enc->raw_size = luma_size * 3 / 2;
-
- // allocate buffer for in and out
- svt_enc->in_buf = av_mallocz(sizeof(*svt_enc->in_buf));
-@@ -151,11 +150,136 @@ static int config_enc_params(EbSvtAv1EncConfiguration
- {
- SvtContext *svt_enc = avctx->priv_data;
- const AVPixFmtDescriptor *desc;
-+ AVDictionaryEntry *en = NULL;
-
-+ // Update param from options
-+#if FF_API_SVTAV1_OPTS
-+ if (svt_enc->hierarchical_level >= 0)
-+ param->hierarchical_levels = svt_enc->hierarchical_level;
-+ if (svt_enc->tier >= 0)
-+ param->tier = svt_enc->tier;
-+ if (svt_enc->scd >= 0)
-+ param->scene_change_detection = svt_enc->scd;
-+ if (svt_enc->tile_columns >= 0)
-+ param->tile_columns = svt_enc->tile_columns;
-+ if (svt_enc->tile_rows >= 0)
-+ param->tile_rows = svt_enc->tile_rows;
-+
-+ if (svt_enc->la_depth >= 0)
-+ param->look_ahead_distance = svt_enc->la_depth;
-+#endif
-+
-+ if (svt_enc->enc_mode >= 0)
-+ param->enc_mode = svt_enc->enc_mode;
-+
-+ if (avctx->bit_rate) {
-+ param->target_bit_rate = avctx->bit_rate;
-+ if (avctx->rc_max_rate != avctx->bit_rate)
-+ param->rate_control_mode = 1;
-+ else
-+ param->rate_control_mode = 2;
-+
-+ param->max_qp_allowed = avctx->qmax;
-+ param->min_qp_allowed = avctx->qmin;
-+ }
-+ param->max_bit_rate = avctx->rc_max_rate;
-+ if (avctx->bit_rate && avctx->rc_buffer_size)
-+ param->maximum_buffer_size_ms = avctx->rc_buffer_size * 1000LL / avctx->bit_rate;
-+
-+ if (svt_enc->crf > 0) {
-+ param->qp = svt_enc->crf;
-+ param->rate_control_mode = 0;
-+ } else if (svt_enc->qp > 0) {
-+ param->qp = svt_enc->qp;
-+ param->rate_control_mode = 0;
-+#if SVT_AV1_CHECK_VERSION(4, 0, 0)
-+ param->aq_mode = 0;
-+#else
-+ param->enable_adaptive_quantization = 0;
-+#endif
-+ }
-+
-+ desc = av_pix_fmt_desc_get(avctx->pix_fmt);
-+ param->color_primaries = avctx->color_primaries;
-+ param->matrix_coefficients = (desc->flags & AV_PIX_FMT_FLAG_RGB) ?
-+ AVCOL_SPC_RGB : avctx->colorspace;
-+ param->transfer_characteristics = avctx->color_trc;
-+
-+ if (avctx->color_range != AVCOL_RANGE_UNSPECIFIED)
-+ param->color_range = avctx->color_range == AVCOL_RANGE_JPEG;
-+ else
-+ param->color_range = !!(desc->flags & AV_PIX_FMT_FLAG_RGB);
-+
-+#if SVT_AV1_CHECK_VERSION(1, 0, 0)
-+ if (avctx->chroma_sample_location != AVCHROMA_LOC_UNSPECIFIED) {
-+ const char *name =
-+ av_chroma_location_name(avctx->chroma_sample_location);
-+
-+ switch (avctx->chroma_sample_location) {
-+ case AVCHROMA_LOC_LEFT:
-+ param->chroma_sample_position = EB_CSP_VERTICAL;
-+ break;
-+ case AVCHROMA_LOC_TOPLEFT:
-+ param->chroma_sample_position = EB_CSP_COLOCATED;
-+ break;
-+ default:
-+ if (!name)
-+ break;
-+
-+ av_log(avctx, AV_LOG_WARNING,
-+ "Specified chroma sample location %s is unsupported "
-+ "on the AV1 bit stream level. Usage of a container that "
-+ "allows passing this information - such as Matroska - "
-+ "is recommended.\n",
-+ name);
-+ break;
-+ }
-+ }
-+#endif
-+
-+ if (avctx->profile != FF_PROFILE_UNKNOWN)
-+ param->profile = avctx->profile;
-+
-+ if (avctx->level != FF_LEVEL_UNKNOWN)
-+ param->level = avctx->level;
-+
-+ if (avctx->gop_size > 0)
-+ param->intra_period_length = avctx->gop_size - 1;
-+
-+ if (avctx->framerate.num > 0 && avctx->framerate.den > 0) {
-+ param->frame_rate_numerator = avctx->framerate.num;
-+ param->frame_rate_denominator = avctx->framerate.den;
-+ } else {
-+ param->frame_rate_numerator = avctx->time_base.den;
-+ param->frame_rate_denominator = avctx->time_base.num * avctx->ticks_per_frame;
-+ }
-+
-+ /* 2 = IDR, closed GOP, 1 = CRA, open GOP */
-+ param->intra_refresh_type = avctx->flags & AV_CODEC_FLAG_CLOSED_GOP ? 2 : 1;
-+
-+#if SVT_AV1_CHECK_VERSION(0, 9, 1)
-+ while ((en = av_dict_get(svt_enc->svtav1_opts, "", en, AV_DICT_IGNORE_SUFFIX))) {
-+ EbErrorType ret = svt_av1_enc_parse_parameter(param, en->key, en->value);
-+ if (ret != EB_ErrorNone) {
-+ int level = (avctx->err_recognition & AV_EF_EXPLODE) ? AV_LOG_ERROR : AV_LOG_WARNING;
-+ av_log(avctx, level, "Error parsing option %s: %s.\n", en->key, en->value);
-+ if (avctx->err_recognition & AV_EF_EXPLODE)
-+ return AVERROR(EINVAL);
-+ }
-+ }
-+#else
-+ if ((en = av_dict_get(svt_enc->svtav1_opts, "", NULL, AV_DICT_IGNORE_SUFFIX))) {
-+ int level = (avctx->err_recognition & AV_EF_EXPLODE) ? AV_LOG_ERROR : AV_LOG_WARNING;
-+ av_log(avctx, level, "svt-params needs libavcodec to be compiled with SVT-AV1 "
-+ "headers >= 0.9.1.\n");
-+ if (avctx->err_recognition & AV_EF_EXPLODE)
-+ return AVERROR(ENOSYS);
-+ }
-+#endif
-+
- param->source_width = avctx->width;
- param->source_height = avctx->height;
-
-- desc = av_pix_fmt_desc_get(avctx->pix_fmt);
- param->encoder_bit_depth = desc->comp[0].depth;
-
- if (desc->log2_chroma_w == 1 && desc->log2_chroma_h == 1)
-@@ -169,12 +289,6 @@ static int config_enc_params(EbSvtAv1EncConfiguration
- return AVERROR(EINVAL);
- }
-
-- if (avctx->profile != FF_PROFILE_UNKNOWN)
-- param->profile = avctx->profile;
--
-- if (avctx->level != FF_LEVEL_UNKNOWN)
-- param->level = avctx->level;
--
- if ((param->encoder_color_format == EB_YUV422 || param->encoder_bit_depth > 10)
- && param->profile != FF_PROFILE_AV1_PROFESSIONAL ) {
- av_log(avctx, AV_LOG_WARNING, "Forcing Professional profile\n");
-@@ -184,40 +298,21 @@ static int config_enc_params(EbSvtAv1EncConfiguration
- param->profile = FF_PROFILE_AV1_HIGH;
- }
-
-- // Update param from options
-- param->hierarchical_levels = svt_enc->hierarchical_level;
-- param->enc_mode = svt_enc->enc_mode;
-- param->tier = svt_enc->tier;
-- param->rate_control_mode = svt_enc->rc_mode;
-- param->scene_change_detection = svt_enc->scd;
-- param->qp = svt_enc->qp;
-+ avctx->bit_rate = param->rate_control_mode > 0 ?
-+ param->target_bit_rate : 0;
-+ avctx->rc_max_rate = param->max_bit_rate;
-+ avctx->rc_buffer_size = param->maximum_buffer_size_ms * avctx->bit_rate / 1000LL;
-
-- param->target_bit_rate = avctx->bit_rate;
-+ if (avctx->bit_rate || avctx->rc_max_rate || avctx->rc_buffer_size) {
-+ AVCPBProperties *cpb_props = ff_add_cpb_side_data(avctx);
-+ if (!cpb_props)
-+ return AVERROR(ENOMEM);
-
-- if (avctx->gop_size > 0)
-- param->intra_period_length = avctx->gop_size - 1;
--
-- if (avctx->framerate.num > 0 && avctx->framerate.den > 0) {
-- param->frame_rate_numerator = avctx->framerate.num;
-- param->frame_rate_denominator = avctx->framerate.den;
-- } else {
-- param->frame_rate_numerator = avctx->time_base.den;
-- param->frame_rate_denominator = avctx->time_base.num * avctx->ticks_per_frame;
-+ cpb_props->buffer_size = avctx->rc_buffer_size;
-+ cpb_props->max_bitrate = avctx->rc_max_rate;
-+ cpb_props->avg_bitrate = avctx->bit_rate;
- }
-
-- if (param->rate_control_mode) {
-- param->max_qp_allowed = avctx->qmax;
-- param->min_qp_allowed = avctx->qmin;
-- }
--
-- param->intra_refresh_type = 2; /* Real keyframes only */
--
-- if (svt_enc->la_depth >= 0)
-- param->look_ahead_distance = svt_enc->la_depth;
--
-- param->tile_columns = svt_enc->tile_columns;
-- param->tile_rows = svt_enc->tile_rows;
--
- return 0;
- }
-
-@@ -330,11 +425,8 @@ static int eb_send_frame(AVCodecContext *avctx, const
- if (svt_enc->eos_flag == EOS_SENT)
- return 0;
-
-- headerPtrLast.n_alloc_len = 0;
-- headerPtrLast.n_filled_len = 0;
-- headerPtrLast.n_tick_count = 0;
-- headerPtrLast.p_app_private = NULL;
-- headerPtrLast.p_buffer = NULL;
-+ memset(&headerPtrLast, 0, sizeof(headerPtrLast));
-+ headerPtrLast.pic_type = EB_AV1_INVALID_PICTURE;
- headerPtrLast.flags = EB_BUFFERFLAG_EOS;
-
- svt_av1_enc_send_picture(svt_enc->svt_handle, &headerPtrLast);
-@@ -350,6 +442,16 @@ static int eb_send_frame(AVCodecContext *avctx, const
- headerPtr->p_app_private = NULL;
- headerPtr->pts = frame->pts;
-
-+ switch (frame->pict_type) {
-+ case AV_PICTURE_TYPE_I:
-+ headerPtr->pic_type = EB_AV1_KEY_PICTURE;
-+ break;
-+ default:
-+ // Actually means auto, or default.
-+ headerPtr->pic_type = EB_AV1_INVALID_PICTURE;
-+ break;
-+ }
-+
- svt_av1_enc_send_picture(svt_enc->svt_handle, headerPtr);
-
- return 0;
-@@ -472,21 +574,22 @@ static const AVOption options[] = {
- #define OFFSET(x) offsetof(SvtContext, x)
- #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
- static const AVOption options[] = {
-- { "hielevel", "Hierarchical prediction levels setting", OFFSET(hierarchical_level),
-- AV_OPT_TYPE_INT, { .i64 = 4 }, 3, 4, VE , "hielevel"},
-+#if FF_API_SVTAV1_OPTS
-+ { "hielevel", "Hierarchical prediction levels setting (Deprecated, use svtav1-params)", OFFSET(hierarchical_level),
-+ AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 4, VE | AV_OPT_FLAG_DEPRECATED , "hielevel"},
- { "3level", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 3 }, INT_MIN, INT_MAX, VE, "hielevel" },
- { "4level", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 4 }, INT_MIN, INT_MAX, VE, "hielevel" },
-
-- { "la_depth", "Look ahead distance [0, 120]", OFFSET(la_depth),
-- AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 120, VE },
-+ { "la_depth", "Look ahead distance [0, 120] (Deprecated, use svtav1-params)", OFFSET(la_depth),
-+ AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 120, VE | AV_OPT_FLAG_DEPRECATED },
-
-- { "preset", "Encoding preset [0, 8]",
-- OFFSET(enc_mode), AV_OPT_TYPE_INT, { .i64 = MAX_ENC_PRESET }, 0, MAX_ENC_PRESET, VE },
--
-- { "tier", "Set operating point tier", OFFSET(tier),
-- AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE, "tier" },
-+ { "tier", "Set operating point tier (Deprecated, use svtav1-params)", OFFSET(tier),
-+ AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE | AV_OPT_FLAG_DEPRECATED, "tier" },
- { "main", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, 0, 0, VE, "tier" },
- { "high", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, 0, 0, VE, "tier" },
-+#endif
-+ { "preset", "Encoding preset",
-+ OFFSET(enc_mode), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, MAX_ENC_PRESET, VE },
*** 109 LINES SKIPPED ***