úterý 27. prosince 2016

Fix Xvid playback in Media Foundation in Windows 10 after Xvid codec installation

Currently there are two frameworks/APIs for media playback in Windows 10. Older DirectShow and newer Media Foundation (MF). The latter is used by e.g. Universal Windows Platform (UWP) applications/apps (formerly Metro applications/apps). With 64 bit OS both APIs are there twice - for 32 bits and 64 bits. This means four places where things could break.

One breakage I have recently encountered is with the free and open-source (FOSS) Xvid codec/software. When this software (version 1.3.4 build 20150621) is installed it breaks Xvid (MPEG-4 ASP with FourCC set to XVID) videos playback in MF. This is painful because the default application for video playback in Windows 10 is UWP based app called zunevideo (or TwinUI, or Movies & TV). The problem manifests as a black screen during Xvid playback in the zunevideo. Unfortunately the zunevideo doesn't show any error or message what's wrong and what's worse the uninstallation of the Xvid codec/software doesn't fix the problem.

Upon analysis of the problem it seems that the Xvid doesn't support MF, but the Xvid installer removes mappings of XVID to MS codec and doesn't return it after uninstallation. I reported the problem to Xvid upstream. To fix the problem the following registry edits which re-adds mappings of xvid/XVID to MP4V can be used:

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\MediaFoundation\MapVideo4cc]
"58564944"=dword:5634504d

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\MediaFoundation\MapVideo4cc]
"78766964"=dword:5634504d

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\WOW6432Node\MediaFoundation\MapVideo4cc]
"58564944"=dword:5634504d

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\WOW6432Node\MediaFoundation\MapVideo4cc]
"78766964"=dword:5634504d

The first line maps FourCC "58564944" ("XVID" in ASCII) to FourCC 0x5634504d ("MP4V" in ASCII Little-Endian). The second line do the same for the same FourCC, but in lower case ("xvid" in ASCII). The last two lines do the same as the first two lines, but for 32 bits. This fixes the Xvid playback in MF for me.

Žádné komentáře:

Okomentovat