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"'> </video>
#!/usr/bin/perl
if (@ARGV != 1) {
print "please specify a file\n";
exit;
}
$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";
system($mp4cmd);
}
if (!(lc($ext) eq "ogv")) {
print "$ogvcmd\n";
system($ogvcmd);
}
if (!(lc($ext) eq "webm")) {
print "$webmcmd\n";
system($webmcmd);
}
} else {
print "file $file doesn't exist\n";
}
Downloads:
Download: makewebmovie.sh 824 B
Please login or Click Here to register for downloads
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 www.3daet.com
Permissions beyond the scope of this license may be available at http://www.3daet.com
