0

I have this code that returns a list of installed video compressor codecs:

public static List<string> GetInstalledVideoCompressorCodecs()
{
    var codecs = new List<string>();
    var filterCategory = FilterCategory.VideoCompressorCategory;
    IMoniker[] monikers = new IMoniker[1];

    // Get a system device enumerator
    var devEnum = (ICreateDevEnum)new CreateDevEnum();

    // Enumerate the video codecs installed on the system
    devEnum.CreateClassEnumerator(filterCategory, out IEnumMoniker monikerEnum, 0);
    while (monikerEnum.Next(1, monikers, IntPtr.Zero) == 0)
    {
        monikers[0].GetDisplayName(null, null, out string codecName);

        // Add the codec name to the list
        codecs.Add(codecName);
    }

    return codecs;
}

However, depending on whether Prefer 32-bit in Project Properties > Build > General is checked, I get either:

u/device:dmo:{7E320092-596A-41B2-BBEB-175D10504EB6}{33D9A760-90C8-11D0-BD43-00A0C911CE86}

u/device:dmo:{D23B90D0-144F-46BD-841D-59E4EB19DC59}{33D9A760-90C8-11D0-BD43-00A0C911CE86}

u/device:dmo:{F7FFE0A0-A4F5-44B5-949E-15ED2BC66F9D}{33D9A760-90C8-11D0-BD43-00A0C911CE86}

u/device:sw:{33D9A760-90C8-11D0-BD43-00A0C911CE86}\DV Video Encoder

u/device:sw:{33D9A760-90C8-11D0-BD43-00A0C911CE86}\MJPEG Compressor

u/device:cm:{33D9A760-90C8-11D0-BD43-00A0C911CE86}\cvid

u/device:cm:{33D9A760-90C8-11D0-BD43-00A0C911CE86}\i420

u/device:cm:{33D9A760-90C8-11D0-BD43-00A0C911CE86}\iyuv

u/device:cm:{33D9A760-90C8-11D0-BD43-00A0C911CE86}\mrle

u/device:cm:{33D9A760-90C8-11D0-BD43-00A0C911CE86}\msvc

u/device:cm:{33D9A760-90C8-11D0-BD43-00A0C911CE86}\xvid

if it's checked, or

u/device:dmo:{7E320092-596A-41B2-BBEB-175D10504EB6}{33D9A760-90C8-11D0-BD43-00A0C911CE86}

u/device:dmo:{D23B90D0-144F-46BD-841D-59E4EB19DC59}{33D9A760-90C8-11D0-BD43-00A0C911CE86}

u/device:dmo:{F7FFE0A0-A4F5-44B5-949E-15ED2BC66F9D}{33D9A760-90C8-11D0-BD43-00A0C911CE86}

u/device:sw:{33D9A760-90C8-11D0-BD43-00A0C911CE86}\DV Video Encoder

u/device:sw:{33D9A760-90C8-11D0-BD43-00A0C911CE86}\ffdshow video encoder

u/device:sw:{33D9A760-90C8-11D0-BD43-00A0C911CE86}\MJPEG Compressor

if it's not checked. Why the difference?

Mickael Bergeron Néron
  • 1,472
  • 1
  • 18
  • 31
  • Probably because these codecs are 32/64 bit. – Jeroen van Langen Jul 14 '23 at 06:56
  • 32 and 64 bit codecs are independent and run in independent, not directly related environments; checking the mentioned box you switch between those environments, see also https://stackoverflow.com/a/39493817/868014 – Roman R. Jul 16 '23 at 17:14

1 Answers1

0

Depending on whether your application runs in 32-bit or 64-bit mode, it will load registered components from either the

HKEY_LOCAL_MACHINE\SOFTWARE\Classes

or

HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Classes

(I'm guessing this is where your codecs are registerd - please verify). Which makes sense too, since a 32-bit app can't load a 64-bit native dll and vice versa.

StefanFFM
  • 1,526
  • 1
  • 14
  • 25