HOWTO: Convert any video format to any video format (snippets)

Tuesday, March 16th, 2010 at 9:25 pm | 7,561 views | trackback url

digital video cameraUPDATED: 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.

Last Modified: Sunday, March 6th, 2016 @ 03:29

5 Responses to “HOWTO: Convert any video format to any video format (snippets)”

  1. 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

  2. Nice write up! I personally use an opensource program called handbrake for Windows and Mac OS X video tools.

  3. This looks like a great list. I had tried Nero some time back but wasn’t impressed with its conversion capabilities.

  4. Mark J. Derulo said on

    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

  5. 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%)?


Leave a Reply

You must be logged in to post a comment.

Bad Behavior has blocked 347 access attempts in the last 7 days.