ffmpeg: Upgrade to 4.4.1-r5 Gentoo upstream

Upgrade to 4.4.1-r5 to pick an upstream ffmpeg patch
so that ffmpeg honors portage specified RANLIB variable.

BUG=b:236998536
TEST=ffmpeg builds

Change-Id: Id5fd243dfbf5ca34515db5a69214a2fadeaab1bd
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/overlays/portage-stable/+/3722735
Commit-Queue: Manoj Gupta <manojgupta@chromium.org>
Tested-by: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: Benjamin Gordon <bmgordon@chromium.org>
Reviewed-by: Miguel Casas-Sanchez <mcasas@chromium.org>
diff --git a/media-video/ffmpeg/Manifest b/media-video/ffmpeg/Manifest
index d1bac78..26c6602 100644
--- a/media-video/ffmpeg/Manifest
+++ b/media-video/ffmpeg/Manifest
@@ -1,7 +1,9 @@
 DIST ffmpeg-4.2.2-ppc64-altivec.patch.gz 7171 BLAKE2B 6676dadb22d2ab4b0f5c19b418448c5b9b54fd8c803c3f0ab517c6fa7990be08098dd6f6a2b1b3e77a1bed31a069c702366aba79ef9141ff9e23cd8c1b6e2885 SHA512 6653975017de3f7bde420860419fbdddb50ae41dbb811b819f4b5b13807bf885a4c01736f05a684515f97b0d63bd8896d5951a3276af90cc74abfe32dc2e2407
 DIST ffmpeg-4.2.2-ppc64-gcc.patch.gz 750 BLAKE2B 3a9cc7f0135e077c77179a7ca3da917bca3995d99d53b58221b23181a075f330132f83ea90a6110e89f90c7c3b5b2a7837559c5df414d9bd52dbb3ec166b1545 SHA512 701b0635e0819484a31de2062ba52d95ee03883ab56547cd75c3646a9b32bf3ecc7f719690b93f29202cfed0fdeecd26b51b9f3c66e72a999a3e8d9e97389275
 DIST ffmpeg-4.2.4.tar.bz2 10959430 BLAKE2B 932bc0046edab5587063bbc04d6ef0149876bd1001ad185384fcabb3d0ae196c9ba591e680823b3c7b6e0ef9a0a9e9575a8b08439fdd89ef0e4dabb9d4a7f4e6 SHA512 5c74e3fe77ddf8ffede0e4692d574858dd0626e542380a819ab79c0f669c6c1329ffbccb872502f60306e561f10aa8bc1e61d09b2bea829870fe4a48b76460c6
-DIST ffmpeg-4.3.1.tar.bz2 11301038 BLAKE2B 3b0eb332459921435b60e72f5c572034abf65d4ab79ef4cfae94fe594048eaa37eec47724d119863102a7211c2178f5a2382a6d4016b792818079b8241bde084 SHA512 831a187d8b8f2715a9f11c93c8d3ec126ff579d470797da452d3395178877de113af7ae90ed27fca0b223791ad257972570481e6dbb8361d2b7f3b010924bee8
 DIST ffmpeg-4.3.2.tar.bz2 11307134 BLAKE2B 97e1e598e4abe397b06298d545c3073ea2303e11c01e98343fe09d99174e02ca94f52c4df0d389fbefe7814686221446d30f107092f00cb0b69275c8747d6f32 SHA512 ec5566f8684f0ceb18184d59786ea1fc166ab28c46260ebcca5b919ad53137ba7317fd0c537e97df28553572a0d5e42c558773c808cf76995d67985aec2d6d4d
 DIST ffmpeg-4.4.1.tar.bz2 11494996 BLAKE2B 050b0501cb21f44451d59bf3b20b18d55234636b5a69a4962103d63f80ce9af172cc2cecb1e33b92334fcf635b283afddbdfa20cbd6deb526008cdb34ae01c16 SHA512 c41e63ffa9f5465ea3a7f4a8b255b299a2f49d5868ada4310a2344b8fea02476365c44871defd5609da55c805cbb58f34063dbdd4b203ade932cba8b3cfefc72
