none
Media Fundation convert AAC to ADTS

    Question

  • I am trying to convert audio stream from AAC to ADTS (Audio Data Transport Stream). This is a necessary step to send HTTP Live Stream to Apple media player. I use the Media Foundation function MFCreateADTSMediaSink, which is supposedly converting AAC stream to ADTS steam. I follow the code in MF wavsink sample, which converts PCM audio to WAV audio, except replacing CreateWavSink(pStream, &pSink) by MFCreateADTSMediaSink(pStream, pAudioType, &pSink). Here pAudioType is a newly created media type and setting MajorType to MFMediaType_Audio, SubType to MFAudioFormat_AAC, and PayloadType to 1. I also set SamplePerSecond to 48000, NumChannels to 1, BitsPerSample to 16, and BlockAlignment to 2 to be consistent with my input file.

    When I select a xx.mp4 file or a xx.aac as input file, the calls in RunMediaSession,

    hr = pSession->GetEvent(0, &pEvent);

    hr = pEvent->GetStatus(&hrStatus);

    return hrStatus with error of -

    “No suitable transform was found to encode or decode the content”.

    And thus the session is terminated and produce no output.

    In the session, every function calls return hr = S_OK, indicating the Media Foundation does not find any invalid call or invalid function argument.

    Because of this failure, I also tried to use MFCreateAC3MediaSink and had the same failure. Actually, these two functionsdo not need encoder or decoder.

    How can I make it work?

    I hope Microsoft engineers can look into this matter. As I said, this function will be very useful if it can work correctly for Internet Video/Audio streaming to Apple iPhone and iPad (which requires Transport Streaming format).

    • Moved by Just KarlModerator Friday, January 20, 2017 7:47 PM Looking for the correct forum.
    Wednesday, December 14, 2016 4:18 AM

Answers

All replies