windows - IMFMediaSink undlader at tilføje anden lydudgangsstrøm på pc'er med AMD-GPU'er

Indlæg af Hanne Mølgaard Plasc

Problem



Jeg forsøger at oprette en MP4 IMFMediaSink og tilføje to lydindgange (pcm) kodet, så jeg kan have to lyd AAC-spor i min mp4-fil.


Dette fungerer på pc'er med Intel eller NVidia GPU'er installeret. Lyden er kodet fra PCM til AAC og spiller fint for begge lydlag.


Med AMD GPU (i mit tilfælde R9) udstyrede pc'er får jeg en fejl, når jeg forsøger at tilføje den anden lydudgangsstrøm.


Fejlen fortæller mig ikke meget:



  'Anmodningen er ugyldig i den aktuelle tilstand.'



Min AAC Audio MediaType er oprettet som denne:


   hr = MFCreateMediaType(&pMediaType);

   hr = pMediaType->SetGUID(MF\_MT\_MAJOR\_TYPE, MFMediaType\_Audio);
   hr = pMediaType->SetGUID(MF\_MT\_SUBTYPE, MFAudioFormat\_AAC);
   hr = pMediaType->SetUINT32(MF\_MT\_AUDIO\_BITS\_PER\_SAMPLE, sampleBitSize);
   hr = pMediaType->SetUINT32(MF\_MT\_AUDIO\_SAMPLES\_PER\_SECOND, sampleRate);
   hr = pMediaType->SetUINT32(MF\_MT\_AUDIO\_NUM\_CHANNELS, numChannels);
   hr = pMediaType->SetUINT32(MF\_MT\_AUDIO\_AVG\_BYTES\_PER\_SECOND, kAverageBytesPerSec);
   pMediaType->SetBlob(MF\_MT\_USER\_DATA, userData, sizeof(userData));


Opkaldet til 'AddStream ()' fejler anden gang jeg kalder det:


   hr = pSinkWriter->AddStream(pOutputAudioMediaType, &audioLayerIdx);


Min SinkWriter initialiseres med disse attributter:


   MFCreateAttributes(&pAttributes, 2);
   pAttributes->SetUINT32(MF\_READWRITE\_ENABLE\_HARDWARE\_TRANSFORMS, 0);
   pAttributes->SetUINT32(MF\_LOW\_LATENCY, 1);
   pAttributes->SetGUID(MF\_TRANSCODE\_CONTAINERTYPE, MFTranscodeContainerType\_MPEG4);
   MFCreateSinkWriterFromURL(NULL, pWriteStream, pAttributes, &pSinkWriter);


Har nogen ramt dette problem? Enhver ide om, hvad jeg måske gør forkert?


Enhver hjælp ville blive meget værdsat! Jeg har slået mit hoved på dette problem i et stykke tid nu.


MFTrace (undskyld for det store dump):


5460,1BC 12:21:04.53040 CKernel32ExportDetours::OutputDebugStringA @ ******************************************************** 111
5460,1BC 12:21:04.53043 CMFReadWriteExportDetours::MFCreateSinkWriterFromURL @ URL: '.mp4', bytestream @00000268FDFBFE90, MF\_TRANSCODE\_CONTAINERTYPE=MFTranscodeContainerType\_MPEG4;MF\_READWRITE\_DISABLE\_CONVERTERS=1;{9C27891A-ED7A-40E1-88E8-B22727A024EE}=1;MF\_READWRITE\_ENABLE\_HARDWARE\_TRANSFORMS=0
5460,1BC 12:21:04.53054 COle32ExportDetours::CoCreateInstance @ Created {48E2ED0F-98C2-4A37-BED5-166312DDD83F} MFReadWrite Class Factory (C:WindowsSystem32mfreadwrite.dll) @00000268BA21BCC0 - traced interfaces: IMFReadWriteClassFactory @00000268BA21BCC0, 
5460,1BC 12:21:04.53055 CMFReadWriteClassFactoryDetours::CreateInstanceFromObject @00000268BA21BCC0 Object @00000268FDFBFE90, MF\_TRANSCODE\_CONTAINERTYPE=MFTranscodeContainerType\_MPEG4;MF\_READWRITE\_DISABLE\_CONVERTERS=1;{9C27891A-ED7A-40E1-88E8-B22727A024EE}=1;MF\_READWRITE\_ENABLE\_HARDWARE\_TRANSFORMS=0
5460,1BC 12:21:04.53056 CMFAttributesDetours::GetUnknown @00000268C75EDD30 attribute not found guidKey = MF\_SINK\_WRITER\_ASYNC\_CALLBACK
5460,1BC 12:21:04.53056 CMFAttributesDetours::GetUINT32 @00000268C75EDD30 attribute not found guidKey = MF\_SINK\_WRITER\_DISABLE\_THROTTLING
5460,1BC 12:21:04.53057 CMFAttributesDetours::GetUnknown @00000268C75EDD30 attribute not found guidKey = {2ACF1917-3743-41DF-A564-E727A80EA33E}
5460,1BC 12:21:04.53057 CMFAttributesDetours::GetItemType @00000268C75EDD30 attribute not found guidKey = MF\_SINK\_WRITER\_ASYNC\_CALLBACK
5460,1BC 12:21:04.53058 CMFAttributesDetours::GetItemType @00000268C75EDD30 attribute not found guidKey = MF\_SINK\_WRITER\_DISABLE\_THROTTLING
5460,1BC 12:21:04.53058 CMFAttributesDetours::GetItemType @00000268C75EDD30 attribute not found guidKey = MF\_SOURCE\_READER\_D3D\_MANAGER
5460,1BC 12:21:04.53058 CMFAttributesDetours::GetUINT32 @00000268C75EDD30 attribute not found guidKey = {BDAD7BCA-0E5F-4B10-AB16-26DE381B6293}
5460,1BC 12:21:04.53059 CMFAttributesDetours::GetItemType @00000268C75EDD30 attribute not found guidKey = {39384300-D0EB-40B1-87A0-3318871B5A53}
5460,1BC 12:21:04.53059 CMFAttributesDetours::GetItemType @00000268C75EDD30 attribute not found guidKey = {430847DA-0890-4B0E-938C-054332C547E1}
5460,1BC 12:21:04.53059 CMFAttributesDetours::GetItemType @00000268C75EDD30 attribute not found guidKey = {43AD19CE-F33F-4BA9-A580-E4CD12F2D144}
5460,1BC 12:21:04.53060 CMFAttributesDetours::GetItemType @00000268C75EDD30 attribute not found guidKey = {273DB885-2DE2-4DB2-A6A7-FDB66FB40B61}
5460,1BC 12:21:04.53060 CMFReadWriteClassFactoryDetours::HandleObject @ New sink writer @00000268BA21E980