-DIST ffmpeg-4.4.tar.bz2 11489948 BLAKE2B a8dc007e260896228789d27339402e846cd21758e02c7a8d66a745ced2d1bbef4aa9c18c9b7cefef004b5ffa3fc859e2a2474c957bdf9ff27e82cec72ed4a5bf SHA512 212c330f477e9452b9d7873d6d3c452a5c946b6b9c17b01d94c60fda66e61e53b78388ef7686b8d9415a27cd3e05d5f0d6639a02a22467dbf1ed483b5594c80f
+DIST ffmpeg-4.4.2.tar.xz 9562968 BLAKE2B be044e9895acdd71a237a343a8d047c56db845c693b8c07877fc8049b630eb254e3430b6e9916330e6b3d53cbdc9f06680d80307a1fea1377bb818f4168bb276 SHA512 abce847c607ac6d63fe32ceff8bf8724888acf2b7db9a083cba50e3235590cdcb27feb7e0a314133d0030809fb54d474f64001fc9ab7d896a819159869c09d5a
+DIST ffmpeg-4.4.2.tar.xz.asc 520 BLAKE2B 1ff4a886c7703a05a19499ae5b2b6207df24e05844861cb52f2c56a97f47ab4fefa5011de46a385bab9684964470697ec5e74553098392877f7521a04ffe0fc4 SHA512 a4df97a6328fc076b5611023bd61254f1a5043db1ec2f3426bee305206b2b0937047ede9cb51db31a3387a16218fe95a7a40296770574fa32660118938a9d301
+DIST ffmpeg-5.0.1.tar.xz 9812524 BLAKE2B 0a37d425780f7e15836848048214411829bceb0de12bb7089803feb3dda07a077be9c8e8174b72792558ed86d92224bee9d4db20cc74690ea54312fbf2f10e83 SHA512 e5810c7379748a6bbe1a903bf36b4372b67cb3973179727b6af6f0118eef46f4c990155961cc37255e08a5bafdc4b4683503ad410ebb7afe7a35b891c01fa602
+DIST ffmpeg-5.0.1.tar.xz.asc 520 BLAKE2B 686a8c372d26bd0158a0e79f6cbe8d9c46127bd200df7f4f6e2a4285bfd412cfa9aff865eca125a27a7204f32ba0cca86bcbf769ee4874e5202cc700b0eb4449 SHA512 9c4bd404196c3a3808bae92873aefc77f8c26a9419cc6130a3f2359a75c8e83189d206e9aee8ff85c5a7fe4a98da24e11cf607ec351386c18979ec2d5ad3b3ad
diff --git a/media-video/ffmpeg/ffmpeg-4.4.1-r1.ebuild b/media-video/ffmpeg/ffmpeg-4.4.1-r5.ebuild
similarity index 92%
rename from media-video/ffmpeg/ffmpeg-4.4.1-r1.ebuild
rename to media-video/ffmpeg/ffmpeg-4.4.1-r5.ebuild
index a90935e..57a701e 100644
--- a/media-video/ffmpeg/ffmpeg-4.4.1-r1.ebuild
+++ b/media-video/ffmpeg/ffmpeg-4.4.1-r5.ebuild
@@ -80,11 +80,11 @@
 		amr:libopencore-amrwb amr:libopencore-amrnb codec2:libcodec2 +dav1d:libdav1d fdk:libfdk-aac
 		jpeg2k:libopenjpeg bluray:libbluray gme:libgme gsm:libgsm
 		libaribb24 mmal modplug:libmodplug opus:libopus libilbc librtmp ssh:libssh
-		speex:libspeex srt:libsrt svg:librsvg video_cards_nvidia:ffnvcodec
+		speex:libspeex srt:libsrt svg:librsvg nvenc:ffnvcodec
 		vorbis:libvorbis vpx:libvpx zvbi:libzvbi
 		# libavfilter options
 		appkit
