Encode audio to aac with libavcodec

后端 未结 2 419
时光说笑
时光说笑 2020-12-14 11:28

I\'m using libavcodec (latest git as of 3/3/10) to encode raw pcm to aac (libfaac support enabled). I do this by calling avcodec_encode_audio repeatedly with codec_context-

2条回答
  •  心在旅途
    2020-12-14 12:15

    I'm attempting to compress in aac format too an have some other problems in encoding. There are some features in last revision of ffmpeg (2.8.0). In first, did you check if the sample format is supported ? In my version the only supported format is AV_SAMPLE_FMT_FLTP. Format checking is in example:

    /* check that a given sample format is supported by the encoder */ int check_sample_fmt(AVCodec *codec, enum AVSampleFormat sample_fmt) { const enum AVSampleFormat *p = codec->sample_fmts;

    while (*p != AV_SAMPLE_FMT_NONE) {
        if (*p == sample_fmt)
            return 1;
        p++;
    }
    return 0;
    

    }

    If you observe supported formats, only AV_SAMPLE_FMT_FLTP is supported by AAC codec. You should use swresample (as suggested) to convert in planare float format, or you can do it by hand. You should use avcodec_open2 with options strict sperimental in order to open codec. regards

提交回复
热议问题