Pages

5/29/2011

Convert OGV file to AVI (XVID+MP3)

As I have been in Linux for quite awhile, sometimes I need to record a video of my screen to show other people how to do some stuffs. The tool that has been recommended from others is "gtk-recordmydesktop".
It is a graphic user interface(GUI) of "recordmydesktop" using GTK. This tool is easy to use and it works perfectly fine.... until I found out later after I uploaded a video to both Youtube & Facebook, it produces errors (sound does not sync, video jittering, rendering error).  In conclusion,  .ogv file does not work with Youtube and Facebook.

I actually have tried several video encoding software (WinFF/ffmpeg, DeVeDe , Avidemux) but not one of them suits my need. Here is the why:

  • ffmpeg : Command line style, rich of options, but it's hard to get the right command
  • WinFF : a GUI software that run ffmpeg in background. Come with many profiles of devices for the video to convert to. Although, there's no profile to keep the original settings, and as same as ffmpeg, it still needs some parameters as well. It is hard to get it right
  • DeVeDe : I forgot its name. This tool works as a video encoder for making a VCD,DVD disc. That's why it resizes the video frame.
  • Avidemux: I already posted a blog on how to use Avidemux to convert .3gp to .mp4. However, Avidemux cannot open .OGV file type. This is sad.
Today I just found this site. A simple command "mencoder" do the work easily and very simple.
The main command is 

mencoder file.ogv -ovc xvid -oac mp3lame -xvidencopts pass=1 -o file.avi


Each parameter is :
    "-ovc  xvid" : output video codec == XVID
    "-oac  mp3lame" : output audio codec == MP3 (using Lame library)
    "-xvidencops pass=1"  :  run encoding one round
    "-o  file.avi" : output to a file named "file.avi"
I don't need to specify bitrate, nor output screen size/framerate/audio quality. Everything will be as same as the original. This is what I want.

To make it simpler, I also tweak it into a bash script name "ogv2avi"

#!/bin/bash
if [ $# -lt 2 ]
then
echo "Ogv2Avi for converting Ogv format to Avi format (Xvid+MP3)"
echo "Script by Anidear"
echo "Usage : ogv2avi filename.ogv filename.avi"
else
mencoder "$1" -ovc xvid -oac mp3lame -xvidencopts pass=1 -o "$2"
fi


To use it. write this code into a text file, rename the file to "ogv2avi", then put it into either "/bin" or "/usr/bin".

No comments:

Post a Comment