分享

How to encode audio in AAC

 oskycar 2014-12-11

first of all you have a look at this document:

Dolby Digital: ac3

Dolby Digital Plus: eac3

MP2: libtwolame, mp2

Windows Media Audio 1: wmav1

Windows Media Audio 2: wmav2

LC-AAC: libfdk_aac, libfaac, aac, libvo_aacenc

HE-AAC: libfdk_aac, libaacplus

Vorbis: libvorbis, vorbis

MP3: libmp3lame, libshine

Opus: libopus

from the above reading it will be clear to you that in order to encode audio in HE-AAC/ HE-AAC-V2 you have to use libfdk_aac or libaacplus.

I will explain how you can do it using libfdk_aac:

first make sure you configure ffmpeg along with following options:

--enable-libfdk_aac --enable-nonfree

now build ffmpeg and try to run the following command and see if it works:

$ ffmpeg -i -vcodec copy -acodec libfdk_aac -profile:a aac_he

if this works it means libav is linked with libfdk_aac.

now in order to use it in the code:

open the encoder using the following instructions:

AVCodecContext *encoder_ctx;
encoder_ctx->codec_id           =   AV_CODEC_ID_AAC;
encoder_ctx->sample_fmt         =   AV_SAMPLE_FMT_S16; 
encoder_ctx->profile            =   FF_PROFILE_AAC_HE;

encoder = avcodec_find_encoder_by_name("libfdk_aac");
// if you still try to open it using avcodec_find_encoder it will open libfaac only.
avcodec_open2(encoder_ctx, encoder, NULL);

Here we go, you have libfdk_aac encoder open ! The profiles which you can use are as given in this source

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多