Skip to main content

Converting mp4 to webm using ffmpeg for HTML5


I had to take a promotional video for work and make it available for a targeted marketing campaign.  The requirement was pretty simple, make it available to any HTML browser.  The challenge was the the original file was only made available as an MP4.  And we have no tools/budget to convert this to the other video formats HTML5 browsers may expect.

What is the right way to convert video to encoding that works well in all HTML5 formats?  That depends, but I'll show you one way that worked for me in this case.

After a little digging, seems it is really easy to get HTML5 video converted from an MP4 source video using FFMpeg from a command prompt in Windows.  I was successful using the examples below on Windows 8.1

For Webm I use the following.
ffmpeg -i SourceVideo.mp4 -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis output.webm

for ogv I use this.
ffmpeg -i SourceVideo.mp4 -codec:v libtheora -qscale:v 7 -codec:a libvorbis -qscale:a 5 output.ogv

In this example, "SourceVideo.mp4" is my original video, and "Output.*" is my new video after conversion.

If you need the ogg file to be named with an ogg extension, just rename it - it will still work.

Comments

Popular posts from this blog

Z-wave Smart Switch options

Here are some of the things I found to consider when looking at purchasing Z-wave Smart Switches. What it ships with : Check what the switch comes with.  Some come with different color face plates, but more importantly, some do NOT come with a bit of wire to connect to your neutral. Protocol : Some are Z-wave, and some are Z-wave Plus.  Z-wave plus seems to mean that the switch is faster, has longer range for connectivity and usually has more features such as central scene control (means you can program double/triple tap behavior. )  Look and feel : Some look like a normal paddle switch, while others have LED lights to tell you their setting level.   Normal looking paddle switch in white with only an on/off indicator LED Paddle switch in light almond with LED dimmer level indicator LEDs Things to note :  Some switches don't support LED lights.  Check the description to avoid these.   Note the supported wattage of the switch - they...

How to install smart switches

I replaced some old dumb light switches with new smart light switches.  Note 1 :Before I go through the steps, here is a little bit of important information to know.  There may be several wires required to make the new switch connect - here is the definition of what you should see available in the housing for the switch. Smart light Switch = In my case, this is a wall light switch that has a radio that can be connected ted to a Hub for remote control or for programming on/off/dimmer based upon triggers. The protocol of the radio is z-wave in my case. Line = always hot wire - this is the source of current to the switch. Load =wire that goes to light out the other side of the switch and is only hot when the switch is turned on. Neutral =  White wire (in my house) that carries a current back to the source for the unbalanced portion of the load Ground wire = the wire that grounds the circuit. Note 2: I've only installed z-wave switches with a neutral ...

Salsa!

Here is THE salsa recipe 1 tomato (medium to large).  cut out stem area. 1 slice of red onion - 1/8" thick 3" circumference  1/2 green onion sliced long way with stem 1/2 lime juice squeezed fresh but not too hard 1/2 Serrano pepper - no seeds 1 Jalapeno - no seeds 1 small clump of cilantro - cut bottom of stems 2 garlic cloves Step 1. Put all in the ninja. Step 2. Add fresh cracked sea salt & pepper to taste Step 3. Yummmmm  :)