>>> adding video stream (input H264 ouput H264 : basically a passthrough) stream here....

5460,1BC 12:21:04.53062 CKernel32ExportDetours::OutputDebugStringA @ ******************************************************** 222
5460,1BC 12:21:04.53063 CKernel32ExportDetours::OutputDebugStringA @  
5460,1BC 12:21:04.53068 CMFAttributesDetours::GetUnknown @00000268C75EDD30 attribute not found guidKey = MF\_SOURCE\_READER\_D3D\_MANAGER
5460,1BC 12:21:04.53077 CMFSinkWriterDetours::AddStream @00000268BA21E980 Stream Index 0x0, MT: MF\_MT\_FRAME\_SIZE=5497558139600 (1280,720);MF\_MT\_MPEG\_SEQUENCE\_HEADER=00 00 01 67 42 c0 1f 95 b0 14 01 6e c0 44 00 00 03 00 04 00 00 03 00 f0 36 82 21 1b 80 00 00 01 68 ca 8f 20 ;MF\_MT\_MAJOR\_TYPE=MEDIATYPE\_Video;MF\_MT\_FRAME\_RATE=128849018881 (30,1);MF\_MT\_PIXEL\_ASPECT\_RATIO=4294967297 (1,1);MF\_MT\_INTERLACE\_MODE=2;MF\_MT\_SUBTYPE=MEDIASUBTYPE\_H264
5460,1BC 12:21:04.53085 CMFSinkWriterDetours::SetInputMediaType @00000268BA21E980 Stream Index 0x0, MT: MF\_MT\_FRAME\_SIZE=5497558139600 (1280,720);MF\_MT\_MPEG\_SEQUENCE\_HEADER=00 00 01 67 42 c0 1f 95 b0 14 01 6e c0 44 00 00 03 00 04 00 00 03 00 f0 36 82 21 1b 80 00 00 01 68 ca 8f 20 ;MF\_MT\_MAJOR\_TYPE=MEDIATYPE\_Video;MF\_MT\_FRAME\_RATE=128849018881 (30,1);MF\_MT\_PIXEL\_ASPECT\_RATIO=4294967297 (1,1);MF\_MT\_INTERLACE\_MODE=2;MF\_MT\_SUBTYPE=MEDIASUBTYPE\_H264

>>> adding FIRST audio stream here....