-		bs2b:libbs2b chromaprint cuda:cuda-llvm flite:libflite frei0r
+		bs2b:libbs2b chromaprint cuda:cuda-llvm flite:libflite frei0r vmaf:libvmaf
 		fribidi:libfribidi fontconfig ladspa libass libtesseract lv2 truetype:libfreetype vidstab:libvidstab
 		rubberband:librubberband zeromq:libzmq zimg:libzimg
 		# libswresample options
@@ -95,10 +95,10 @@
 
 # Same as above but for encoders, i.e. they do something only with USE=encode.
 FFMPEG_ENCODER_FLAG_MAP=(
-	amrenc:libvo-amrwbenc mp3:libmp3lame
-	kvazaar:libkvazaar libaom
-	openh264:libopenh264 rav1e:librav1e snappy:libsnappy theora:libtheora twolame:libtwolame
-	webp:libwebp x264:libx264 x265:libx265 xvid:libxvid
+	amf amrenc:libvo-amrwbenc kvazaar:libkvazaar libaom mp3:libmp3lame
+	openh264:libopenh264 rav1e:librav1e	snappy:libsnappy svt-av1:libsvtav1
+	theora:libtheora twolame:libtwolame webp:libwebp x264:libx264
+	x265:libx265 xvid:libxvid
 )
 
 IUSE="
@@ -172,6 +172,7 @@
 
 RDEPEND="
 	alsa? ( >=media-libs/alsa-lib-1.0.27.2[${MULTILIB_USEDEP}] )
+	amf? ( media-video/amdgpu-pro-amf )
 	amr? ( >=media-libs/opencore-amr-0.1.3-r1[${MULTILIB_USEDEP}] )
 	bluray? ( >=media-libs/libbluray-0.3.0-r1:=[${MULTILIB_USEDEP}] )
 	bs2b? ( >=media-libs/libbs2b-3.1.0-r1[${MULTILIB_USEDEP}] )
@@ -188,8 +189,8 @@
 		rav1e? ( >=media-video/rav1e-0.4:=[capi] )
 		snappy? ( >=app-arch/snappy-1.1.2-r1:=[${MULTILIB_USEDEP}] )
 		theora? (
-			>=media-libs/libtheora-1.1.1[encode,${MULTILIB_USEDEP}]
 			>=media-libs/libogg-1.3.0[${MULTILIB_USEDEP}]
+			>=media-libs/libtheora-1.1.1[encode,${MULTILIB_USEDEP}]
 		)
 		twolame? ( >=media-sound/twolame-0.3.13-r1[${MULTILIB_USEDEP}] )
 		webp? ( >=media-libs/libwebp-0.3.0:=[${MULTILIB_USEDEP}] )
@@ -244,16 +245,18 @@
 	sndio? ( media-sound/sndio:=[${MULTILIB_USEDEP}] )
 	speex? ( >=media-libs/speex-1.2_rc1-r1[${MULTILIB_USEDEP}] )
 	srt? ( >=net-libs/srt-1.3.0:=[${MULTILIB_USEDEP}] )
-	ssh? ( >=net-libs/libssh-0.5.5[${MULTILIB_USEDEP}] )
+	ssh? ( >=net-libs/libssh-0.5.5:=[sftp,${MULTILIB_USEDEP}] )
 	svg? (
 		gnome-base/librsvg:2=[${MULTILIB_USEDEP}]
 		x11-libs/cairo[${MULTILIB_USEDEP}]
 	)
+	nvenc? ( >=media-libs/nv-codec-headers-9.1.23.1 )
+	svt-av1? ( >=media-libs/svt-av1-0.8.4[${MULTILIB_USEDEP}] )
 	truetype? ( >=media-libs/freetype-2.5.0.1:2[${MULTILIB_USEDEP}] )
 	vaapi? ( >=x11-libs/libva-1.2.1-r1:0=[${MULTILIB_USEDEP}] )
-	video_cards_nvidia? ( >=media-libs/nv-codec-headers-9.1.23.1[${MULTILIB_USEDEP}] )
 	vdpau? ( >=x11-libs/libvdpau-0.7[${MULTILIB_USEDEP}] )
 	vidstab? ( >=media-libs/vidstab-1.1.0[${MULTILIB_USEDEP}] )
