HowTo: Linux Convert .OGV Format To .AVI Video Format

I‘ve download files in ogg formats which is unrestricted by software patents. However, my video editing application is not accepting .ogv video file. How do I convert .ogv to .avi using Linux or Unix bash command line options?

You can use any one of the following command to convert .ogv to .avi video / audio format.

[a] mencoder (MPlayer’s Movie Encoder) is a simple movie encoder, designed to encode MPlayer-playable movies to other MPlayer-playable formats. It encodes to MPEG-4 (DivX/Xvid), one of the libavcodec codecs and PCM/MP3/VBRMP3 audio in 1, 2 or 3 passes. Furthermore it has stream copying abilities, a powerful filter system (crop, expand, flip, postprocess, rotate, scale, noise, RGB/YUV conversion) and more.

[b] FFmpeg – Another video converter command line app for Linux and Unix like operating systems.

Converting .ogv video files to .avi using mencoder command

Type the following command:

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


  1. input.ogv : Your .ogv file.
  2. -ovc lavc : Encode with the libavcodec codec.
  3. -oac mp3lame : Encode with the lamp mp3 audio codec.
  4. -o output.avi : Output file i.e. .avi file.

Verify file type, enter:
$ file my-demo-video.ogv
Sample outputs:

my-demo-video.ogv: Ogg data, Skeleton v3.0

Convert using mencoder, enter:
$ mencoder my-demo-video.ogv -ovc lavc -oac mp3lame -o my-demo-video.avi
Sample outputs:

MPlayer SVN-r31918 (C) 2000-2010 MPlayer Team
success: format: 0  data: 0x0 - 0x3cd7b3
libavformat file format detected.
[ogg @ 0x2b6b100] max_analyze_duration reached
[lavf] stream 1: video (theora), -vid 0
VIDEO:  [theo]  1264x848  0bpp  15.000 fps    0.0 kbps ( 0.0 kbyte/s)
[V] filefmt:44  fourcc:0x6F656874  size:1264x848  fps:15.000  ftime:=0.0667
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [fftheora] vfm: ffmpeg (FFmpeg Theora)
Movie-Aspect is 1.49:1 - prescaling to correct movie aspect.
videocodec: libavcodec (1264x848 fourcc=34504d46 [FMP4])
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:   0.1s      2f (12%)  0.00fps Trem:   0min   0mb  A-V:0.000 [0:0]
[VD_FFMPEG] DRI failure.
Pos:  42.8s    642f (100%) 143.88fps Trem:   0min   2mb  A-V:0.000 [494:0]

Flushing video frames.
Writing index...
Writing header...
ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.

Video stream:  494.277 kbit/s  (61784 B/s)  size: 2644380 bytes  42.800 secs  642 frames

Converting .ogv video files to .avi using ffmpeg command

Type the following command:
$ ffmpeg -i my-demo-video.ogv -vcodec mpeg4 -sameq -acodec libmp3lame my-demo-video.avi
Sample outputs:

FFmpeg version SVN-r0.5.9-4:0.5.9-1, Copyright (c) 2000-2009 Fabrice Bellard, et al.
  configuration: --extra-version=4:0.5.9-1 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libdirac --enable-libgsm --enable-libopenjpeg --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --disable-stripping --disable-vhook --enable-runtime-cpudetect --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libfaad --enable-libdc1394 --enable-shared --disable-static
  libavutil     49.15. 0 / 49.15. 0
  libavcodec    52.20. 1 / 52.20. 1
  libavformat   52.31. 0 / 52.31. 0
  libavdevice   52. 1. 0 / 52. 1. 0
  libavfilter    0. 4. 0 /  0. 4. 0
  libswscale     0. 7. 1 /  0. 7. 1
  libpostproc   51. 2. 0 / 51. 2. 0
  built on Jun 10 2012 08:33:06, gcc: 4.4.5
Input #0, ogg, from 'my-demo-video.ogv':
  Duration: 00:01:01.00, start: 0.000000, bitrate: 522 kb/s
    Stream #0.0: Invalid Codec type -1
    Stream #0.1: Video: theora, yuv420p, 1264x848, PAR 1:1 DAR 79:53, 15 tbr, 15 tbn, 15 tbc
Output #0, avi, to 'my-demo-video.avi':
    Stream #0.0: Video: mpeg4, yuv420p, 1264x848 [PAR 1:1 DAR 79:53], q=2-31, 200 kb/s, 90k tbn, 15 tbc
Stream mapping:
  Stream #0.1 -> #0.0
[mpeg4 @ 0x25ee4c0]removing common factors from framerate
Press [q] to stop encoding
frame=  642 fps=171 q=0.0 Lsize=    2114kB time=60.00 bitrate= 288.6kbits/s    
video:2087kB audio:0kB global headers:0kB muxing overhead 1.294511%

Converting many files

Create a shell script called ovg2avi as follows:

# ovg2avi - Covert ovg to avi
# Author: SXI ADMIN <> Under GPL 2.0+
# -------------------------------------------------------
   echo -e "$@"
   exit 1
[ $# -eq 0 ] && die "Usage: $0 input.ovgntI will convert .ovg file to .avi format."
[ ! -f "$input" ] && die "Error $input file not found."
if [ -f "$output" ] 
	read -p "Warning output file $output exists. Overwrite (y/n)? " ans
	case $ans in 
		y|Y|YES|Yes) 	mencoder "${input}" -ovc lavc -oac mp3lame -o "${output}";;

To covert many files simply use bash for loop as follows:

for o in *.ogv
   /path/to/ovg2avi "$o"

Posted by: SXI ADMIN

The author is the creator of SXI LLC and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post

How to Make Website WCAG Compliant?

Next Post

Link download Kali Linux 2020.1 (ISO + Torrent)

Related Posts