5460,1BC 12:21:04.53089 CKernel32ExportDetours::OutputDebugStringA @ ******************************************************** 333
5460,1BC 12:21:04.53092 CKernel32ExportDetours::OutputDebugStringA @  
5460,1BC 12:21:04.53095 CMFAttributesDetours::GetUnknown @00000268C75EDD30 attribute not found guidKey = MF\_SOURCE\_READER\_D3D\_MANAGER
5460,1BC 12:21:04.53098 CMFSinkWriterDetours::AddStream @00000268BA21E980 Stream Index 0x1, MT: MF\_MT\_AUDIO\_AVG\_BYTES\_PER\_SECOND=16000;MF\_MT\_AUDIO\_NUM\_CHANNELS=2;MF\_MT\_MAJOR\_TYPE=MEDIATYPE\_Audio;MF\_MT\_AUDIO\_SAMPLES\_PER\_SECOND=44100;MF\_MT\_USER\_DATA=00 00 29 00 00 00 00 00 00 00 00 00 12 10 ;MF\_MT\_AUDIO\_BITS\_PER\_SAMPLE=16;MF\_MT\_SUBTYPE=MFAudioFormat\_AAC
5460,1BC 12:21:04.53101 CKernel32ExportDetours::OutputDebugStringA @ ******************************************************** 444
5460,1BC 12:21:04.53102 CKernel32ExportDetours::OutputDebugStringA @  
5460,1BC 12:21:04.53106 CMFAttributesDetours::GetUnknown @00000268C75EDBB0 attribute not found guidKey = MF\_SOURCE\_READER\_D3D\_MANAGER
5460,1BC 12:21:04.53107 CMFAttributesDetours::GetUnknown @00000268C75EDBB0 attribute not found guidKey = MFT\_FIELDOFUSE\_UNLOCK\_Attribute
5460,1BC 12:21:04.53107 CMFAttributesDetours::GetUINT32 @00000268C75EDBB0 attribute not found guidKey = {D91B0085-C86D-4F81-8822-8C68E1D7FA04}
5460,1BC 12:21:04.53108 CMFAttributesDetours::GetUINT32 @00000268C75EDBB0 attribute not found guidKey = {66B16DA9-ADD4-47E0-A16B-5AF1FB483634}
5460,1BC 12:21:04.53108 CMFAttributesDetours::GetUINT32 @00000268C75EDBB0 attribute not found guidKey = {FB683E7E-1CAC-4DBD-9E97-A321EF334D67}
5460,1BC 12:21:04.53109 CMFPlatExportDetours::MFTEnumEx @ Category: MFT\_CATEGORY\_AUDIO\_ENCODER, Flags: 0x00000073, input MT: <NULL>, output MT: MF\_MT\_MAJOR\_TYPE=MEDIATYPE\_Audio;MF\_MT\_SUBTYPE=MFAudioFormat\_AAC
5460,1BC 12:21:04.53144 CMFAttributesDetours::GetUINT32 @00000268C75EDEB0 attribute not found guidKey = MFT\_CODEC\_MERIT\_Attribute
5460,1BC 12:21:04.53154 CMFAttributesDetours::GetUINT32 @00000268C75EDEB0 attribute not found guidKey = MFT\_CODEC\_MERIT\_Attribute
5460,1BC 12:21:04.53164 CMFAttributesDetours::GetUINT32 @00000268C75EDEB0 attribute not found guidKey = MFT\_CODEC\_MERIT\_Attribute
5460,1BC 12:21:04.53174 CMFAttributesDetours::GetUINT32 @00000268C75EDEB0 attribute not found guidKey = MFT\_CODEC\_MERIT\_Attribute
5460,1BC 12:21:04.53184 CMFAttributesDetours::GetUINT32 @00000268C75EDEB0 attribute not found guidKey = MFT\_CODEC\_MERIT\_Attribute
5460,1BC 12:21:04.53194 CMFAttributesDetours::GetUINT32 @00000268C75EDEB0 attribute not found guidKey = MFT\_CODEC\_MERIT\_Attribute
5460,1BC 12:21:04.53204 CMFAttributesDetours::GetUINT32 @00000268C75EDEB0 attribute not found guidKey = MFT\_CODEC\_MERIT\_Attribute
5460,1BC 12:21:04.53214 CMFAttributesDetours::GetUINT32 @00000268C75EDEB0 attribute not found guidKey = MFT\_CODEC\_MERIT\_Attribute
5460,1BC 12:21:04.53228 CMFAttributesDetours::GetUINT32 @00000268C75EDEB0 attribute not found guidKey = MFT\_CODEC\_MERIT\_Attribute
5460,1BC 12:21:04.53238 CMFAttributesDetours::GetUINT32 @00000268C75EDEB0 attribute not found guidKey = MFT\_CODEC\_MERIT\_Attribute
5460,1BC 12:21:04.53314 COle32ExportDetours::CoCreateInstance @ Created {00000339-0000-0000-C000-000000000046}  () @000002688EB54A30 - traced interfaces: 
5460,1BC 12:21:04.53389 COle32ExportDetours::CoCreateInstance @ Created {00000339-0000-0000-C000-000000000046}  () @000002688EB55170 - traced interfaces: 
5460,1BC 12:21:04.53434 COle32ExportDetours::CoCreateInstance @ Created {00000339-0000-0000-C000-000000000046}  () @000002688EB57210 - traced interfaces: 
5460,1BC 12:21:04.53446 CMFActivateDetours::GetUINT32 @00000268C7FB49F0 attribute not found guidKey = {3C0FBE52-D034-4115-995D-95B356B9855C}
5460,1BC 12:21:04.53447 CMFActivateDetours::GetUINT32 @00000268C7FB49F0 attribute not found guidKey = MFT\_CODEC\_MERIT\_Attribute
5460,1BC 12:21:04.53447 CMFActivateDetours::GetStringLength @00000268C7FB49F0 attribute not found guidKey = MFT\_ENUM\_HARDWARE\_URL\_Attribute
5460,1BC 12:21:04.53450 CMFPlatExportDetours::MFTEnumEx @ Activate 00 @00000268C7FB49F0, MFT\_FRIENDLY\_NAME\_Attribute=Microsoft AAC Audio Encoder MFT;MFT\_INPUT\_TYPES\_Attributes=61 75 64 73 00 00 10 00 80 00 00 aa 00 38 9b 71 01 00 00 00 00 00 10 00 80 00 00 aa 00 38 9b 71 ;MFT\_TRANSFORM\_CLSID\_Attribute={93AF0C51-2275-45D2-A35B-F2BA21CAED00};MFT\_OUTPUT\_TYPES\_Attributes=61 75 64 73 00 00 10 00 80 00 00 aa 00 38 9b 71 10 16 00 00 00 00 10 00 80 00 00 aa 00 38 9b 71 ;MF\_TRANSFORM\_FLAGS\_Attribute=1;MF\_TRANSFORM\_CATEGORY\_Attribute=MFT\_CATEGORY\_AUDIO\_ENCODER
5460,1BC 12:21:04.53485 COle32ExportDetours::CoCreateInstance @ New MFT @00000268B94D8F48, <NULL>
5460,1BC 12:21:04.53485 COle32ExportDetours::CoCreateInstance @ Created {93AF0C51-2275-45D2-A35B-F2BA21CAED00}  (C:WindowsSystem32mfAACEnc.dll) @00000268B94D8F48 - traced interfaces: IMFTransform @00000268B94D8F48, 
5460,1BC 12:21:04.53486 CMFActivateDetours::GetUnknown @00000268C7FB49F0 attribute not found guidKey = MFT\_PREFERRED\_ENCODER\_PROFILE
5460,1BC 12:21:04.53486 CMFActivateDetours::GetUnknown @00000268C7FB49F0 attribute not found guidKey = MFT\_PREFERRED\_OUTPUTTYPE\_Attribute
5460,1BC 12:21:04.53486 CMFActivateDetours::GetUINT32 @00000268C7FB49F0 attribute not found guidKey = MFT\_CODEC\_MERIT\_Attribute
5460,1BC 12:21:04.53486 CMFActivateDetours::ActivateObject @00000268C7FB49F0 New MFT @00000268B94D8F48
5460,1BC 12:21:04.53488 CMFAttributesDetours::GetUnknown @00000268C75EDBB0 attribute not found guidKey = MF\_SOURCE\_READER\_D3D\_MANAGER
5460,1BC 12:21:04.53488 CMFAttributesDetours::GetUINT32 @00000268C635CD80 attribute not found guidKey = MF\_SA\_D3D\_AWARE
5460,1BC 12:21:04.53489 CMFAttributesDetours::GetUINT32 @00000268C75EDBB0 attribute not found guidKey = {EACF97AD-065C-4408-BEE3-FDCBFD128BE2}
5460,1BC 12:21:04.53489 CMFAttributesDetours::GetUINT32 @00000268C75EDBB0 attribute not found guidKey = {7B8F32C3-6D96-4B89-9203-DD38B61414F3}
5460,1BC 12:21:04.53489 CMFAttributesDetours::GetUINT32 @00000268C75EDBB0 attribute not found guidKey = {39DBD44D-2E44-4931-A4C8-352D3DC42115}
5460,1BC 12:21:04.53490 CMFAttributesDetours::GetUINT32 @00000268C75EDBB0 attribute not found guidKey = {1B320A5D-DEAB-4986-95A3-950E19B82CB0}
5460,1BC 12:21:04.53491 CMFTransformDetours::SetInputType @00000268B94D8F48 Succeeded MT: <NULL>
5460,1BC 12:21:04.53491 CMFTransformDetours::SetOutputType @00000268B94D8F48 Succeeded MT: <NULL>
5460,1BC 12:21:04.53495 CMFTransformDetours::SetInputType @00000268B94D8F48 Succeeded MT: MF\_MT\_AUDIO\_AVG\_BYTES\_PER\_SECOND=176400;MF\_MT\_AVG\_BITRATE=1411200;MF\_MT\_AUDIO\_BLOCK\_ALIGNMENT=4;MF\_MT\_AUDIO\_NUM\_CHANNELS=2;MF\_MT\_COMPRESSED=0;MF\_MT\_MAJOR\_TYPE=MEDIATYPE\_Audio;MF\_MT\_AUDIO\_SAMPLES\_PER\_SECOND=44100;MF\_MT\_AM\_FORMAT\_TYPE=FORMAT\_WaveFormatEx;MF\_MT\_AUDIO\_PREFER\_WAVEFORMATEX=1;MF\_MT\_FIXED\_SIZE\_SAMPLES=1;MF\_MT\_ALL\_SAMPLES\_INDEPENDENT=1;MF\_MT\_AUDIO\_BITS\_PER\_SAMPLE=16;MF\_MT\_SUBTYPE=MFAudioFormat\_PCM
5460,1BC 12:21:04.53497 CMFTransformDetours::SetOutputType @00000268B94D8F48 Succeeded MT: MF\_MT\_AUDIO\_AVG\_BYTES\_PER\_SECOND=16000;MF\_MT\_AVG\_BITRATE=128000;MF\_MT\_AUDIO\_BLOCK\_ALIGNMENT=1;MF\_MT\_AUDIO\_NUM\_CHANNELS=2;MF\_MT\_COMPRESSED=1;MF\_MT\_MAJOR\_TYPE=MEDIATYPE\_Audio;MF\_MT\_AUDIO\_SAMPLES\_PER\_SECOND=44100;MF\_MT\_AM\_FORMAT\_TYPE=FORMAT\_WaveFormatEx;MF\_MT\_AAC\_AUDIO\_PROFILE\_LEVEL\_INDICATION=41;MF\_MT\_AUDIO\_PREFER\_WAVEFORMATEX=1;MF\_MT\_USER\_DATA=00 00 29 00 00 00 00 00 00 00 00 00 12 10 ;MF\_MT\_FIXED\_SIZE\_SAMPLES=0;MF\_MT\_AAC\_PAYLOAD\_TYPE=0;MF\_MT\_AUDIO\_BITS\_PER\_SAMPLE=16;MF\_MT\_SUBTYPE=MFAudioFormat\_AAC
5460,1BC 12:21:04.53498 CMFAttributesDetours::GetUnknown @00000268C75EDBB0 attribute not found guidKey = MF\_SOURCE\_READER\_D3D\_MANAGER
5460,1BC 12:21:04.53499 CMFAttributesDetours::GetUINT32 @00000268C635CD80 attribute not found guidKey = {039C0C90-25A9-4DD3-881D-5C1E1534E48B}
5460,1BC 12:21:04.53499 CMFAttributesDetours::GetString @00000268C75EDBB0 attribute not found guidKey = {430847DA-0890-4B0E-938C-054332C547E1}
5460,1BC 12:21:04.53500 CMFAttributesDetours::GetString @00000268C75EDBB0 attribute not found guidKey = {39384300-D0EB-40B1-87A0-3318871B5A53}
5460,1BC 12:21:04.53501 CMFSinkWriterDetours::SetInputMediaType @00000268BA21E980 Stream Index 0x1, MT: MF\_MT\_AUDIO\_NUM\_CHANNELS=2;MF\_MT\_MAJOR\_TYPE=MEDIATYPE\_Audio;MF\_MT\_AUDIO\_SAMPLES\_PER\_SECOND=44100;MF\_MT\_AUDIO\_BITS\_PER\_SAMPLE=16;MF\_MT\_SUBTYPE=MFAudioFormat\_PCM

