Media (Intel® oneAPI Video Processing Library, Intel Media SDK)
Access community support with transcoding, decoding, and encoding in applications using media tools like Intel® oneAPI Video Processing Library and Intel® Media SDK

Intel Quick Sync AAC Audio Encoding

Levine__John
Beginner
528 Views

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
528 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

0 Kudos
Levine__John
Beginner
528 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.

0 Kudos
Reply