Re: [FFmpeg-devel] [PATCH] avcodec: Add MediaFoundation encoder wrapper

2020-05-12 Thread Martin Storsjö

On Sun, 10 May 2020, Lou Logan wrote:


On Sat, May 9, 2020, at 1:41 PM, Martin Storsjö wrote:


+  --enable-mf  enable decoding via MediaFoundation [auto]


encoding/decoding typo I presume.


Good catch, thanks. (The original patch supported both, but for now it's 
thinned down to only encoding.)



I would prefer --enable-mediafoundation as it is more descriptive.


Sure, I can change that.

// Martin
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] avcodec: Add MediaFoundation encoder wrapper

2020-05-12 Thread Martin Storsjö

On Sun, 10 May 2020, James Almer wrote:


On 5/9/2020 6:41 PM, Martin Storsjö wrote:

+#define MF_ENCODER(MEDIATYPE, NAME, ID, OPTS, EXTRA) \
+static const AVClass ff_ ## NAME ## _mf_encoder_class = {  
\
+.class_name = #NAME "_mf", 
\
+.item_name  = av_default_item_name,
\
+.option = OPTS,
\
+.version= LIBAVUTIL_VERSION_INT,   
\
+}; 
\
+AVCodec ff_ ## NAME ## _mf_encoder = { 
\
+.priv_class = _ ## NAME ## _mf_encoder_class,   
\
+.name   = #NAME "_mf", 
\
+.long_name  = NULL_IF_CONFIG_SMALL(#ID " via MediaFoundation"),
\
+.type   = AVMEDIA_TYPE_ ## MEDIATYPE,  
\
+.id = AV_CODEC_ID_ ## ID,  
\
+.priv_data_size = sizeof(MFContext),   
\
+.init   = mf_init, 
\
+.close  = mf_close,
\
+.send_frame = mf_send_frame,   
\
+.receive_packet = mf_receive_packet,   
\
+EXTRA  
\
+.capabilities   = AV_CODEC_CAP_DELAY,  
\


Should probably also be AV_CODEC_CAP_HYBRID.


Sure, added locally.


+.caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE |   
\
+  FF_CODEC_CAP_INIT_CLEANUP,   
\
+};
+
+#define AFMTS \
+.sample_fmts= (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16,
\
+ AV_SAMPLE_FMT_NONE },
+
+MF_ENCODER(AUDIO, aac, AAC, NULL, AFMTS);
+MF_ENCODER(AUDIO, ac3, AC3, NULL, AFMTS);
+MF_ENCODER(AUDIO, mp3, MP3, NULL, AFMTS);
+
+#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
+static const AVOption venc_opts[] = {
+{"rate_control",  "Select rate control mode", OFFSET(opt_enc_rc), AV_OPT_TYPE_INT, 
{.i64 = -1}, -1, INT_MAX, VE, "rate_control"},
+{ "default",  "Default mode", 0, AV_OPT_TYPE_CONST, {.i64 = -1}, 0, 0, VE, 
"rate_control"},
+{ "cbr",  "CBR mode", 0, AV_OPT_TYPE_CONST, {.i64 = 
ff_eAVEncCommonRateControlMode_CBR}, 0, 0, VE, "rate_control"},
+{ "pc_vbr",   "Peak constrained VBR mode", 0, AV_OPT_TYPE_CONST, {.i64 = 
ff_eAVEncCommonRateControlMode_PeakConstrainedVBR}, 0, 0, VE, "rate_control"},
+{ "u_vbr","Unconstrained VBR mode", 0, AV_OPT_TYPE_CONST, {.i64 = 
ff_eAVEncCommonRateControlMode_UnconstrainedVBR}, 0, 0, VE, "rate_control"},
+{ "quality",  "Quality mode", 0, AV_OPT_TYPE_CONST, {.i64 = 
ff_eAVEncCommonRateControlMode_Quality}, 0, 0, VE, "rate_control" },
+// The following rate_control modes require Windows 8.
+{ "ld_vbr",   "Low delay VBR mode", 0, AV_OPT_TYPE_CONST, {.i64 = 
ff_eAVEncCommonRateControlMode_LowDelayVBR}, 0, 0, VE, "rate_control"},
+{ "g_vbr","Global VBR mode", 0, AV_OPT_TYPE_CONST, {.i64 = 
ff_eAVEncCommonRateControlMode_GlobalVBR}, 0, 0, VE, "rate_control" },
+{ "gld_vbr",  "Global low delay VBR mode", 0, AV_OPT_TYPE_CONST, {.i64 = 
ff_eAVEncCommonRateControlMode_GlobalLowDelayVBR}, 0, 0, VE, "rate_control"},
+{"quality",   "Quality", OFFSET(opt_enc_quality), AV_OPT_TYPE_INT, 
{.i64 = -1}, -1, 100, VE},
+{"hw_encoding",   "Force hardware encoding", OFFSET(opt_enc_hw), AV_OPT_TYPE_BOOL, 
{.i64 = 0}, 0, 1, VE, "hw_encoding"},


Can't you attempt to init using hw by default and if that fails
gracefully fallback to the sw implementation?
This option could instead just attempt to force disable or enable hw
(deafault -1/auto), and if hw can't be used when forced it would just
abort instead of falling back to sw.


It's not very straightforward to fall back, there's usually a rather long 
sequence of option setting until it's clear whether the chosen encoder 
works in the desired mode or not.


One common situation is e.g. that the system default SW encoder supports 
both yuv420p and nv12, while the HW encoder only supports nv12. Now if I'd 
prefer to use the hardware encoder, but it fails to use it (since the 
encoder turned out to only support nv12), falling back to SW would be a 
bit unexpected. (Although I guess one could retain that behaviour if the 
flag has been set to an explicit value.)


In any case, I'd rather leave this aspect as a patch welcome feature for 
others if they want to implement it - I don't see it as 

Re: [FFmpeg-devel] [PATCH] avcodec: Add MediaFoundation encoder wrapper

2020-05-12 Thread Martin Storsjö

On Sun, 10 May 2020, Marton Balint wrote:




On Sun, 10 May 2020, Martin Storsjö wrote:


From: wm4 

This contains encoder wrappers for H264, HEVC, AAC, AC3 and MP3.

This is based on top of an original patch by wm4
. The original patch supported both encoding
and decoding, but this patch only includes encoding.

The patch contains further changes by Paweł Wegner
 (primarily for splitting out the encoding
parts of the original patch) and further cleanup, build compatibility
fixes and tweaks for use with Qualcomm encoders by Martin Storsjö.
---
This allows access to the HW video encoder on Windows on ARM64
on Qualcomm platforms. However, to actually use that, one has to
manually choose nv12 as input pixel format, otherwise the encoder
format negotiation fails.

I've tried to read up on the feedback this patch got the earlier
times it was posted and address those issues. In particular,
this is enabled automatically if suitable headers are available.
The built binary still runs on Vista (even if the required MF
functionality isn't available there).

Building succeeds with MSVC, old and new mingw-w64 toolchains,
and isn't detected nor enabled on mingw.org toolchains. The configure
check looks for one of the API details used; mingw-w64 versions
from before that feature was added won't try to build the code,
while newer ones should have enough features to build it successfully.
---
configure  |   11 +
libavcodec/Makefile|1 +
libavcodec/allcodecs.c |5 +
libavcodec/mf_utils.c  |  677 +++
libavcodec/mf_utils.h  |  138 +
libavcodec/mfenc.c | 1181 
libavcodec/version.h   |2 +-
7 files changed, 2014 insertions(+), 1 deletion(-)
create mode 100644 libavcodec/mf_utils.c
create mode 100644 libavcodec/mf_utils.h
create mode 100644 libavcodec/mfenc.c


Missing docs update.


Which one is mandatory here? I added a changelog entry locally now as wel. 
I guess it could have short general description in doc/encoders.texi, or 
does one have to duplicate the info about all the options as well?


// Martin
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] avcodec: Add MediaFoundation encoder wrapper

2020-05-10 Thread Martin Storsjö

On Sun, 10 May 2020, Paul B Mahol wrote:


What's next?
Decoders?


I probably won't put in effort in getting the MediaFoundation decoder 
support merged myself, but if this is merged, I can at least try to make a 
WIP patch somewhere that adds the rest of the decoding support from the 
original patch.


// Martin


___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] avcodec: Add MediaFoundation encoder wrapper