>>> adding SECOND audio stream here....

5460,1BC 12:21:04.53505 CKernel32ExportDetours::OutputDebugStringA @ ******************************************************** 333
5460,1BC 12:21:04.53507 CKernel32ExportDetours::OutputDebugStringA @  
5460,1BC 12:21:04.53509 CMFSinkWriterDetours::AddStream @00000268BA21E980 Failed MT: MF\_MT\_AUDIO\_AVG\_BYTES\_PER\_SECOND=16000;MF\_MT\_AVG\_BITRATE=128000;MF\_MT\_AUDIO\_BLOCK\_ALIGNMENT=1;MF\_MT\_AUDIO\_NUM\_CHANNELS=2;MF\_MT\_COMPRESSED=1;MF\_MT\_MAJOR\_TYPE=MEDIATYPE\_Audio;MF\_MT\_AUDIO\_SAMPLES\_PER\_SECOND=44100;MF\_MT\_AM\_FORMAT\_TYPE=FORMAT\_WaveFormatEx;MF\_MT\_AAC\_AUDIO\_PROFILE\_LEVEL\_INDICATION=41;MF\_MT\_AUDIO\_PREFER\_WAVEFORMATEX=1;MF\_MT\_USER\_DATA=00 00 29 00 00 00 00 00 00 00 00 00 12 10 ;MF\_MT\_FIXED\_SIZE\_SAMPLES=0;MF\_MT\_AAC\_PAYLOAD\_TYPE=0;MF\_MT\_AUDIO\_BITS\_PER\_SAMPLE=16;MF\_MT\_SUBTYPE=MFAudioFormat\_AAC


