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'm trying to use ffmpeg to convert video to DivX. Here is my current command line:

-vtag DIVX -f avi -vcodec msmpeg4 -s 640x480 -b 345k -acodec libmp3lame -ab 256 -ac 2 -ar 48000

The problem with this is that I am getting a low quality DivX file when I want a high quality file. Can anyone point me to a better command for higher quality that would be helpful and is msmpeg4 the latest DivX codec?

share|improve this question

migrated from serverfault.com Jul 12 '11 at 20:08

This question came from our site for system and network administrators.

3 Answers 3

Either use a higher bit rate and/or use two-pass encoding, or use -qscale to target a quality level in a variable bit rate mode, rather than a specific bit rate. See this blog post for slightly more in-depth information.

Qscale

The qscale range for mpeg4 is 1–31, where lower=better quality/higher filesize, and 3–6 can normally be considered a useful range. This will target a given quality, with a variable bit rate. You can similarly use qscale with libmp3lame, where the range is 0–9, with lower numbers giving better quality. See here for a bit more information; anything up to 6 will get you good quality.

Up-to-date syntax:

ffmpeg -i input.file -c:v mpeg4 -q:v 5 -tag:v DIVX -s 640x480 -c:a libmp3lame -q:a 5 -ac 2 -ar 44100 output.avi

Old syntax:

ffmpeg -i input.file -vcodec mpeg4 -qscale 5 -vtag DIVX -s 640x480 -acodec libmp3lame -aq 5 -ac 2 -ar 44100 output.avi

Two-pass encoding

Note that Windows users need to use NUL rather than /dev/null. Use this if you want to target a specific size, otherwise just use the VBR quality-targeting -qscale option. These examples will fit a 90-minute movie onto a 700 MB CD-ROM.

Up-to-date syntax:

ffmpeg -y -i input.file -c:v mpeg4 -b:v 868k -tag:v DIVX -s 640x480 -an -pass 1 -f rawvideo /dev/null
ffmpeg -i input.file -c:v mpeg4 -b:v 868k -tag:v DIVX -s 640x480 -c:a libmp3lame -b:a 192k -ac 2 -ar 44100 -pass 2 output.avi

Old syntax:

ffmpeg -y -i input.file -vcodec mpeg4 -b 868k -vtag DIVX -s 640x480 -an -pass 1 -f rawvideo /dev/null
ffmpeg -i input.file -vcodec mpeg4 -b 868k -vtag DIVX -s 640x480 -acodec libmp3lame -ab 192k -ac 2 -ar 44100 -pass 2 output.avi

Note that you don't strictly need -ac 2, since MP3 only supports two channels, so any surround-sound audio will automatically get mixed down.

You should consider using H.264 video/AAC audio in an MP4 container; the only reason to use DivX/MP3 in an AVI is if you need support on legacy hardware players. Using DivX results in worse quality compared to H.264-encoded video at the same bit rate.

share|improve this answer

Try this:

-vtag DIVX -f avi -vcodec mpeg4 -mbd 1 -bf 2 -s 640x480 -b 900k -acodec libmp3lame -ab 192 -ac 2 -ar 44100
share|improve this answer
3  
Can you explain what the difference is or why this would work? –  slhck Feb 20 '13 at 10:25
    
please explain your answer –  Shurmajee Feb 20 '13 at 10:26

You can try to specify a bigger value for the option -b 345k. This determine the bit rate of the output video. Maybe, you can try to change -r fps if needed.

You have to be careful when changing these value. Not all values are accepted for all codecs. Look at the help/manual of ffmpeg for more information.

share|improve this answer
    
thanks mate, changing the bitrate helped. –  John Tom Jul 12 '11 at 19:23

Your Answer

 
discard

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