[FFmpeg-user] Audio encoding problem

Nicolas George nicolas.george at normalesup.org
Fri Aug 23 14:01:28 CEST 2013

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.


  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-user/attachments/20130823/b752a75c/attachment.asc>

More information about the ffmpeg-user mailing list