Home > firefox > convert mp4 to webm and ogv

convert mp4 to webm and ogv

Problem
I wanted to share an .mp4 file on my webserver but Firefox didn’t play it. It turned out Firefox prefers the .webm and .ogv formats, while Chrome can play .mp4.

Solution

Convert mp4 then:

.mp4 to .webm

ffmpeg -i input.mp4 -vcodec libvpx -acodec libvorbis -b:v 600k -cpu-used 4 -threads 8 output.webm

To change the quality, play with the “600k” value (bitrate).

.mp4 to .ogv

ffmpeg -i final.mp4 -vcodec libtheora -acodec libvorbis -b:v 600k -cpu-used 4 -threads 8 final.ogv

Here the difference is the codec (libtheora instead of libvpx).

Maybe I missed something, but the .webm file seemed to me to have better quality than .ogv. So I think it’s enough to support two formats only: .mp4 for Chrome and .webm for Firefox. By the way, in my test the input file (.mp4) had the best quality and smallest filesize, but again, I may miss something.

And here is an HTML5 code that can play your video:

<video controls preload="metadata" width="1024" height="768" poster="images/front.jpg">
    <source src="video.mp4" type="video/mp4">
    <source src="video.webm" type="video/webm">
    <p>Please use a modern browser to view this video.</p>
</video>
Categories: firefox Tags: , , , , , ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: