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
Where,
- input.ogv : Your .ogv file.
- -ovc lavc : Encode with the libavcodec codec.
- -oac mp3lame : Encode with the lamp mp3 audio codec.
- -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:
#!/bin/bash # ovg2avi - Covert ovg to avi # Author: Vivek Gite <www.cyberciti.biz> Under GPL 2.0+ # ------------------------------------------------------- input="$1" output="${input%%.ogv}.avi}" die(){ echo -e "$@" exit 1 } [ $# -eq 0 ] && die "Usage: $0 input.ovg\n\tI will convert .ovg file to .avi format." [ ! -f "$input" ] && die "Error $input file not found." if [ -f "$output" ] then 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}";; esac fi
To covert many files simply use bash for loop as follows:
for o in *.ogv do /path/to/ovg2avi "$o" done
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop






![Linux: Convert .AVI File To Apple iPod / iPhone MP4 [M4V] Format](http://s13.cyberciti.org/images/shared/rp/3/14.jpg)






{ 4 comments… read them below or add one }
thanks man. I was dying to know this. thank you.
Hello, i tried to use mencoder but i have the error: Cannot set LAME options, check bitrate/samplerate, some very low bitrates
(<32) need lower samplerates (i.e. -srate 8000).
If everything else fails, try a preset.
Exiting…
what is the problem what is wrong
I using for capture recordmydesctop
Thanks a lot!!
Cannot set LAME options, check bitrate/samplerate, some very low bitrates
(<32) need lower samplerates (i.e. -srate 8000).
If everything else fails, try a preset.
Exiting…
Hello i have this error when i using mencoder what s wrong
I using recormydesctop to capture video
Works in theory not in practice. Any real life example will produce Too many audio packets in the buffer.
Maybe it will work on MS Windows. In any case it might be advise to stay away from ogv. Support leaves a lot to be desired.