2020-05-10 Thread Lou Logan
On Sat, May 9, 2020, at 1:41 PM, Martin Storsjö wrote:

> +  --enable-mf  enable decoding via MediaFoundation [auto]

encoding/decoding typo I presume.

I would prefer --enable-mediafoundation as it is more descriptive.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] avcodec: Add MediaFoundation encoder wrapper

2020-05-10 Thread James Almer
On 5/9/2020 6:41 PM, Martin Storsjö wrote:
> +#define MF_ENCODER(MEDIATYPE, NAME, ID, OPTS, EXTRA) \
> +static const AVClass ff_ ## NAME ## _mf_encoder_class = {
>   \
> +.class_name = #NAME "_mf",   
>   \
> +.item_name  = av_default_item_name,  
>   \
> +.option = OPTS,  
>   \
> +.version= LIBAVUTIL_VERSION_INT, 
>   \
> +};   
>   \
> +AVCodec ff_ ## NAME ## _mf_encoder = {   
>   \
> +.priv_class = _ ## NAME ## _mf_encoder_class, 
>   \
> +.name   = #NAME "_mf",   
>   \
> +.long_name  = NULL_IF_CONFIG_SMALL(#ID " via MediaFoundation"),  
>   \
> +.type   = AVMEDIA_TYPE_ ## MEDIATYPE,
>   \
> +.id = AV_CODEC_ID_ ## ID,
>   \
> +.priv_data_size = sizeof(MFContext), 
>   \
> +.init   = mf_init,   
>   \
> +.close  = mf_close,  
>   \
> +.send_frame = mf_send_frame, 
>   \
> +.receive_packet = mf_receive_packet, 
>   \
> +EXTRA
>   \
> +.capabilities   = AV_CODEC_CAP_DELAY,
>   \

Should probably also be AV_CODEC_CAP_HYBRID.

> +.caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE | 
>   \
> +  FF_CODEC_CAP_INIT_CLEANUP, 
>   \
> +};
> +
> +#define AFMTS \
> +.sample_fmts= (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16,  
>   \
> + AV_SAMPLE_FMT_NONE 
> },
> +
> +MF_ENCODER(AUDIO, aac, AAC, NULL, AFMTS);
> +MF_ENCODER(AUDIO, ac3, AC3, NULL, AFMTS);
> +MF_ENCODER(AUDIO, mp3, MP3, NULL, AFMTS);
> +
> +#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
> +static const AVOption venc_opts[] = {
> +{"rate_control",  "Select rate control mode", OFFSET(opt_enc_rc), 
> AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VE, "rate_control"},
> +{ "default",  "Default mode", 0, AV_OPT_TYPE_CONST, {.i64 = -1}, 0, 
> 0, VE, "rate_control"},
> +{ "cbr",  "CBR mode", 0, AV_OPT_TYPE_CONST, {.i64 = 
> ff_eAVEncCommonRateControlMode_CBR}, 0, 0, VE, "rate_control"},
> +{ "pc_vbr",   "Peak constrained VBR mode", 0, AV_OPT_TYPE_CONST, 
> {.i64 = ff_eAVEncCommonRateControlMode_PeakConstrainedVBR}, 0, 0, VE, 
> "rate_control"},
> +{ "u_vbr","Unconstrained VBR mode", 0, AV_OPT_TYPE_CONST, {.i64 
> = ff_eAVEncCommonRateControlMode_UnconstrainedVBR}, 0, 0, VE, "rate_control"},
> +{ "quality",  "Quality mode", 0, AV_OPT_TYPE_CONST, {.i64 = 
> ff_eAVEncCommonRateControlMode_Quality}, 0, 0, VE, "rate_control" },
> +// The following rate_control modes require Windows 8.
> +{ "ld_vbr",   "Low delay VBR mode", 0, AV_OPT_TYPE_CONST, {.i64 = 
> ff_eAVEncCommonRateControlMode_LowDelayVBR}, 0, 0, VE, "rate_control"},
> +{ "g_vbr","Global VBR mode", 0, AV_OPT_TYPE_CONST, {.i64 = 
> ff_eAVEncCommonRateControlMode_GlobalVBR}, 0, 0, VE, "rate_control" },
> +{ "gld_vbr",  "Global low delay VBR mode", 0, AV_OPT_TYPE_CONST, 
> {.i64 = ff_eAVEncCommonRateControlMode_GlobalLowDelayVBR}, 0, 0, VE, 
> "rate_control"},
> +{"quality",   "Quality", OFFSET(opt_enc_quality), AV_OPT_TYPE_INT, 
> {.i64 = -1}, -1, 100, VE},
> +{"hw_encoding",   "Force hardware encoding", OFFSET(opt_enc_hw), 
> AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, VE, "hw_encoding"},

Can't you attempt to init using hw by default and if that fails
gracefully fallback to the sw implementation?
This option could instead just attempt to force disable or enable hw
(deafault -1/auto), and if hw can't be used when forced it would just
abort instead of falling back to sw.

> +{NULL}
> +};

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] avcodec: Add MediaFoundation encoder wrapper

