Hi every great hackers.
I can mix the audio and the video data that are read from files by using IMFSinkWriter, but I can't find how to mix raw PCM data in memory to the final media file by using IMFSinkWriter.
I suppose that in-memory raw PCM data will be generated by any methods.
I used the setting below for sinkwriter and the target audio format is MP3.
hr = writer->AddStream(mt_aud_in, &speech_stream_ind);
mytrace(L"speech_stream_ind = %d\n", speech_stream_ind);
HRTrace(hr);
hr = MFCreateMediaType(&mt_aud_speech);
HRTrace(hr);
hr = mt_aud_speech->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Audio);
HRTrace(hr);
hr = mt_aud_speech->SetGUID(MF_MT_SUBTYPE, MFAudioFormat_PCM);
HRTrace(hr);
hr = mt_aud_speech->SetUINT32(MF_MT_AUDIO_NUM_CHANNELS, 2);
HRTrace(hr);
hr = mt_aud_speech->SetUINT32(MF_MT_AUDIO_SAMPLES_PER_SECOND, 44100);
HRTrace(hr);
hr = mt_aud_speech->SetUINT32(MF_MT_AUDIO_BITS_PER_SAMPLE, 16);
HRTrace(hr);
hr = writer->SetInputMediaType(speech_stream_ind, mt_aud_speech, NULL);
HRTrace(hr);
Regards,
I solved this problem by setting MF_MT_AUDIO_AVG_BYTES_PER_SECOND attribute.
The resolver that Sink Writer will use needs this attribute.
But MSDN is not saying this important thing.