[FFmpeg-user] Encode pcm to aac with libavcodec,error occurs!

李敬来 hellolenny at 126.com
Thu Jun 13 09:02:03 CEST 2013


Dear ALL:
    Below is the sample code:
codec = avcodec_find_encoder(CODEC_ID_AAC);
if (codec == NULL) return;
audioCodec = avcodec_alloc_context();
audioCodec->bit_rate = 16000
audioCodec->sample_fmt = SAMPLE_FMT_S16;
audioCodec->sample_rate = 8000
audioCodec->channels = 1
packetSize = avcodec_encode_audio(audioCodec, audio_outbuf, audio_outbuf_size, samples);
the size for pcm data is 320bytes,and the length for output aac is between 319-329?
I think the error is occur,Do you give me any suggestion?
Thanks!


More information about the ffmpeg-user mailing list