2020-05-10 Thread Marton Balint



On Sun, 10 May 2020, Martin Storsjö wrote:


From: wm4 

This contains encoder wrappers for H264, HEVC, AAC, AC3 and MP3.

This is based on top of an original patch by wm4
. The original patch supported both encoding
and decoding, but this patch only includes encoding.

The patch contains further changes by Paweł Wegner
 (primarily for splitting out the encoding
parts of the original patch) and further cleanup, build compatibility
fixes and tweaks for use with Qualcomm encoders by Martin Storsjö.
---
This allows access to the HW video encoder on Windows on ARM64
on Qualcomm platforms. However, to actually use that, one has to
manually choose nv12 as input pixel format, otherwise the encoder
format negotiation fails.

I've tried to read up on the feedback this patch got the earlier
times it was posted and address those issues. In particular,
this is enabled automatically if suitable headers are available.
The built binary still runs on Vista (even if the required MF
functionality isn't available there).

Building succeeds with MSVC, old and new mingw-w64 toolchains,
and isn't detected nor enabled on mingw.org toolchains. The configure
check looks for one of the API details used; mingw-w64 versions
from before that feature was added won't try to build the code,
while newer ones should have enough features to build it successfully.
---
configure  |   11 +
libavcodec/Makefile|1 +
libavcodec/allcodecs.c |5 +
libavcodec/mf_utils.c  |  677 +++
libavcodec/mf_utils.h  |  138 +
libavcodec/mfenc.c | 1181 
libavcodec/version.h   |2 +-
7 files changed, 2014 insertions(+), 1 deletion(-)
create mode 100644 libavcodec/mf_utils.c
create mode 100644 libavcodec/mf_utils.h
create mode 100644 libavcodec/mfenc.c


Missing docs update.

Regards,
Marton



diff --git a/configure b/configure
index e7162dbc56..a52d1ebed5 100755
--- a/configure
+++ b/configure
@@ -304,6 +304,7 @@ External library support:
  --enable-mbedtls enable mbedTLS, needed for https support
   if openssl, gnutls or libtls is not used [no]
  --enable-mediacodec  enable Android MediaCodec support [no]
+  --enable-mf  enable decoding via MediaFoundation [auto]
  --enable-libmysofa   enable libmysofa, needed for sofalizer filter [no]
  --enable-openal  enable OpenAL 1.1 capture support [no]
  --enable-opencl  enable OpenCL processing [no]
@@ -1704,6 +1705,7 @@ EXTERNAL_AUTODETECT_LIBRARY_LIST="
libxcb_shape
libxcb_xfixes
lzma
+mf
schannel
sdl2
securetransport
@@ -3013,6 +3015,8 @@ wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
wmv3_vdpau_hwaccel_select="vc1_vdpau_hwaccel"

# hardware-accelerated codecs
+mf_deps="mftransform_h MFCreateAlignedMemoryBuffer"
+mf_extralibs="-lmfplat -lmfuuid -lole32 -lstrmiids"
omx_deps="libdl pthreads"
omx_rpi_select="omx"
qsv_deps="libmfx"
@@ -3037,6 +3041,8 @@ nvenc_deps="ffnvcodec"
nvenc_deps_any="libdl LoadLibrary"
nvenc_encoder_deps="nvenc"

+aac_mf_encoder_deps="mf"
+ac3_mf_encoder_deps="mf"
h263_v4l2m2m_decoder_deps="v4l2_m2m h263_v4l2_m2m"
h263_v4l2m2m_encoder_deps="v4l2_m2m h263_v4l2_m2m"
h264_amf_encoder_deps="amf"
@@ -3045,6 +3051,7 @@ h264_cuvid_decoder_deps="cuvid"
h264_cuvid_decoder_select="h264_mp4toannexb_bsf"
h264_mediacodec_decoder_deps="mediacodec"
h264_mediacodec_decoder_select="h264_mp4toannexb_bsf h264_parser"
+h264_mf_encoder_deps="mf"
h264_mmal_decoder_deps="mmal"
h264_nvenc_encoder_deps="nvenc"
h264_omx_encoder_deps="omx"
@@ -3061,6 +3068,7 @@ hevc_cuvid_decoder_deps="cuvid"
hevc_cuvid_decoder_select="hevc_mp4toannexb_bsf"
hevc_mediacodec_decoder_deps="mediacodec"
hevc_mediacodec_decoder_select="hevc_mp4toannexb_bsf hevc_parser"
+hevc_mf_encoder_deps="mf"
hevc_nvenc_encoder_deps="nvenc"
hevc_qsv_decoder_select="hevc_mp4toannexb_bsf qsvdec"
hevc_qsv_encoder_select="hevcparse qsvenc"
@@ -3077,6 +3085,7 @@ mjpeg_qsv_encoder_deps="libmfx"
mjpeg_qsv_encoder_select="qsvenc"
mjpeg_vaapi_encoder_deps="VAEncPictureParameterBufferJPEG"
mjpeg_vaapi_encoder_select="cbs_jpeg jpegtables vaapi_encode"
+mp3_mf_encoder_deps="mf"
mpeg1_cuvid_decoder_deps="cuvid"
mpeg1_v4l2m2m_decoder_deps="v4l2_m2m mpeg1_v4l2_m2m"
mpeg2_crystalhd_decoder_select="crystalhd"
@@ -6099,6 +6108,7 @@ check_headers io.h
check_headers linux/perf_event.h
check_headers libcrystalhd/libcrystalhd_if.h
check_headers malloc.h
+check_headers mftransform.h
check_headers net/udplite.h
check_headers poll.h
check_headers sys/param.h
@@ -6161,6 +6171,7 @@ check_type "windows.h dxva.h" "DXVA_PicParams_VP9" 
-DWINAPI_FAMILY=WINAPI_FAMILY
check_type "windows.h d3d11.h" "ID3D11VideoDecoder"
check_type "windows.h d3d11.h" "ID3D11VideoContext"
check_type "d3d9.h dxva2api.h" DXVA2_ConfigPictureDecode -D_WIN32_WINNT=0x0602
+check_func_headers mfapi.h MFCreateAlignedMemoryBuffer -lmfplat

check_type "vdpau/vdpau.h" "VdpPictureInfoHEVC"
check_type "vdpau/vdpau.h" 

Re: [FFmpeg-devel] [PATCH] avcodec: Add MediaFoundation encoder wrapper

2020-05-10 Thread Paul B Mahol
What's next?
Decoders?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] avcodec: Add MediaFoundation encoder wrapper

