On Tue May 27 21:27:36 2025 +0000, Brendan McGrath wrote:
At the risk of too much information, I'll share a few more details of what I'm looking at. The file I'm testing against is: https://dragon.theater/tmp/av1test.mp4 If I run `ffprobe` against this, I get:
Video: av1 (Main) (av01 / 0x31307661), yuv420p10le(tv, progressive)
If I check the output of `IMFTransform::GetOutputAvailableType` on the Windows AV1 decoder MFT, I get:
Output 0: - {F7E34C9A-42E8-4714-B74B-CB29D72C35E5} (MF_MT_SUBTYPE): {30313050-0000-0010-8000-00AA00389B71} (MFVideoFormat_P010) Output 1: - {F7E34C9A-42E8-4714-B74B-CB29D72C35E5} (MF_MT_SUBTYPE): {36313050-0000-0010-8000-00AA00389B71} (MFVideoFormat_P016) Output 2: - {F7E34C9A-42E8-4714-B74B-CB29D72C35E5} (MF_MT_SUBTYPE): {3231564E-0000-0010-8000-00AA00389B71} (MFVideoFormat_NV12) Output 3: - {F7E34C9A-42E8-4714-B74B-CB29D72C35E5} (MF_MT_SUBTYPE): {56555949-0000-0010-8000-00AA00389B71} (MFVideoFormat_IYUV)
So you can see `ffprobe` states `yuv420p10le`, but that's not offered by Windows. Instead `MFVideoFormat_P010` is the preferred option. Under Wine (when using a winegstreamer source), we don't use an MFT to decode, that is done by the media source. With this MR, the offered outputs of the media source are:
Output 0: - {F7E34C9A-42E8-4714-B74B-CB29D72C35E5} (MF_MT_SUBTYPE): {30313050-0000-0010-8000-00AA00389B71} (MFVideoFormat_P010) Output 1: - {F7E34C9A-42E8-4714-B74B-CB29D72C35E5} (MF_MT_SUBTYPE): {3231564E-0000-0010-8000-00AA00389B71} (MFVideoFormat_NV12) Output 2: - {F7E34C9A-42E8-4714-B74B-CB29D72C35E5} (MF_MT_SUBTYPE): {32315659-0000-0010-8000-00AA00389B71} (MFVideoFormat_YV12) Output 3: - {F7E34C9A-42E8-4714-B74B-CB29D72C35E5} (MF_MT_SUBTYPE): {32595559-0000-0010-8000-00AA00389B71} (MFVideoFormat_YUY2) Output 4: - {F7E34C9A-42E8-4714-B74B-CB29D72C35E5} (MF_MT_SUBTYPE): {30323449-0000-0010-8000-00AA00389B71} (MFVideoFormat_I420) Output 5: - {F7E34C9A-42E8-4714-B74B-CB29D72C35E5} (MF_MT_SUBTYPE): {56555949-0000-0010-8000-00AA00389B71} (MFVideoFormat_IYUV)
So, as discussed, `MFVideoFormat_P010` is just promoted to being the preferred option (Option 0). And finally, attached is the GStreamer pipeline when I play this file with MF Media Engine under Wine (with this MR in place). [0.00.00.159525593-wg_parser_caps.dot](/uploads/cb2c798b24b2f24819dee4c02d92fa40/0.00.00.159525593-wg_parser_caps.dot) You can see `av1dec` outputs `I420_10LE`. And we don't (can't) change that (which is what I meant by "state"). It's the very last element (`videoconvert1`) that converts it to `NV12`.
Oh I'm wrong, mfplat does use the preferred format, I was also led astray by the same commit.
I think the best way to deal with that would either be to skip adding the preferred format to the list if it's UNKNOWN, or to add a WG_VIDEO_FORMAT_I420_10LE which is translated to P010 in wg_parser_get_preferred_format(). But converting I420_10LE to P010 in caps conversion doesn't seem like a good solution.