[FFmpeg-user] Audio encoding problem

Mustafa Yavuz 89.yavuz at gmail.com
Fri Aug 23 14:20:45 CEST 2013


bit_rate is another problem for me. Is not it sample_rate *
bit_count_per_sample? Why do we need to adjust it in encoder? It also does
not change anything even I comment out that line. For your another replies,
I also thought, I need to resample it before encoding, but now I don't
understand the functionality of sample_rate, channel number parameters in
av_codec_context class, does not it resample it while encoding?


2013/8/23 Nicolas George <nicolas.george at normalesup.org>

> Le sextidi 6 fructidor, an CCXXI, Mustafa Yavuz a écrit :
> > I would like to encode decoded frames in signed 16 bit little endian
> > format.
>
> You forgot to specify: PCM.
>
> > Code is here <http://codepaste.net/rgqpc9>
>
> #    enc_ctx->sample_fmt = AV_SAMPLE_FMT_S16;
> #    enc_ctx->bit_rate = 64000;
> #    enc_ctx->sample_rate    = 11025;
> #    enc_ctx->channel_layout = AV_CH_LAYOUT_MONO ;
> #    enc_ctx->channels       = 1;
>
> You got the wrong idea that this is asking the PCM encoder to encode at a
> specific sample rate and with a specific channel count. It does not work
> that way. You are saying to the encoder what you are giving it as input.
> Since you are actually giving it something completely different, it does
> not
> work at all.
>
> You have to convert and remix the audio stream. For that, you can use
> libswresample directly or libavfilter.
>
> By the way, you will never achieve 64000 bit/s with these settings, your
> bit_rate field is completely wrong.
>
> Regards,
>
> --
>   Nicolas George
>
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
>


More information about the ffmpeg-user mailing list