Windows Media Foundation fails to create decoder when executed as Windows Service

148 views Asked by At

I'm experiencing a problem with the Windows Media Foundation's decoder. I don't get why my code works when running as part of an executable lunched thru the UI of the OS, but doesn't work when executed from the context of a Windows Service. Basically the problem is in the creation of the decoder. It seams that the codec is not found.

I've configured the Windows Service to run with the same account as the one running the non-service executable - it is not working.

I've configured the Windows Service to run with the Local System account (allowing the service to interact with desktop) - it is not working.

Here's what I observe in mftrace when the decoder fails to create:

2332,1D90 12:30:05.27759 CMFPlatExportDetours::MFTEnumEx @ Activate 00 @0285F8A0, MFT_FRIENDLY_NAME_Attribute=MPEG2VideoExtension;{3C0FBE52-D034-4115-995D-95B356B9855C}=1;MFT_INPUT_TYPES_Attributes=76 69 64 73 00 00 10 00 80 00 00 aa 00 38 9b 71 26 80 6d e0 46 db cf 11 b4 d1 00 80 5f 6c bb ea 76 69 64 73 00 00 10 00 80 00 00 aa 00 38 9b 71 4d 50 47 31 00 00 10 00 80 00 00 aa 00 38 9b 71 ;{7347C815-79FC-4AD9-877D-ACDF5F46685E}=C:\Program Files\WindowsApps\Microsoft.MPEG2VideoExtension_1.0.50901.0_x64__8wekyb3d8bbwe\x86\msmpeg2vdec_store.dll;MFT_OUTPUT_TYPES_Attributes=76 69 64 73 00 00 10 00 80 00 00 aa 00 38 9b 71 4e 56 31 32 00 00 10 00 80 00 00 aa 00 38 9b 71 76 69 64 73 00 00 10 00 80 00 00 aa 00 38 9b 71 49 59 55 56 00 00 10 00 80 00 00 aa 00 38 9b 71 76 69 ;MF_TRANSFORM_FLAGS_Attribute=1;{957193AD-9029-4835-A2F2-3EC9AE9BB6C8}=Microsoft.MPEG2VideoExtension_1.0.50901.0_x64__8wekyb3d8bbwe;{9D8B61A8-6BC8-4BFF-B31F-3A31060AFA3D}=Microsoft.MPEG2VideoExtension_8wekyb3d8bbwe;{BB49BC51-1810-4C3A-A9CF-D59C4E5B9622}={8103D590-5DC4-4825-A0D4-284395381C54};MF_TRANSFORM_CATEGORY_Attribute=MFT_CATEGORY_VIDEO_DECODER;{DE106D30-42FB-4767-808D-0FCC6811B0B9}=MPEGDecoder.MFTMPEGDecoderTransform;{F9542F80-D069-4EFE-B30D-345536F76AAA}=0;{F9A1EF38-F61E-42E6-87B3-309438F9AC67}=0
2332,1D90 12:30:05.27768 CMFPlatExportDetours::MFTEnumEx @ Activate 01 @02861048, MFT_FRIENDLY_NAME_Attribute=Microsoft MPEG Video Decoder MFT;MFT_INPUT_TYPES_Attributes=76 69 64 73 00 00 10 00 80 00 00 aa 00 38 9b 71 26 80 6d e0 46 db cf 11 b4 d1 00 80 5f 6c bb ea 76 69 64 73 00 00 10 00 80 00 00 aa 00 38 9b 71 4d 50 47 31 00 00 10 00 80 00 00 aa 00 38 9b 71 ;MFT_TRANSFORM_CLSID_Attribute={2D709E52-123F-49B5-9CBC-9AF5CDE28FB9};MFT_OUTPUT_TYPES_Attributes=76 69 64 73 00 00 10 00 80 00 00 aa 00 38 9b 71 4e 56 31 32 00 00 10 00 80 00 00 aa 00 38 9b 71 76 69 64 73 00 00 10 00 80 00 00 aa 00 38 9b 71 59 56 31 32 00 00 10 00 80 00 00 aa 00 38 9b 71 76 69 ;MF_TRANSFORM_FLAGS_Attribute=1;MF_TRANSFORM_CATEGORY_Attribute=MFT_CATEGORY_VIDEO_DECODER
2332,1D90 12:30:05.27964 COle32ExportDetours::CoCreateInstance @ Created {0000034B-0000-0000-C000-000000000046}  () @01D825D8 - traced interfaces: 
2332,1D90 12:30:05.28801 COle32ExportDetours::CoCreateInstance @ Created {00000323-0000-0000-C000-000000000046} - ignored
2332,1D90 12:30:05.29134 COle32ExportDetours::CoCreateInstance @ Created {00000339-0000-0000-C000-000000000046}  () @01FD5610 - traced interfaces: 
2332,1D90 12:30:05.29494 COle32ExportDetours::CoCreateInstance @ Created {22F5B1DF-7D7A-4D21-97F8-C21AEFBA859C}  () @01DE59BC - traced interfaces: 
2332,1D90 12:30:05.29524 COle32ExportDetours::CoCreateInstance @ Created {0000034B-0000-0000-C000-000000000046}  () @01F48C48 - traced interfaces: 
2332,1D90 12:30:05.31066 COle32ExportDetours::CoCreateInstance @ Created {00000339-0000-0000-C000-000000000046}  () @01F47A60 - traced interfaces: 
**2332,1D90 12:30:05.31298 COle32ExportDetours::CoCreateInstance @ Failed to create {2D709E52-123F-49B5-9CBC-9AF5CDE28FB9} Microsoft MPEG Video Decoder MFT (C:\Windows\SysWOW64\msmpeg2vdec.dll) hr=0xC004F011 (null)**

