这是我的代码:
//打开编码器
//avcodec_find_encoder(AV_CODEC_ID_AAC);
AVCodec *codec = avcodec_find_encoder_by_name(“libfdk_aac”);
//创建 codec 上下文
AVCodecContext *codec_ctx = avcodec_alloc_context3(codec);
codec_ctx->sample_fmt = AV_SAMPLE_FMT_S16; //输入音频的采样大小
codec_ctx->channel_layout = AV_CH_LAYOUT_STEREO; //输入音频的channel layout
codec_ctx->channels = 2; //输入音频 channel 个数
codec_ctx->sample_rate = 44100; //输入音频的采样率
codec_ctx->bit_rate = 32000; //AAC_LC: 128K, AAC HE: 64K, AAC HE V2: 32K
// codec_ctx->profile = FF_PROFILE_AAC_HE_V2; //阅读 ffmpeg
这是支持的编码方式
Supported profiles for codec ‘libfdk_aac’:
Profile: 1 (LC)
Profile: 4 (HE-AAC)
Profile: 28 (HE-AACv2)
Profile: 22 (LD)
Profile: 38 (ELD)
我在编码aac的时候
// codec_ctx->profile = FF_PROFILE_AAC_HE_V2; 我把这行注释掉就是正常的,如果添加了这一行就是杂音,但是隐约能听到一点声音,请问老师这个是什么原因,找了好久没找到原因