AAC--ffmpeg解码AAC

本篇FFMEPG实现对AAC解码,解码结果保存wav格式。对AAC编码文件来说,编码根据音频参数编码,解码根据音频参数重新构建声波,

FFMPEG构建的音频存储方式不一定支持播放, 所以需要重采样样本,例如新版ffmpeg解码AAC解码后得到AV_SAMPLE_FMT_FLTP,该格式SDKL播放不支持该格式

ffmpeg所支持的音频格式中:有的仅内部使用,有的可以外部作为音频文件格式

AVFormatContext	* pFormatCtx = avformat_alloc_context();
avformat_open_input(&pFormatCtx,INPUT_FILE_NAME,NULL,NULL)avformat_find_stream_info(pFormatCtx,NULL);
// Dump valid information onto standard error
av_dump_format(pFormatCtx, 0, INPUT_FILE_NAME, false);
 
// Find the first audio stream👉👉int audioStream

p_codec_par = p_fmt_ctx->streams[a_idx]->codecpar;
AVCodec	*pCodec=avcodec_find_decoder(pCodecCtx->codec_id);
AVCodecContext	*p_codec_ctx = avcodec_alloc_context3(p_codec);
avcodec_parameters_to_context(p_codec_ctx, p_codec_par);
// Open codec
avcodec_open2(pCodecCtx, pCodec,NULL);


uint64_t iInputLayout				= av_get_default_channel_layout(pCodecCtx->channels);//使用默认声道分布
int      iInputChans				
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值