Her er MFTrace på en pc, hvor en anden lyd stream bliver tilføjet tilføjet:


>> Add the SECOND Audio AAC output... 

8156,2600 14:17:59.04339 CKernel32ExportDetours::OutputDebugStringA @ ******************************************************** 333
8156,2600 14:17:59.04341 CKernel32ExportDetours::OutputDebugStringA @  
8156,2600 14:17:59.04343 CMFAttributesDetours::GetUnknown @000001A843796490 attribute not found guidKey = MF\_SOURCE\_READER\_D3D\_MANAGER
8156,2600 14:17:59.04345 CMFSinkWriterDetours::AddStream @000001A8411B0A50 Stream Index 0x2, MT: MF\_MT\_AUDIO\_AVG\_BYTES\_PER\_SECOND=16000;MF\_MT\_AVG\_BITRATE=128000;MF\_MT\_AUDIO\_BLOCK\_ALIGNMENT=1;MF\_MT\_AUDIO\_NUM\_CHANNELS=2;MF\_MT\_COMPRESSED=1;MF\_MT\_MAJOR\_TYPE=MEDIATYPE\_Audio;MF\_MT\_AUDIO\_SAMPLES\_PER\_SECOND=44100;MF\_MT\_AM\_FORMAT\_TYPE=FORMAT\_WaveFormatEx;MF\_MT\_AAC\_AUDIO\_PROFILE\_LEVEL\_INDICATION=41;MF\_MT\_AUDIO\_PREFER\_WAVEFORMATEX=1;MF\_MT\_USER\_DATA=00 00 29 00 00 00 00 00 00 00 00 00 12 10 ;MF\_MT\_FIXED\_SIZE\_SAMPLES=0;MF\_MT\_AAC\_PAYLOAD\_TYPE=0;MF\_MT\_AUDIO\_BITS\_PER\_SAMPLE=16;MF\_MT\_SUBTYPE=MFAudioFormat\_AAC

