[FFmpeg-user] How to call ffmpeg code without quality loss for video conversion?

Moritz Barsnick barsnick at gmx.net
Mon May 9 14:41:14 CEST 2016

On Mon, May 09, 2016 at 20:11:09 +0800, seaguest wrote:
> My first question is how are the bitrates of audio/video determined in 
> case they are not specified in command line?

I think it's documented, but I'll just try to summarize:
- audio bitrate ("-b:a", formerly "-ab") defaults to 128k
- libx264 defaults to variable bitrate with a constant rate factor
  ("-crf") of 23, and using the "medium" preset ("-preset").

> Second question, In the way of calling ffmpeg code, how should I set the 
> AVCodecContext properly to make sure that I have same setting as above 
> command line?

Questions regarding the use of ffmpeg's libraries belong on the
libav-user list. But that's just my way of saying "I have no idea", but
perhaps someone else on this list can help anyway.

> Because I am having an audio quality loss problem when I call the ffmpeg 
> library, whilst the command line works fine.

That always depends on your inputs of course. But if that is the case,
the best way is usually to increase the bitrate, as you probably
figured. The actual bitrate used could be seen in your ffprobe and in
your conversion commands.


More information about the ffmpeg-user mailing list