Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FFMPEG ignores bitrate

Tags:

ffmpeg

bitrate

I am new to video encoding so bear with me.

I am using FFMPEG. I have an mp4 file which is 640 x 350 with an average bitrate of around 2000kb (I think) and a filesize of 80Mb. I want to convert this to an ogv file with a much lower bit rate (128kb) but the same width and height. I am using the following command...

ffmpeg -i input.mp4 -b:v 128k output.ogv

... but FFMPEG seems to ignore my bitrate option and outputs a file with a bitrate of around 600kb and a filesize of around 3Mb.

I can do this using FFMPEG2THEORA using the following command ...

ffmpeg2theora -V 128 input.mp4 -o output.ogv

...but I was wondering if it was possible using FFMPEG.

Any ideas?

Edit

mark4o solved my problem. It turns out that the default audio codec was bumping up the filesize. Changing it to libvorbis has reduced the filesize dramatically. Final command looks like

ffmpeg -i input.mp4 -b:v 128k -b:a 128k -codec:a libvorbis output128.ogv
  • -i = input file
  • -b:v = the bitrate of the video stream
  • -b:a = the bitrate of the audio stream
  • -codec:a = override the default audio codec
like image 585
Kevin Brydon Avatar asked May 15 '12 15:05

Kevin Brydon


1 Answers

-b:v only affects the video bitrate. For some reason ffmpeg defaults to using the flac audio codec for .ogv output (at least in some versions). In this case the flac audio will be even larger than your video.

Assuming you wanted vorbis audio, use the option -codec:a libvorbis (or -acodec libvorbis in some versions) before the output file name to specify this. You may also want to specify a bitrate for the audio, e.g. -b:a 32k (or -ba 32k). If you want the total bitrate to be 128kbps, specify audio and video bitrates that add up to a total of 128k (or a little less if you want to compensate for the ogg container overhead).

like image 133
mark4o Avatar answered Sep 19 '22 20:09

mark4o