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 need a way to batch convert 720p video files from avc1 to xvid in Ubuntu 10.04. I'm not terribly concerned about file size, but I do wish to retain the picture quality as much as possible. I believe the audio is encoded as aac, which is fine for my purposes.

What would be the best and easiest way to do this? I've tried using Handbrake. During my first attempt, I had it using ffmpeg to convert to MPEG-4, but that just gave me a super-low quality video at twice the file size. Trying h.264 now, so we'll see how that works out. But just in case it doesn't pan out so well, what other ways do you recommend?

I was thinking I'd write a bash script to reencode the files one by one, but the problem is that I have very little knowledge about codecs and containers and whatnot - so I wouldn't know what parameters I would pass ffmpeg/mencoder.

share|improve this question
mencoder -vf harddup,crop=0:0:0:0,scale=576:-2,hqdn3d -sws 2 -sid 1001 -o $output -ovc xvid -xvidencopts bitrate=598:pass=1:max_bframes=2:bquant_ratio=162:bquant_offset=100:vhq=4:me_quality=6:chroma_me:chroma_opt:hq_ac:trellis:lumi_mask:autoaspect:bvhq=1:threads=2 -af volnorm=1 -oac copy $input

mencoder -vf harddup,crop=0:0:0:0,scale=576:-2,hqdn3d -sws 2 -sid 1001 -o $output -ovc xvid -xvidencopts bitrate=598:pass=2:max_bframes=2:bquant_ratio=162:bquant_offset=100:vhq=4:me_quality=6:chroma_me:chroma_opt:hq_ac:trellis:lumi_mask:autoaspect:bvhq=1:threads=2 -af volnorm=1 -oac copy $input

I have written the above script to convert some videos (20minute x264 video in mkv container to 2-pass xvid in avi) using mencoder. You could give it a shot on a file. Quite honestly, I don't remember where I got the encoding options from (official mencoder documentation maybe?) but they worked fine on my videos which is why I still have the script.

I recommend using a bitrate calculator and modify the bitrate value above, otherwise the conversion may be long, and more importantly the result won't be anywhere near what you're expecting.

By the way, you said you were trying h.264 now - you do know it is quite different from xvid ? Considering two videos the same size, the h.264 one will have higher quality than the xvid one, although the latter needs a less powerful computer to be decoded without stuttering, frame drops etc.

EDIT: Link to mencoder documentation on xvid encoding :clickme!

share|improve this answer

You must log in to answer this question.

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