+	vmaf? ( media-libs/libvmaf[${MULTILIB_USEDEP}] )
 	vorbis? (
 		>=media-libs/libvorbis-1.3.3-r1[${MULTILIB_USEDEP}]
 		>=media-libs/libogg-1.3.0[${MULTILIB_USEDEP}]
@@ -266,11 +269,11 @@
 		>=x11-libs/libXv-1.0.10[${MULTILIB_USEDEP}]
 		>=x11-libs/libxcb-1.4:=[${MULTILIB_USEDEP}]
 	)
+	postproc? ( !media-libs/libpostproc )
 	zeromq? ( >=net-libs/zeromq-4.1.6 )
 	zimg? ( >=media-libs/zimg-2.7.4:=[${MULTILIB_USEDEP}] )
 	zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )
 	zvbi? ( >=media-libs/zvbi-0.2.35[${MULTILIB_USEDEP}] )
-	postproc? ( !media-libs/libpostproc )
 "
 
 RDEPEND="${RDEPEND}
@@ -285,6 +288,7 @@
 BDEPEND="
 	>=sys-devel/make-3.81
 	virtual/pkgconfig
+	amf? ( media-libs/amf-headers )
 	cpu_flags_x86_mmx? ( || ( >=dev-lang/nasm-2.13 >=dev-lang/yasm-1.3 ) )
 	cuda? ( >=sys-devel/clang-7[llvm_targets_NVPTX] )
 	doc? ( sys-apps/texinfo )
@@ -306,7 +310,7 @@
 	)
 "
 REQUIRED_USE="
-	cuda? ( video_cards_nvidia )
+	cuda? ( nvenc )
 	libv4l? ( v4l )
 	fftools_cws2fws? ( zlib )
 	test? ( encode )
@@ -321,6 +325,7 @@
 
 PATCHES=(
 	"${FILESDIR}"/chromium-r1.patch
+	"${FILESDIR}"/ffmpeg-5.0-backport-ranlib-build-fix.patch
 )
 
 MULTILIB_WRAPPED_HEADERS=(
@@ -335,13 +340,30 @@
 	if [[ "${PV%_p*}" != "${PV}" ]] ; then # Snapshot
 		export revision=git-N-${FFMPEG_REVISION}
 	fi
+
+	eapply "${FILESDIR}/vmaf-models-default-path.patch"
+
 	default
+
+	# -fdiagnostics-color=auto gets appended after user flags which
+	# will ignore user's preference.
+	sed -i -e '/check_cflags -fdiagnostics-color=auto/d' configure || die
+
 	echo 'include $(SRC_PATH)/ffbuild/libffmpeg.mak' >> Makefile || die
 }
 
 multilib_src_configure() {
 	local myconf=( )
 
+	# bug 842201
+	use ia64 && tc-is-gcc && append-flags \
+		-fno-tree-ccp \
+		-fno-tree-dominator-opts \
+		-fno-tree-fre \
+		-fno-code-hoisting \
+		-fno-tree-pre \
+		-fno-tree-vrp
+
 	local ffuse=( "${FFMPEG_FLAG_MAP[@]}" )
 	use openssl && myconf+=( --enable-nonfree )
 	use samba && myconf+=( --enable-version3 )
@@ -455,7 +477,7 @@
 	)
 
 	local extra_libs
-	if use arm || use ppc ; then
+	if use arm || use ppc || use mips || [[ ${CHOST} == *i486* ]] ; then
 		# bug #782811
 		# bug #790590
 		extra_libs+="$(test-flags-CCLD -latomic) "