>> Add the SECOND Audio PCM input... 

    8156,2600 14:17:59.04346 CKernel32ExportDetours::OutputDebugStringA @ ******************************************************** 444
    8156,2600 14:17:59.04347 CKernel32ExportDetours::OutputDebugStringA @  
    8156,2600 14:17:59.04350 CMFAttributesDetours::GetUnknown @000001A8374F10F0 attribute not found guidKey = MF\_SOURCE\_READER\_D3D\_MANAGER
    8156,2600 14:17:59.04350 CMFAttributesDetours::GetUnknown @000001A8374F10F0 attribute not found guidKey = MFT\_FIELDOFUSE\_UNLOCK\_Attribute
    8156,2600 14:17:59.04351 CMFAttributesDetours::GetUINT32 @000001A8374F10F0 attribute not found guidKey = {D91B0085-C86D-4F81-8822-8C68E1D7FA04}
    8156,2600 14:17:59.04351 CMFAttributesDetours::GetUINT32 @000001A8374F10F0 attribute not found guidKey = {66B16DA9-ADD4-47E0-A16B-5AF1FB483634}
    8156,2600 14:17:59.04351 CMFAttributesDetours::GetUINT32 @000001A8374F10F0 attribute not found guidKey = {6CE5CB40-ABD3-4A0D-849C-EDF871656C5E}
    8156,2600 14:17:59.04352 CMFAttributesDetours::GetUINT32 @000001A8374F10F0 attribute not found guidKey = {FB683E7E-1CAC-4DBD-9E97-A321EF334D67}
    8156,2600 14:17:59.04352 CMFAttributesDetours::GetBlobSize @000001A8374F10F0 attribute not found guidKey = {1D39518C-E220-4DA8-A07F-BA172552D6B1}
    8156,2600 14:17:59.04353 CMFPlatExportDetours::MFTEnumEx @ Category: MFT\_CATEGORY\_AUDIO\_ENCODER, Flags: 0x00000073, input MT: <NULL>, output MT: MF\_MT\_MAJOR\_TYPE=MEDIATYPE\_Audio;MF\_MT\_SUBTYPE=MFAudioFormat\_AAC
    8156,2600 14:17:59.04354 CMFAttributesDetours::GetUINT32 @000001A8437968B0 attribute not found guidKey = {3C0FBE52-D034-4115-995D-95B356B9855C}
    8156,2600 14:17:59.04356 CMFPlatExportDetours::MFTEnumEx @ Activate 00 @000001A85295DEC0, MFT\_FRIENDLY\_NAME\_Attribute=Microsoft AAC Audio Encoder MFT;MFT\_INPUT\_TYPES\_Attributes=61 75 64 73 00 00 10 00 80 00 00 aa 00 38 9b 71 01 00 00 00 00 00 10 00 80 00 00 aa 00 38 9b 71 ;MFT\_TRANSFORM\_CLSID\_Attribute={93AF0C51-2275-45D2-A35B-F2BA21CAED00};MFT\_OUTPUT\_TYPES\_Attributes=61 75 64 73 00 00 10 00 80 00 00 aa 00 38 9b 71 10 16 00 00 00 00 10 00 80 00 00 aa 00 38 9b 71 ;MF\_TRANSFORM\_FLAGS\_Attribute=1;MF\_TRANSFORM\_CATEGORY\_Attribute=MFT\_CATEGORY\_AUDIO\_ENCODER
    8156,2600 14:17:59.04357 CMFAttributesDetours::GetUnknown @000001A8374F10F0 attribute not found guidKey = {2ACF1917-3743-41DF-A564-E727A80EA33E}
    8156,2600 14:17:59.04377 COle32ExportDetours::CoCreateInstance @ New MFT @000001A814078068, <NULL>
    8156,2600 14:17:59.04377 COle32ExportDetours::CoCreateInstance @ Created {93AF0C51-2275-45D2-A35B-F2BA21CAED00}  (C:WindowsSystem32mfAACEnc.dll) @000001A814078068 - traced interfaces: IMFTransform @000001A814078068, 
    8156,2600 14:17:59.04377 CMFActivateDetours::GetUnknown @000001A85295DEC0 attribute not found guidKey = MFT\_PREFERRED\_ENCODER\_PROFILE
    8156,2600 14:17:59.04377 CMFActivateDetours::GetUnknown @000001A85295DEC0 attribute not found guidKey = MFT\_PREFERRED\_OUTPUTTYPE\_Attribute
    8156,2600 14:17:59.04378 CMFActivateDetours::GetUINT32 @000001A85295DEC0 attribute not found guidKey = MFT\_CODEC\_MERIT\_Attribute
    8156,2600 14:17:59.04378 CMFActivateDetours::ActivateObject @000001A85295DEC0 New MFT @000001A814078068
    8156,2600 14:17:59.04379 CMFAttributesDetours::GetUnknown @000001A8374F10F0 attribute not found guidKey = MF\_SOURCE\_READER\_D3D\_MANAGER
    8156,2600 14:17:59.04379 CMFAttributesDetours::GetUINT32 @000001A8374F0F10 attribute not found guidKey = MF\_SA\_D3D\_AWARE
    8156,2600 14:17:59.04380 CMFAttributesDetours::GetUINT32 @000001A8374F10F0 attribute not found guidKey = {EACF97AD-065C-4408-BEE3-FDCBFD128BE2}
    8156,2600 14:17:59.04380 CMFAttributesDetours::GetUINT32 @000001A8374F10F0 attribute not found guidKey = {7B8F32C3-6D96-4B89-9203-DD38B61414F3}
    8156,2600 14:17:59.04380 CMFAttributesDetours::GetUINT32 @000001A8374F10F0 attribute not found guidKey = {39DBD44D-2E44-4931-A4C8-352D3DC42115}
    8156,2600 14:17:59.04381 CMFAttributesDetours::GetUINT32 @000001A8374F10F0 attribute not found guidKey = {1B320A5D-DEAB-4986-95A3-950E19B82CB0}
    8156,2600 14:17:59.04382 CMFTransformDetours::SetInputType @000001A814078068 Succeeded MT: <NULL>
    8156,2600 14:17:59.04382 CMFTransformDetours::SetOutputType @000001A814078068 Succeeded MT: <NULL>
    8156,2600 14:17:59.04385 CMFTransformDetours::SetInputType @000001A814078068 Succeeded MT: MF\_MT\_AUDIO\_AVG\_BYTES\_PER\_SECOND=176400;MF\_MT\_AVG\_BITRATE=1411200;MF\_MT\_AUDIO\_BLOCK\_ALIGNMENT=4;MF\_MT\_AUDIO\_NUM\_CHANNELS=2;MF\_MT\_COMPRESSED=0;MF\_MT\_MAJOR\_TYPE=MEDIATYPE\_Audio;MF\_MT\_AUDIO\_SAMPLES\_PER\_SECOND=44100;MF\_MT\_AM\_FORMAT\_TYPE=FORMAT\_WaveFormatEx;MF\_MT\_AUDIO\_PREFER\_WAVEFORMATEX=1;MF\_MT\_FIXED\_SIZE\_SAMPLES=1;MF\_MT\_ALL\_SAMPLES\_INDEPENDENT=1;MF\_MT\_AUDIO\_BITS\_PER\_SAMPLE=16;MF\_MT\_SUBTYPE=MFAudioFormat\_PCM
    8156,2600 14:17:59.04388 CMFTransformDetours::SetOutputType @000001A814078068 Succeeded MT: MF\_MT\_AUDIO\_AVG\_BYTES\_PER\_SECOND=16000;MF\_MT\_AVG\_BITRATE=128000;MF\_MT\_AUDIO\_BLOCK\_ALIGNMENT=1;MF\_MT\_AUDIO\_NUM\_CHANNELS=2;MF\_MT\_COMPRESSED=1;MF\_MT\_MAJOR\_TYPE=MEDIATYPE\_Audio;MF\_MT\_AUDIO\_SAMPLES\_PER\_SECOND=44100;MF\_MT\_AM\_FORMAT\_TYPE=FORMAT\_WaveFormatEx;MF\_MT\_AAC\_AUDIO\_PROFILE\_LEVEL\_INDICATION=41;MF\_MT\_AUDIO\_PREFER\_WAVEFORMATEX=1;MF\_MT\_USER\_DATA=00 00 29 00 00 00 00 00 00 00 00 00 12 10 ;MF\_MT\_FIXED\_SIZE\_SAMPLES=0;MF\_MT\_AAC\_PAYLOAD\_TYPE=0;MF\_MT\_AUDIO\_BITS\_PER\_SAMPLE=16;MF\_MT\_SUBTYPE=MFAudioFormat\_AAC
    8156,2600 14:17:59.04388 CMFAttributesDetours::GetUnknown @000001A8374F10F0 attribute not found guidKey = MF\_SOURCE\_READER\_D3D\_MANAGER
    8156,2600 14:17:59.04389 CMFAttributesDetours::GetUINT32 @000001A8374F0F10 attribute not found guidKey = {039C0C90-25A9-4DD3-881D-5C1E1534E48B}
    8156,2600 14:17:59.04390 CMFAttributesDetours::GetString @000001A8374F10F0 attribute not found guidKey = {430847DA-0890-4B0E-938C-054332C547E1}
    8156,2600 14:17:59.04391 CMFAttributesDetours::GetString @000001A8374F10F0 attribute not found guidKey = {39384300-D0EB-40B1-87A0-3318871B5A53}
    8156,2600 14:17:59.04392 CMFSinkWriterDetours::SetInputMediaType @000001A8411B0A50 Stream Index 0x2, MT: MF\_MT\_AUDIO\_NUM\_CHANNELS=2;MF\_MT\_MAJOR\_TYPE=MEDIATYPE\_Audio;MF\_MT\_AUDIO\_SAMPLES\_PER\_SECOND=44100;MF\_MT\_AUDIO\_BITS\_PER\_SAMPLE=16;MF\_MT\_SUBTYPE=MFAudioFormat\_PCM

