Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a mov file with the following media information:

Stream 0
Type: Video
Codec: H264-MPEG-4 AVC (part 10)avc1
Language: English
Resolution: 1280x720
Frame rate: 24

Stream 1
Type: Audio
Codec: MPEG AAC Audio (mp4a)
Language: English
Channels: Stereo
Sample rate: 44100HZ

And I would like to use FFmpeg to convert that MOV file to an AVI file.

I know i can specify audio and video bit rate (from this article):

ffmpeg -i InputFile.mpg -ab 128 -b 1200 OutputFile.avi

But for my case, if I want to keep the original quality, what should be my audio and video bit rate?

share|improve this question

migrated from Aug 5 '11 at 15:54

This question came from our site for professional and enthusiast programmers.

up vote 0 down vote accepted

ffmpeg -i -sameq -aq 1 output.avi

Note: I have found that -aq is ignored if the source audio is mp3, in which case you would just have to use -ab 128k or something similar.

share|improve this answer
The sameq option does not mean same quality and doesn't exist anymore in recent FFmpeg versions. – slhck Dec 19 '12 at 20:02
Help for sameq: use same quantizer as source (implies VBR) – Alex D Dec 30 '13 at 6:45

The other answers are a little outdated. In order to specify the exact bitrate for video and audio, use the -b:v and -b:a options, respectively.

For example:

ffmpeg -i input.mp4 -b:v 1M -b:a 192k output.avi

Note that FFmpeg selects a default video and audio codec for the AVI container, which is the mpeg4 and libmp3lame encoder, respectively, so MPEG-4 Part II video and MP3 audio. You cannot use the original video and audio codecs (H.264 and AAC) here because they're not supported by AVI containers.

Look at the quality: Do you need it better? Then use a higher bitrate. Try and see what works best for you. If you simply use the same bitrate as the input, chances are high the quality will be much worse than the original due to generation loss.

Almost any codec allows you to set a specific bitrate, but many codecs have variable bitrate modes which usually retain quality better. Please read FFmpeg: The ultimate Video and Audio Manipulation Tool for some examples and more links to relevant Super User posts.

share|improve this answer
@Visionscaper That does not make sense. Your option will copy the input audio stream and therefore not perform any encoding. You should receive a warning about that. – slhck Mar 17 '15 at 16:23
hmm, you are right, sorry about that. I misunderstood the option; being in a hurry doesn't pay I guess. I got an error message without this option, so there must be something wrong with my audio codec (settings). – Visionscaper Mar 17 '15 at 18:35
Sure, feel free to post a new question with the full log and I'll have a look at it! – slhck Mar 17 '15 at 19:17
Here you go! – Visionscaper Mar 17 '15 at 19:41

I think something is still missing, I think we need to play with -bufsize also. This is very handy and it is value should be same as -b:v which you give before.

And also if you want to put limit then you need to use -minrate and -maxrate. But do not forget if you set small -b:v and your input still bigger then this, you will live a problem due to ffmpeg can not handle it. Murat

share|improve this answer
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient reputation you will be able to comment on any post. – DavidPostill Nov 17 '14 at 12:00

I think that ffmpeg will generally try to match the bitrates of the input file if you don't specify the exact ones you want.

share|improve this answer
No, it won't, really. It'll assume a default bitrate or encoding mode. – slhck Dec 19 '12 at 19:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .