locked
Which audio formats conversions are supported in sinkwriter for windows store apps

    Question

  • Hi,

    I'm trying to encode audio with SinkWriter from PCM -> AAC. But SinkWriter SetInputMediaType returns always MF_E_INVALIDMEDIATYPE. What attributes I need to set in media type?

    ComPtr<IMFMediaType> audioType;
    MFCreateMediaType(&audioType);
    audioType->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Audio);
    audioType->SetGUID(MF_MT_SUBTYPE, MFAudioFormat_PCM);
    audioType->SetUINT32(MF_MT_AUDIO_BITS_PER_SAMPLE, bitsPerSample);
    audioType->SetUINT32(MF_MT_AUDIO_NUM_CHANNELS, channels);
    audioType->SetUINT32(MF_MT_AUDIO_SAMPLES_PER_SECOND, samplesPerSecond);
    audioType->SetUINT32(MF_MT_AUDIO_PREFER_WAVEFORMATEX, TRUE);
    audioType->SetUINT32(MF_MT_AUDIO_BLOCK_ALIGNMENT, blockAlignment);
    audioType->SetUINT32(MF_MT_AUDIO_AVG_BYTES_PER_SECOND, avgBytesPerSecond);
    		
    HRESULT hr = mOutputWriter->SetInputMediaType(mAudioStreamIndex, audioType.Get(), nullptr);


    Thursday, December 13, 2012 2:43 PM

Answers

  • It seems that I had too many channels, AAC encoder supports only 1 and 2 channels. More detailed AAC encoder requirements available in the following link.

    http://msdn.microsoft.com/en-us/library/windows/desktop/dd742785(v=vs.85).aspx

    Friday, December 14, 2012 8:37 AM

All replies

  • It seems that I had too many channels, AAC encoder supports only 1 and 2 channels. More detailed AAC encoder requirements available in the following link.

    http://msdn.microsoft.com/en-us/library/windows/desktop/dd742785(v=vs.85).aspx

    Friday, December 14, 2012 8:37 AM
  • Hello,
     
    Thanks for sharing the solution.
     
    Best regards,
    Jesse

    Jesse Jiang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, December 17, 2012 5:42 AM