1 비디오 및 2 오디오 스트림이있는 mp4 파일이 있습니다. Media Foundation을 사용하여 오디오 스트림을 디코딩하려고합니다 (그 중 하나를 선택한 후). 다음은 코드입니다 (MediaFoundation SDK 샘플의 MFAudio 예제에서 가져 왔습니다).Media Foundation 다중 오디오 스트림 파일 디코딩 오류
오류 검사는 간단히하기 위해 생략되었습니다.
는// Set up the source reader for the file.
MFCreateSourceResolver(&pSourceResolver);
pSourceResolver->CreateObjectFromURL(
L"C:\\Users\\vahagng\\Desktop\\a.mp4", // URL of the source.
MF_RESOLUTION_MEDIASOURCE, // Create a source object.
NULL, // Optional property store.
&ObjectType, // Receives the created object type.
&uSource // Receives a pointer to the media source.
);
uSource->QueryInterface(IID_PPV_ARGS(&mediaFileSource));
MFCreateSourceReaderFromMediaSource(mediaFileSource, NULL, &pSourceReader);
// Deselect all streams, we only want the first
pSourceReader->SetStreamSelection(MF_SOURCE_READER_ALL_STREAMS, false);
pSourceReader->SetStreamSelection(MF_SOURCE_READER_FIRST_AUDIO_STREAM, true);
MFCreateMediaType(&pAudioOutType);
pAudioOutType->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Audio);
CHECK_HR(pAudioOutType->SetGUID(MF_MT_SUBTYPE, MFAudioFormat_Float);
pSourceReader->SetCurrentMediaType(MF_SOURCE_READER_FIRST_AUDIO_STREAM, NULL, pAudioOutType);
위의 코드는 2 개 오디오 스트림을 가지고 있지만 1 개 오디오 스트림 파일에 대해 잘 작동 미디어 파일에 대한 오류 코드 0xc00d36b4 : The data specified for the media type is invalid, inconsistent, or not supported by this object.
와 마지막 줄 (pSourceReader-> SetCurrentMediaType())에 실패합니다.
테스트중인 파일에는 MediaFoundation에서 확실히 지원되는 2 개의 AAC 오디오 스트림이 있습니다.
MediaFoundation은 여러 오디오 스트림의 파일을 디코딩 할 수 있습니까?
어떤 오류가 반환됩니까? –
0xc00d36b4 : 미디어 유형에 지정된 데이터가 유효하지 않거나 일관성이 없거나이 개체에서 지원되지 않습니다. – mbaros
MF에서 디코딩 할 수없는 오디오 트랙을 선택 했으므로 오류 코드 (예상대로)가 발생할 수 있습니다. 전체적으로이 동작이 잘못되지 않았거나 잘못된 세부 사항을 게시해야하는 이유 (선택한 오디오 파일 샘플). –