2020-05-09 Thread Martin Storsjö
From: wm4 

This contains encoder wrappers for H264, HEVC, AAC, AC3 and MP3.

This is based on top of an original patch by wm4
. The original patch supported both encoding
and decoding, but this patch only includes encoding.

The patch contains further changes by Paweł Wegner
 (primarily for splitting out the encoding
parts of the original patch) and further cleanup, build compatibility
fixes and tweaks for use with Qualcomm encoders by Martin Storsjö.
---
This allows access to the HW video encoder on Windows on ARM64
on Qualcomm platforms. However, to actually use that, one has to
manually choose nv12 as input pixel format, otherwise the encoder
format negotiation fails.

I've tried to read up on the feedback this patch got the earlier
times it was posted and address those issues. In particular,
this is enabled automatically if suitable headers are available.
The built binary still runs on Vista (even if the required MF
functionality isn't available there).

Building succeeds with MSVC, old and new mingw-w64 toolchains,
and isn't detected nor enabled on mingw.org toolchains. The configure
check looks for one of the API details used; mingw-w64 versions
from before that feature was added won't try to build the code,
while newer ones should have enough features to build it successfully.
---
 configure  |   11 +
 libavcodec/Makefile|1 +
 libavcodec/allcodecs.c |5 +
 libavcodec/mf_utils.c  |  677 +++
 libavcodec/mf_utils.h  |  138 +
 libavcodec/mfenc.c | 1181 
 libavcodec/version.h   |2 +-
 7 files changed, 2014 insertions(+), 1 deletion(-)
 create mode 100644 libavcodec/mf_utils.c
 create mode 100644 libavcodec/mf_utils.h
 create mode 100644 libavcodec/mfenc.c

diff --git a/configure b/configure
index e7162dbc56..a52d1ebed5 100755
--- a/configure
+++ b/configure
@@ -304,6 +304,7 @@ External library support:
   --enable-mbedtls enable mbedTLS, needed for https support
if openssl, gnutls or libtls is not used [no]
   --enable-mediacodec  enable Android MediaCodec support [no]
+  --enable-mf  enable decoding via MediaFoundation [auto]
   --enable-libmysofa   enable libmysofa, needed for sofalizer filter [no]
   --enable-openal  enable OpenAL 1.1 capture support [no]
   --enable-opencl  enable OpenCL processing [no]
@@ -1704,6 +1705,7 @@ EXTERNAL_AUTODETECT_LIBRARY_LIST="
 libxcb_shape
 libxcb_xfixes
 lzma
+mf
 schannel
 sdl2
 securetransport
@@ -3013,6 +3015,8 @@ wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
 wmv3_vdpau_hwaccel_select="vc1_vdpau_hwaccel"
 
 # hardware-accelerated codecs
+mf_deps="mftransform_h MFCreateAlignedMemoryBuffer"
+mf_extralibs="-lmfplat -lmfuuid -lole32 -lstrmiids"
 omx_deps="libdl pthreads"
 omx_rpi_select="omx"
 qsv_deps="libmfx"
@@ -3037,6 +3041,8 @@ nvenc_deps="ffnvcodec"
 nvenc_deps_any="libdl LoadLibrary"
 nvenc_encoder_deps="nvenc"
 
+aac_mf_encoder_deps="mf"
+ac3_mf_encoder_deps="mf"
 h263_v4l2m2m_decoder_deps="v4l2_m2m h263_v4l2_m2m"
 h263_v4l2m2m_encoder_deps="v4l2_m2m h263_v4l2_m2m"
 h264_amf_encoder_deps="amf"
@@ -3045,6 +3051,7 @@ h264_cuvid_decoder_deps="cuvid"
 h264_cuvid_decoder_select="h264_mp4toannexb_bsf"
 h264_mediacodec_decoder_deps="mediacodec"
 h264_mediacodec_decoder_select="h264_mp4toannexb_bsf h264_parser"
+h264_mf_encoder_deps="mf"
 h264_mmal_decoder_deps="mmal"
 h264_nvenc_encoder_deps="nvenc"
 h264_omx_encoder_deps="omx"
@@ -3061,6 +3068,7 @@ hevc_cuvid_decoder_deps="cuvid"
 hevc_cuvid_decoder_select="hevc_mp4toannexb_bsf"
 hevc_mediacodec_decoder_deps="mediacodec"
 hevc_mediacodec_decoder_select="hevc_mp4toannexb_bsf hevc_parser"
+hevc_mf_encoder_deps="mf"
 hevc_nvenc_encoder_deps="nvenc"
 hevc_qsv_decoder_select="hevc_mp4toannexb_bsf qsvdec"
 hevc_qsv_encoder_select="hevcparse qsvenc"
@@ -3077,6 +3085,7 @@ mjpeg_qsv_encoder_deps="libmfx"
 mjpeg_qsv_encoder_select="qsvenc"
 mjpeg_vaapi_encoder_deps="VAEncPictureParameterBufferJPEG"
 mjpeg_vaapi_encoder_select="cbs_jpeg jpegtables vaapi_encode"
+mp3_mf_encoder_deps="mf"
 mpeg1_cuvid_decoder_deps="cuvid"
 mpeg1_v4l2m2m_decoder_deps="v4l2_m2m mpeg1_v4l2_m2m"
 mpeg2_crystalhd_decoder_select="crystalhd"
@@ -6099,6 +6108,7 @@ check_headers io.h
 check_headers linux/perf_event.h
 check_headers libcrystalhd/libcrystalhd_if.h
 check_headers malloc.h
+check_headers mftransform.h
 check_headers net/udplite.h
 check_headers poll.h
 check_headers sys/param.h
@@ -6161,6 +6171,7 @@ check_type "windows.h dxva.h" "DXVA_PicParams_VP9" 
-DWINAPI_FAMILY=WINAPI_FAMILY
 check_type "windows.h d3d11.h" "ID3D11VideoDecoder"
 check_type "windows.h d3d11.h" "ID3D11VideoContext"
 check_type "d3d9.h dxva2api.h" DXVA2_ConfigPictureDecode -D_WIN32_WINNT=0x0602
+check_func_headers mfapi.h MFCreateAlignedMemoryBuffer -lmfplat
 
 check_type "vdpau/vdpau.h" "VdpPictureInfoHEVC"
 check_type "vdpau/vdpau.h" "VdpPictureInfoVP9"
diff --git