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

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 ...

Flushing a water heater.

  I learned from a plumber that I could be flushing my 40 gallon gas water heater in a more effective way.  Here is the process as it was described to me.  Hook up a hose to the water heater and run it to a bath tub or out a window or door to drain. Turn on the valve a little so the water heat starts to flush & check that water is coming out the other end without a problem.  ***NOTE - Don't turn off the water or the gas, or open the air valve. If there is no leaking or drain issue, turn the water all the way on for 5 minutes and let it run.  This can cause a white substance to build up in the drain area.  This is supposedly calcium that has accumulated in the tank. If the calcium/flush substance is no longer coming out, turn off the water valve and disconnect the hose. Leave a note on the water heater or make a record with the date of the flush & schedule another flush in no more than a year. You are done. Another note - We have a water sof...

Dancratic method in a nutshell

With the help of good friends, I've developed an approach to conversation over the last couple of decades.  In this blog I'm trying to forge that approach into a system that I'm calling the Dancratic method. PREMISE : Everything should be able to be questioned.  If it doesn't hold up to scrutiny it should be considered theoretical at best. i.e. You should be able to question 2+2= 5 and adhere to the rules below. Even the most volatile topics can be discussed with civility if  followed properly.   Dancratic method is a specific application of Socratic method.  Instead of a group discussion lead by a teacher or leader, these rules can facilitate 1 on 1 conversation for productive truth seeking.  There is no persuasive element to Dancratic rules.   GOAL : The goal is learning something new.  Perhaps understanding a different perspective a little more.  There is no winning, and no losing unless you break a rule- then everyone loses...