Convert ogv to avi with mencoder in Linux

If you were using recordMyDesktop or any similar screen recording software under Linux, you probably ended up with a video in ogv format.

What is OGV?

Ogv (Ogg) is a video container format developed by the Xiph Foundation. The Ogg container format can multiplex a number of independent streams for video, audio, text and metadata.

How can i convert ogv to avi?

For this purpose you can use a command line tool called mencoder. mencoder or MPlayer Movie Encoder is designed to encode movies to other formats. Also it has a filter system such as flip, crop, rotate, noise, expand, rotate, scale etc.

You can install mencoder with this simple linux command

# apt-get install mencoder

To convert a video in ogv format to avi you can use the following command

# mencoder input.ogv -ovc lavc -oac mp3lame -o output.avi

Lets break down the command:

-input.ogv is the ogv file you want to convert
-ovc option is used for specifying the video codec type
-lavc or libavcodec is the type of the video codec
-oac option is used for specifying the audio codec type
-mp3lame or libmp3lame is the type of the audio codec
-o option is used for specifying the output filename
-output.avi is the filename of the converted avi file  

you can use mencoder -ovc help to get the list of available video codecs

   copy     - frame copy, without re-encoding. Doesn't work with filters.
   frameno  - special audio-only file for 3-pass encoding, see DOCS.
   raw      - uncompressed video. Use fourcc option to set format explicitly.
   nuv      - nuppel video
   lavc     - libavcodec codecs - best quality!
   xvid     - XviD encoding
   x264     - H.264 encoding

or mencoder -oac help to get the list of available audio codecs

   copy     - frame copy, without re-encoding (useful for AC3)
   pcm      - uncompressed PCM audio
   mp3lame  - cbr/abr/vbr MP3 using libmp3lame
   lavc     - FFmpeg audio encoder (MP2, AC3, ...)

Here is a sample output:

Opening video decoder: [theora] Theora/VP3
VDec: vo config request - 1280 x 1024 (preferred colorspace: Planar YV12)
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is 1.25:1 - prescaling to correct movie aspect.
videocodec: libavcodec (1280x1024 fourcc=34504d46 [FMP4])
Selected video codec: [theora] vfm: theora (Theora (free, reworked VP3))
==========================================================================
MP3 audio selected.
Writing header...
ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.
Writing header...
ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.
Pos:   1.5s     22f (93%)  0.00fps Trem:   0min   0mb  A-V:0.140 [996:7]]
Skipping frame!
Pos:   2.1s     32f (93%)  0.00fps Trem:   0min   0mb  A-V:0.140 [740:7]
Skipping frame!
Pos:   2.7s     42f (93%)  0.00fps Trem:   0min   0mb  A-V:0.140 [596:7]
Skipping frame!
Pos:   3.3s     52f (93%) 49.29fps Trem:   0min   0mb  A-V:0.140 [507:7]
Skipping frame!
Pos:   3.9s     62f (93%) 50.08fps Trem:   0min   0mb  A-V:0.140 [454:7]
Skipping frame!
Pos:   4.5s     72f (99%) 50.67fps Trem:   0min   0mb  A-V:0.140 [411:7]
Skipping frame!
Pos:   5.3s     86f (99%) 51.74fps Trem:   0min   0mb  A-V:0.120 [406:7]
Flushing video frames.
Writing index...
Writing header...
ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.
Video stream:  406.384 kbit/s  (50798 B/s)  size: 270923 bytes  5.333 secs  86 frames
Audio stream:    7.963 kbit/s  (995 B/s)  size: 4706 bytes  4.728 secs

If your video doesnt contain audio you dont need to pass the -oac param

# mencoder input.ogv -ovc lavc -o output.avi
- Posted by Eva to Linux