HOWTO: Convert any video format to any video format (snippets)
UPDATED: 2010-4-8 to include rotating video.
I’ve recently started creating some screencasting tutorials with my Linux laptop using recordMyDesktop and find myself having to convert the video to various other formats before I can share it with my Windows colleagues, or upload it to YouTube.
I’ve done some of this before for converting video for use on my BlackBerry over here and converting video for my iPod over here.
Here’s are the snippets all in one place (using mencoder, but you could also use ffmpeg). Hopefully these will be useful to others as well.
Some of the lines below are quite long; make sure you unwrap them all on one line when you run the one you need.
Enjoy!
[rotate avi] – Rotating an AVI formatted video from 16:9 to portrait:
mencoder -vf rotate=1 -o finish.avi -oac copy -ovc lavc start.avi
[ogv2swf] – Ogg Vorbis Video (Theora) to Shockwave Flash:
mencoder start.ogv -ffourcc FLV1 -oac mp3lame -of lavf -ovc lavc \
-lavcopts vcodec=flv:acodec=mp3:vbitrate=500:abitrate=56 \
-srate 22050 -o finish.swf
[avi2swf] – AVI to Shockwave Flash:
mencoder start.avi -ffourcc FLV1 -oac mp3lame -of lavf -ovc lavc \
-lavcopts vcodec=flv:acodec=mp3:vbitrate=500:abitrate=56 \
-srate 22050 -o finish.swf
[ogv2avi] – Ogg Video (Theora) to AVI:
mencoder start.ogv -o finish.avi -oac mp3lame -ovc lavc
[avi2mpg] – AVI to MPEG for DVD quality:
mencoder start.avi -of mpeg -mpegopts format=mpeg1:tsaf:muxrate=2000 \
-o finish.mpg -oac lavc -ovc lavc \
-lavcopts acodec=mp2:abitrate=224:vcodec=mpeg1video:vbitrate=1152:keyint=15:mbd=2:aspect=4/3
[mpg2avi] – MPEG to AVI:
mencoder start.mpg -o finish.avi -ovc copy -oac copy
I’ll try to update this later with the equivalent ffmpeg versions of the same conversions, once I test them all out to make sure they’re providing equal quality.
jeffmonson said on April 4th, 2011 at 1:55 pm quote
Thank you for that! I have been having problems with, what I believe to be, not having the correct codecs to view the footage from our surveillance systems. I will use this to convert the AVI’s.
Many Thanks,
Jeff Monson
Ray said on April 7th, 2011 at 1:38 am quote
Nice write up! I personally use an opensource program called handbrake for Windows and Mac OS X video tools.
Michael said on April 8th, 2011 at 11:27 am quote
This looks like a great list. I had tried Nero some time back but wasn’t impressed with its conversion capabilities.
Mark J. Derulo said on April 18th, 2011 at 4:11 am quote
I only wished I stumbled upon these tips earlier. I had so much problems and tried to resolve it but I couldn’t get it working.
Your tips helped me a lot. – Yes, make sure you unwrap the codes, guys. It’s a common yet overlooked mistake that many make. (including myself, lol)
Much appreciated.
Mark Derulo
Wichita, KS
NewMexicoKid said on January 16th, 2013 at 9:01 am quote
Thanks very much for these tips! Very helpful!
Is there a way with ogv2swf to decrease the size/resolution of the resulting video (say by half or 75%)?