Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 stackoverflow.com Aug 5 '11 at 15:54

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

4 Answers 4

up vote -1 down vote accepted

ffmpeg -i input.mov -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
3  
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

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 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
1  
No, it won't, really. It'll assume a default bitrate or encoding mode. –  slhck Dec 19 '12 at 19:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.