@@ -556,4 +578,6 @@
 multilib_src_install_all() {
 	dodoc Changelog README.md CREDITS doc/*.txt doc/APIchanges
 	[ -f "RELEASE_NOTES" ] && dodoc "RELEASE_NOTES"
+
+	use amf && doenvd "${FILESDIR}"/amf-env-vulkan-override
 }
diff --git a/media-video/ffmpeg/files/amf-env-vulkan-override b/media-video/ffmpeg/files/amf-env-vulkan-override
new file mode 100644
index 0000000..41ee279
--- /dev/null
+++ b/media-video/ffmpeg/files/amf-env-vulkan-override
@@ -0,0 +1 @@
+VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/amd_pro_icd64.json
diff --git a/media-video/ffmpeg/files/ffmpeg-4.3.1-srt-1.4.2-build.patch b/media-video/ffmpeg/files/ffmpeg-4.3.1-srt-1.4.2-build.patch
deleted file mode 100644
index 691314c..0000000
--- a/media-video/ffmpeg/files/ffmpeg-4.3.1-srt-1.4.2-build.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-http://git.videolan.org/?p=ffmpeg.git;a=patch;h=7c59e1b0f285cd7c7b35fcd71f49c5fd52cf9315
-https://bugs.gentoo.org/756859
-From 7c59e1b0f285cd7c7b35fcd71f49c5fd52cf9315 Mon Sep 17 00:00:00 2001
-From: Jun Zhao <barryjzhao@tencent.com>
-Date: Sun, 12 Jul 2020 13:48:48 +0800
-Subject: [PATCH] lavf/srt: fix build fail when used the libsrt 1.4.1
-
-libsrt changed the:
-SRTO_SMOOTHER   -> SRTO_CONGESTION
-SRTO_STRICTENC  -> SRTO_ENFORCEDENCRYPTION
-and removed the front of deprecated options (SRTO_SMOOTHER/SRTO_STRICTENC)
-in the header, it's lead to build fail
-
-fix #8760
-
-Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
----
- libavformat/libsrt.c | 8 ++++++++
- 1 file changed, 8 insertions(+)
-
-diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c
-index 4de575b37c..4719ce0d4b 100644
---- a/libavformat/libsrt.c
-+++ b/libavformat/libsrt.c
-@@ -313,8 +313,12 @@ static int libsrt_set_options_pre(URLContext *h, int fd)
-         (s->pbkeylen >= 0 && libsrt_setsockopt(h, fd, SRTO_PBKEYLEN, "SRTO_PBKEYLEN", &s->pbkeylen, sizeof(s->pbkeylen)) < 0) ||
-         (s->passphrase && libsrt_setsockopt(h, fd, SRTO_PASSPHRASE, "SRTO_PASSPHRASE", s->passphrase, strlen(s->passphrase)) < 0) ||
- #if SRT_VERSION_VALUE >= 0x010302
-+#if SRT_VERSION_VALUE >= 0x010401
-+        (s->enforced_encryption >= 0 && libsrt_setsockopt(h, fd, SRTO_ENFORCEDENCRYPTION, "SRTO_ENFORCEDENCRYPTION", &s->enforced_encryption, sizeof(s->enforced_encryption)) < 0) ||
-+#else
-         /* SRTO_STRICTENC == SRTO_ENFORCEDENCRYPTION (53), but for compatibility, we used SRTO_STRICTENC */
-         (s->enforced_encryption >= 0 && libsrt_setsockopt(h, fd, SRTO_STRICTENC, "SRTO_STRICTENC", &s->enforced_encryption, sizeof(s->enforced_encryption)) < 0) ||
-+#endif
-         (s->kmrefreshrate >= 0 && libsrt_setsockopt(h, fd, SRTO_KMREFRESHRATE, "SRTO_KMREFRESHRATE", &s->kmrefreshrate, sizeof(s->kmrefreshrate)) < 0) ||
-         (s->kmpreannounce >= 0 && libsrt_setsockopt(h, fd, SRTO_KMPREANNOUNCE, "SRTO_KMPREANNOUNCE", &s->kmpreannounce, sizeof(s->kmpreannounce)) < 0) ||
- #endif
-@@ -333,7 +337,11 @@ static int libsrt_set_options_pre(URLContext *h, int fd)
-         (s->lossmaxttl >= 0 && libsrt_setsockopt(h, fd, SRTO_LOSSMAXTTL, "SRTO_LOSSMAXTTL", &s->lossmaxttl, sizeof(s->lossmaxttl)) < 0) ||
-         (s->minversion >= 0 && libsrt_setsockopt(h, fd, SRTO_MINVERSION, "SRTO_MINVERSION", &s->minversion, sizeof(s->minversion)) < 0) ||
-         (s->streamid && libsrt_setsockopt(h, fd, SRTO_STREAMID, "SRTO_STREAMID", s->streamid, strlen(s->streamid)) < 0) ||
-+#if SRT_VERSION_VALUE >= 0x010401
-+        (s->smoother && libsrt_setsockopt(h, fd, SRTO_CONGESTION, "SRTO_CONGESTION", s->smoother, strlen(s->smoother)) < 0) ||
-+#else
-         (s->smoother && libsrt_setsockopt(h, fd, SRTO_SMOOTHER, "SRTO_SMOOTHER", s->smoother, strlen(s->smoother)) < 0) ||
-+#endif
-         (s->messageapi >= 0 && libsrt_setsockopt(h, fd, SRTO_MESSAGEAPI, "SRTO_MESSAGEAPI", &s->messageapi, sizeof(s->messageapi)) < 0) ||
-         (s->payload_size >= 0 && libsrt_setsockopt(h, fd, SRTO_PAYLOADSIZE, "SRTO_PAYLOADSIZE", &s->payload_size, sizeof(s->payload_size)) < 0) ||
-         ((h->flags & AVIO_FLAG_WRITE) && libsrt_setsockopt(h, fd, SRTO_SENDER, "SRTO_SENDER", &yes, sizeof(yes)) < 0)) {
--- 
-2.20.1
-
diff --git a/media-video/ffmpeg/files/ffmpeg-5.0-backport-ranlib-build-fix.patch b/media-video/ffmpeg/files/ffmpeg-5.0-backport-ranlib-build-fix.patch
new file mode 100644
index 0000000..1c264f7
--- /dev/null
+++ b/media-video/ffmpeg/files/ffmpeg-5.0-backport-ranlib-build-fix.patch
@@ -0,0 +1,59 @@
+From bc5ccea3b9d2c71929af6271bd8afe9b6cfab436 Mon Sep 17 00:00:00 2001
+From: Adrian Ratiu <adrian.ratiu@collabora.com>
+Date: Mon, 14 Feb 2022 15:00:07 +0200
+Subject: [PATCH] configure: move ranlib -D test after setting defaults
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Upstream-Status: Backport [from master bc5ccea3b9d2c7]
+
+In Gentoo and ChromeOS we want to allow pure LLVM builds without
+using GNU tools, so we block any unwanted mixed GNU/LLVM usages
+(GNU tools are still kept around in our chroots for projects
+like glibc which cannot yet be built otherwise).
+
+The default ${cross_prefix}${ranlib_default} points to GNU and
+fails, so move the test a bit later - after the defaults are
+set and the proper values get overriden - such that ffmpeg
+configure calls the llvm-ranlib we desire. [1]
+
+[1] https://gitweb.gentoo.org/repo/gentoo.git/tree/media-video/ffmpeg/ffmpeg-4.4.1-r1.ebuild?id=7a34377e3277a6a0e2eedd40e90452a44c55f1e6#n477
+
+Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
+Signed-off-by: Martin Storsjö <martin@martin.st>
+---
+ configure | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/configure b/configure
+index 7d22c2a345..82642deabe 100755
+--- a/configure
++++ b/configure
+@@ -4403,11 +4403,7 @@ cc_default="${cross_prefix}${cc_default}"
+ cxx_default="${cross_prefix}${cxx_default}"
+ nm_default="${cross_prefix}${nm_default}"
+ pkg_config_default="${cross_prefix}${pkg_config_default}"
+-if ${cross_prefix}${ranlib_default} 2>&1 | grep -q "\-D "; then
+-    ranlib_default="${cross_prefix}${ranlib_default} -D"
+-else
+-    ranlib_default="${cross_prefix}${ranlib_default}"
+-fi
++ranlib_default="${cross_prefix}${ranlib_default}"
+ strip_default="${cross_prefix}${strip_default}"
+ windres_default="${cross_prefix}${windres_default}"
+ 
+@@ -4440,6 +4436,10 @@ set_default arch cc cxx doxygen pkg_config ranlib strip sysinclude \
+ enabled cross_compile || host_cc_default=$cc
+ set_default host_cc
+ 
++if ${ranlib} 2>&1 | grep -q "\-D "; then
++    ranlib="${ranlib} -D"
++fi
++
+ pkg_config_fail_message=""
+ if ! $pkg_config --version >/dev/null 2>&1; then
+     warn "$pkg_config not found, library detection may fail."
+-- 
+2.35.1
+
diff --git a/media-video/ffmpeg/files/vmaf-models-default-path.patch b/media-video/ffmpeg/files/vmaf-models-default-path.patch
new file mode 100644
index 0000000..a9777e9
--- /dev/null
+++ b/media-video/ffmpeg/files/vmaf-models-default-path.patch
@@ -0,0 +1,13 @@
+Put default path of models to /usr/share/vmaf/model
+
+--- a/libavfilter/vf_libvmaf.c
++++ b/libavfilter/vf_libvmaf.c
+@@ -72,7 +72,7 @@ typedef struct LIBVMAFContext {
+ #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
+
+ static const AVOption libvmaf_options[] = {
+-    {"model_path",  "Set the model to be used for computing vmaf.",                     OFFSET(model_path), AV_OPT_TYPE_STRING, {.str="/usr/local/share/model/vmaf_v0.6.1.pkl"}, 0, 1, FLAGS},
++    {"model_path",  "Set the model to be used for computing vmaf.",                     OFFSET(model_path), AV_OPT_TYPE_STRING, {.str="/usr/share/vmaf/model/vmaf_v0.6.1.json"}, 0, 1, FLAGS},
+     {"log_path",  "Set the file path to be used to store logs.",                        OFFSET(log_path), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 1, FLAGS},
+     {"log_fmt",  "Set the format of the log (xml or json).",                            OFFSET(log_fmt), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 1, FLAGS},
+     {"enable_transform",  "Enables transform for computing vmaf.",                      OFFSET(enable_transform), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS},
diff --git a/media-video/ffmpeg/metadata.xml b/media-video/ffmpeg/metadata.xml
index be0716e..c07905a 100644
--- a/media-video/ffmpeg/metadata.xml
+++ b/media-video/ffmpeg/metadata.xml
@@ -5,6 +5,7 @@
 	<email>media-video@gentoo.org</email>
 </maintainer>
 <use>
+	<flag name="amf">Enables support for AMD's Advanced Media Framework (AMF)</flag>
 	<flag name="amr">Enables Adaptive Multi-Rate Audio support</flag>
 	<flag name="amrenc">Enables Adaptive Multi-Rate Audio encoding support with <pkg>media-libs/vo-amrwbenc</pkg>.</flag>
 	<flag name="appkit">Enables Apple AppKit framework</flag>
@@ -53,8 +54,10 @@
 	<flag name="sndio">Enable support for the <pkg>media-sound/sndio</pkg> backend</flag>
 	<flag name="srt">Enable support for Secure Reliable Transport (SRT) via <pkg>net-libs/srt</pkg></flag>
 	<flag name="ssh">Enable SSH/sftp support via <pkg>net-libs/libssh</pkg>.</flag>
+	<flag name="svt-av1">Enables AV1 encoding support via <pkg>media-libs/svt-av1</pkg>.</flag>
 	<flag name="twolame">Enables MP2 encoding via <pkg>media-sound/twolame</pkg> as an alternative to the internal encoder.</flag>
 	<flag name="vidstab">Enables video stabilization filter using vid.stab library (<pkg>media-libs/vidstab</pkg>).</flag>
+	<flag name="vmaf">Enables Netflix's perceptual video quality assessment filter using the library (<pkg>media-libs/libvmaf</pkg>).</flag>
 	<flag name="vpx">Enables VP8 and VP9 codec support using libvpx: Decoding does not require this to be enabled but libvpx can also be used for decoding; encoding requires this useflag to be enabled though.</flag>
 	<flag name="vulkan">Enables support for the vulkan API for GPU offload.</flag>
 	<flag name="x265">Enables HEVC encoding with <pkg>media-libs/x265</pkg>.</flag>