Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Levine__John
Beginner
162 Views

Intel Quick Sync AAC Audio Encoding

Hi,

I'm trying to initialize the audio encoder SDK, but I always get the MFX_ERR_INVALID_HANDLE error. Here is my code:

mfxIMPL mfxImpl = MFX_IMPL_HARDWARE;
mfxVersion mfxVersion = {MFX_AUDIO_VERSION_MINOR, MFX_AUDIO_VERSION_MAJOR};
 
MFXAudioSession mfxSession;
 
stStatus = mfxSession.Init(mfxImpl, &mfxVersion);
 
MFXAudioENCODE mfxEncoder(mfxSession);
 
mfxAudioParam mfxParam;
memset(&mfxParam, 0x00, sizeof(mfxAudioParam));
 
mfxParam.mfx.CodecId = MFX_CODEC_AAC;
mfxParam.mfx.CodecProfile = MFX_PROFILE_AAC_MAIN;
mfxParam.mfx.Bitrate = 128000;
mfxParam.mfx.SampleFrequency = 48000;
mfxParam.mfx.NumChannel = 2;
mfxParam.mfx.BitPerSample = 16;
mfxParam.mfx.OutputFormat = MFX_AUDIO_AAC_RAW;
mfxParam.mfx.StereoMode = MFX_AUDIO_AAC_LR_STEREO;
 
stStatus = mfxEncoder.Init(&mfxParam); // stStatus value = MFX_ERR_INVALID_HANDLE
 
mfxEncoder.Close();
mfxSession.Close();
 
BR, John.
0 Kudos
2 Replies
Jiandong_Z_Intel
Employee
162 Views

Hi There,

It looks like you are try MFX_IMPL_HARDWARE, usually HARE accelerate is for Video, for Audio usually use software, I think you may want to try software for audio.

Best Regards,

Zachary

Levine__John
Beginner
162 Views

Hi Zachary,

Thank you for your reply.

I've tried a lot of combinations for mfxImpl, like:

mfxImpl = MFX_IMPL_SOFTWARE

mfxImpl = MFX_IMPL_AUTO

mfxImpl = MFX_IMPL_AUDIO

mfxImpl = MFX_IMPL_SOFTWARE | MFX_IMPL_AUDIO

with the same result. Can you provide me a sample code, or a piece of code, which should work for audio encoding, please? I found a lot of for video encoding, and they work well, but found almost nothing for audio encoding.

 

Best Regards,

John.

Reply