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 got the following code from some forum. I'm a beiginner, so please bear with my questions ...

I need to convert a video from MTS to AVI in very good quality. Currently I'm using the following code for conversion.

for %%a in ("*.mts") do ffmpeg.exe -i "%%a" -vcodec libxvid -vtag XVID -aspect 16:9 -maxrate 1800k -b 1500k -qmin 10 -qmax 42 -bufsize 5120  -acodec libmp3lame -ac 2 -ab 160k -y "%%~na_xvid.avi" 
for %%a in ("*.m2ts") do ffmpeg.exe -i "%%a" -vcodec libxvid -vtag XVID -aspect 16:9 -maxrate 1800k -b 1500k -qmin 10 -qmax 42 -bufsize 5120 -acodec libmp3lame -ac 2 -ab 160k -y "%%~na_xvid.avi" 

But I'm expecting better quality than the above. How do I get that?

share|improve this question

migrated from Jun 19 '12 at 3:18

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

Can you quantify what you would regard as acceptable? How good is the input quality? What have you tried? Have you tried tweaking the quality-related options? – tripleee Jun 18 '12 at 9:09
Isn't the core issue here that you are using xvid? H.264 is widely used for compressing high quality HD video, but at SD resolutions compresses more than xvid for the same video quality. – Chris Becke Jun 18 '12 at 10:00
@ tripleee : I took Videos in Sony Digicam with HD quality and its in MTS.. I wanna Convert to AVI and want see the vidoes frame by frame.. So for that I need a HD Quality Ouput in AVI Format – Mohan Kumar Jun 18 '12 at 10:25
@ Chris Becke : Thanks Dude., But I'm New to this.. My requirement is, I need to convert HD Quality MTS file to HD Quality AVI, using FFMPEG... Can you guys provide me the coding to do this?? Thanks in Advance – Mohan Kumar Jun 18 '12 at 10:31

This will probably give you what you think you want:

ffmpeg.exe -i input -c:v libxvid -qscale:v 2 -c:a libmp3lame -ac 2 -q:a 4 output.avi

Adjust -qscale:v for video quality and -q:a (similar to lame -V) for audio quality.

A lower value is a higher quality for both options. You may not be able to tell the difference between the input and output with -qscale:v 2.

share|improve this answer
Note that you should only use this if you need to use an old hardware player that can't handle h.264 video+AAC audio in an MP4. – evilsoup Jan 15 '13 at 17:50

You must log in to answer this question.