And this is the mftrace output then the decoder is successfully created:

14724,5784 13:40:53.00531 CMFPlatExportDetours::MFTEnumEx @ Activate 00 @0371A2C8, MFT_FRIENDLY_NAME_Attribute=MPEG2VideoExtension;{3C0FBE52-D034-4115-995D-95B356B9855C}=1;MFT_INPUT_TYPES_Attributes=76 69 64 73 00 00 10 00 80 00 00 aa 00 38 9b 71 26 80 6d e0 46 db cf 11 b4 d1 00 80 5f 6c bb ea 76 69 64 73 00 00 10 00 80 00 00 aa 00 38 9b 71 4d 50 47 31 00 00 10 00 80 00 00 aa 00 38 9b 71 ;{7347C815-79FC-4AD9-877D-ACDF5F46685E}=C:\Program Files\WindowsApps\Microsoft.MPEG2VideoExtension_1.0.50901.0_x64__8wekyb3d8bbwe\x86\msmpeg2vdec_store.dll;MFT_OUTPUT_TYPES_Attributes=76 69 64 73 00 00 10 00 80 00 00 aa 00 38 9b 71 4e 56 31 32 00 00 10 00 80 00 00 aa 00 38 9b 71 76 69 64 73 00 00 10 00 80 00 00 aa 00 38 9b 71 49 59 55 56 00 00 10 00 80 00 00 aa 00 38 9b 71 76 69 ;MF_TRANSFORM_FLAGS_Attribute=1;{957193AD-9029-4835-A2F2-3EC9AE9BB6C8}=Microsoft.MPEG2VideoExtension_1.0.50901.0_x64__8wekyb3d8bbwe;{9D8B61A8-6BC8-4BFF-B31F-3A31060AFA3D}=Microsoft.MPEG2VideoExtension_8wekyb3d8bbwe;{BB49BC51-1810-4C3A-A9CF-D59C4E5B9622}={5A73C951-DE09-4E99-89B9-CE0671C2B3A6};MF_TRANSFORM_CATEGORY_Attribute=MFT_CATEGORY_VIDEO_DECODER;{DE106D30-42FB-4767-808D-0FCC6811B0B9}=MPEGDecoder.MFTMPEGDecoderTransform;{F9542F80-D069-4EFE-B30D-345536F76AAA}=0;{F9A1EF38-F61E-42E6-87B3-309438F9AC67}=0
14724,5784 13:40:53.00541 CMFPlatExportDetours::MFTEnumEx @ Activate 01 @03715648, MFT_FRIENDLY_NAME_Attribute=Microsoft MPEG Video Decoder MFT;MFT_INPUT_TYPES_Attributes=76 69 64 73 00 00 10 00 80 00 00 aa 00 38 9b 71 26 80 6d e0 46 db cf 11 b4 d1 00 80 5f 6c bb ea 76 69 64 73 00 00 10 00 80 00 00 aa 00 38 9b 71 4d 50 47 31 00 00 10 00 80 00 00 aa 00 38 9b 71 ;MFT_TRANSFORM_CLSID_Attribute={2D709E52-123F-49B5-9CBC-9AF5CDE28FB9};MFT_OUTPUT_TYPES_Attributes=76 69 64 73 00 00 10 00 80 00 00 aa 00 38 9b 71 4e 56 31 32 00 00 10 00 80 00 00 aa 00 38 9b 71 76 69 64 73 00 00 10 00 80 00 00 aa 00 38 9b 71 59 56 31 32 00 00 10 00 80 00 00 aa 00 38 9b 71 76 69 ;MF_TRANSFORM_FLAGS_Attribute=1;MF_TRANSFORM_CATEGORY_Attribute=MFT_CATEGORY_VIDEO_DECODER
14724,5784 13:40:53.05267 COle32ExportDetours::CoCreateInstance @ Created {0000034B-0000-0000-C000-000000000046}  () @03080608 - traced interfaces: 
14724,5784 13:40:53.06348 COle32ExportDetours::CoCreateInstance @ Created {00000323-0000-0000-C000-000000000046} - ignored
14724,5784 13:40:53.06760 COle32ExportDetours::CoCreateInstance @ Created {00000339-0000-0000-C000-000000000046}  () @03037CB0 - traced interfaces: 
14724,5784 13:40:53.07307 COle32ExportDetours::CoCreateInstance @ Created {22F5B1DF-7D7A-4D21-97F8-C21AEFBA859C}  () @02E7716C - traced interfaces: 
14724,5784 13:40:53.07353 COle32ExportDetours::CoCreateInstance @ Created {0000034B-0000-0000-C000-000000000046}  () @03080B30 - traced interfaces: 
**14724,5784 13:40:53.09256 CMFActivateDetours::ActivateObject @0371A2C8 New MFT @03086DEC**
14724,5784 13:40:53.09270 CMFTransformDetours::Attach @03086DEC Rate control @03086DD4
14724,5784 13:40:53.09272 CMFActivateDetours::GetGUID @0371A2C8 attribute not found guidKey = MFT_TRANSFORM_CLSID_Attribute
14724,5784 13:40:53.09275 CMFAttributesDetours::GetUINT32 @00FFE438 attribute not found guidKey = {FB5D2347-4DD8-4509-AED0-DB5FA9AA93F4}
14724,5784 13:40:53.09278 CMFTopologyNodeDetours::GetGUID @03718870 attribute not found guidKey = MF_TOPONODE_TRANSFORM_OBJECTID
14724,5784 13:40:53.09278 CMFTransformDetours::Attach @03086DEC Rate control @03086DD4
14724,5784 13:40:53.09287 CMFAttributesDetours::GetUINT32 @0371B6F0 attribute not found guidKey = MF_TRANSFORM_ASYNC
14724,5784 13:40:53.09288 CMFAttributesDetours::GetStringLength @0371B6F0 attribute not found guidKey = MFT_ENUM_HARDWARE_URL_Attribute
14724,5784 13:40:53.09296 CMFTopologyDetours::GetUINT32 @036F9A18 attribute not found guidKey = MF_TOPOLOGY_DXVA_MODE
14724,5784 13:40:53.09300 CMFAttributesDetours::GetUINT32 @0371B6F0 attribute not found guidKey = GUID_NULL
14724,5784 13:40:53.09310 CMFAttributesDetours::GetUINT32 @0371B6F0 attribute not found guidKey = MF_TRANSFORM_ASYNC
14724,5784 13:40:53.09310 CMFAttributesDetours::GetUINT32 @0371B6F0 attribute not found guidKey = MF_TRANSFORM_ASYNC
14724,5784 13:40:53.09311 CMFAttributesDetours::GetStringLength @0371B6F0 attribute not found guidKey = MFT_ENUM_HARDWARE_URL_Attribute
14724,5784 13:40:53.09312 CMFTopologyDetours::GetUINT32 @036F9A18 attribute not found guidKey = {E48E1D3B-859A-40EC-928E-A5889EF0B458}
14724,5784 13:40:53.09312 CMFAttributesDetours::GetUINT32 @0371B6F0 attribute not found guidKey = MF_TRANSFORM_ASYNC
14724,5784 13:40:53.09312 CMFTopologyNodeDetours::GetUINT32 @03718870 attribute not found guidKey = MF_TOPONODE_LOCKED
14724,5784 13:40:53.09320 CMFTransformDetours::SetInputType @03086DEC Succeeded MT: MF_MT_FRAME_SIZE=3092376453696 (720,576);MF_MT_AVG_BITRATE=9700400;MF_MT_COMPRESSED=1;MF_MT_MPEG_SEQUENCE_HEADER=00 00 01 b3 2d 02 40 23 17 ae e3 80 00 00 01 b5 14 8a 00 01 00 00 ;MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_DEFAULT_STRIDE=0;MF_MT_AM_FORMAT_TYPE=FORMAT_MPEG2Video;MF_MT_AVG_BIT_ERROR_RATE=0;MF_MT_MPEG2_LEVEL=2;MF_MT_MPEG2_PROFILE=2;MF_MT_FIXED_SIZE_SAMPLES=1;{C380465D-2271-428C-9B83-ECEA3B4A85C1}=0;MF_MT_FRAME_RATE=107374182401 (25,1);MF_MT_PIXEL_ASPECT_RATIO=68719476751 (16,15);MF_MT_ALL_SAMPLES_INDEPENDENT=1;MF_MT_SAMPLE_SIZE=1;MF_MT_INTERLACE_MODE=2;MF_MT_SUBTYPE=MEDIASUBTYPE_MPEG2_VIDEO

Any help would be appreciated as I'm already stuck on this.

0

There are 0 answers