Bedste reference


Jeg ser dig allerede indstillet MF\_READWRITE\_ENABLE\_HARDWARE\_TRANSFORMS til falsk, som ikke bør være opmærksom på GPU-acceleration.


Hvordan initialiserer du din pOutputAudioMediaType? Indsæt venligst din kode her.


ebugging tips jeg kan dele:

1. Log med mftrace og sammenlign med det gode tilfælde.

2. Åbn dit input i topoedit, se om topologien kan løses korrekt på AMD. Du kan finde topoedit sourcecode fra WindowsSDK eller github arkiv og studere hvordan det er implementeret. [7]


Nedenfor er mit kodestykke for at opsætte outputtyper til AAC, se om det hjælper.


HRESULT UpdateAudioOutputTypeAttributes(IMFAttributes *pAttr)  
{  
    HRESULT hr = S\_OK;  
    if (!pAttr){  
        hr = E\_INVALIDARG;  
    }  
    if (SUCCEEDED(hr)){  
        hr = pAttr->SetGUID(MF\_MT\_MAJOR\_TYPE, MFMediaType\_Audio);  
    }  
    if (SUCCEEDED(hr)){  
        hr = pAttr->SetGUID(MF\_MT\_SUBTYPE, DEFAULT\_AUDIO\_OUT\_FORMAT);  
    }  
    if (SUCCEEDED(hr)){  
        hr = pAttr->SetUINT32(MF\_MT\_COMPRESSED, 1);  
    }  
    if (SUCCEEDED(hr)){  
        hr = pAttr->SetUINT32(MF\_MT\_AVG\_BITRATE, DEFAULT\_AUDIO\_OUT\_AVG\_BITRATE);  
    }  
    if (SUCCEEDED(hr)){  
        hr = pAttr->SetUINT32(MF\_MT\_AUDIO\_BLOCK\_ALIGNMENT, 1);  
    }  
    if (SUCCEEDED(hr)){  
        hr = pAttr->SetUINT32(MF\_MT\_AUDIO\_PREFER\_WAVEFORMATEX, 1);  
    }  
    if (SUCCEEDED(hr)){  
        hr = pAttr->SetGUID(MF\_MT\_AM\_FORMAT\_TYPE, FORMAT\_WaveFormatEx);  
    }  
    if (SUCCEEDED(hr)){  
        hr = pAttr->SetUINT32(MF\_MT\_AAC\_AUDIO\_PROFILE\_LEVEL\_INDICATION, DEFAULT\_AUDIO\_OUT\_PROFILE\_LEVEL);  
    }  
    if (SUCCEEDED(hr)){  
        hr = pAttr->SetUINT32(MF\_MT\_FIXED\_SIZE\_SAMPLES, 0);  
    }  
    if (SUCCEEDED(hr)){  
        hr = pAttr->SetUINT32(MF\_MT\_AAC\_PAYLOAD\_TYPE, 0);  
    }  
    if (SUCCEEDED(hr)){  
        hr = pAttr->SetUINT32(MF\_MT\_AUDIO\_NUM\_CHANNELS, DEFAULT\_AUDIO\_OUT\_NUM\_CHANNELS);  
    }  
    if (SUCCEEDED(hr)){  
        hr = pAttr->SetUINT32(MF\_MT\_AUDIO\_SAMPLES\_PER\_SECOND, DEFAULT\_AUDIO\_OUT\_SAMPLES\_PER\_SECOND);  
    }  
    if (SUCCEEDED(hr)){  
        hr = pAttr->SetUINT32(MF\_MT\_AUDIO\_AVG\_BYTES\_PER\_SECOND, DEFAULT\_AUDIO\_OUT\_AVG\_BYTES\_PER\_SECOND);  
    }  
    if (SUCCEEDED(hr)){  
        hr = pAttr->SetUINT32(MF\_MT\_AUDIO\_BITS\_PER\_SAMPLE, DEFAULT\_AUDIO\_OUT\_BITS\_PER\_SAMPLE);  
    }  
    if (SUCCEEDED(hr)){  
        BYTE aacUserData[14] = { 0x00, 0x00, DEFAULT\_AUDIO\_OUT\_PROFILE\_LEVEL, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };  
        WORD AudioSpecificConfig = 0;  
        AudioSpecificConfig |= 2 << 11;  
        AudioSpecificConfig |= FindFreqIndex(g\_pWaveFmt->nSamplesPerSec) << 7;  
        AudioSpecificConfig |= g\_pWaveFmt->nChannels << 3;  
        aacUserData[12] = AudioSpecificConfig >> 8;  
        aacUserData[13] = AudioSpecificConfig & 0x00FF;  
        hr = pAttr->SetBlob(MF\_MT\_USER\_DATA, (UINT8*)&(aacUserData), ARRAYSIZE(aacUserData));  
    }  
    return hr;  
}

Andre referencer 1


Det viser sig, at Windows10 (1709) nu leveres med MediaFoundation-biblioteker, der har en MediaSink-implementering, der understøtter mere end et lydlag som input/ouput. Alt før denne version gør det ikke (jeg testede Win10 1704 og ældre versioner af Windows10 og de mislykkedes).


Spørgsmålet er nu: Kan jeg bruge disse DLL'er på Windows-versioner lige så gamle som Win7 (via redistributables installer)? Dette er den minimale spec OS, som jeg gerne vil støtte.