mp4 to ogv

How to use FFMPEG to convert mp4 to ogv

How to use FFMPEG to convert mp4 to ogv

Date Created:Tuesday November 30th, 2010 05:50 PM
Date Modified:Tuesday November 30th, 2010 06:39 PM

Here is the ffmpeg command:

ffmpeg -i searchBar.mp4 -acodec vorbis -vcodec libtheora searchBar.ogv

Below is some code to convert to HTML5 compliant videos!

The script converts the input file to mp4, ogv, and webm. To include videos on a web page, simply use
<video width="320" height="240" controls>
<source src="videos/searchBar.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'> 
<source src="videos/searchBar.webm" type='video/webm; codecs="vp8, vorbis"'>
<source src="videos/searchBar.ogv" type='video/ogg; codecs="theora, vorbis"'>



if (@ARGV != 1) {
    print "please specify a file\n";

$file = pop @ARGV;

if (-e $file) {

    $_ = $file;
    ($name, $ext) = (/^(.*?)\.?([^\.]*)$/);
    if ($name eq '') {
        $ext = '';
    $out = $name;

    $ogvcmd = "ffmpeg -i $file -acodec libvorbis -vcodec libtheora $out.ogv";
    $webmcmd = "ffmpeg -i $file -acodec libvorbis $out.webm";
    $mp4cmd = "ffmpeg -i $file -acodec libfaac -ab 96k -vcodec libx264 -threads 0 $out.mp4";

    if (!(lc($ext) eq "mp4")) {
        print "$mp4cmd\n";

    if (!(lc($ext) eq "ogv")) {
        print "$ogvcmd\n";

    if (!(lc($ext) eq "webm")) {
        print "$webmcmd\n";

} else {

    print "file $file doesn't exist\n";



Download: 824 B

Please login or Click Here to register for downloads
Creative Commons License
mp4 to ogv by Dan Lynch
is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
Based on a work at
Permissions beyond the scope of this license may be available at