Linux Video Conversion

Linux Video Conversion

Posted:  January 1, 2013

Linux Video Conversion

I have recently made the transition from Windows to the latest Ubuntu distro. After being a long time Micro$oft user/abuser I figured it was time 🙂

As a result I am finding that things are much different now that I am on this platform and recently came up against converting a *.mp4 video to multiple other formats for use in embedding it in a web page.

As a result, I wanted to make sure that I got these out here for all to use in case they ever need an easy place to find it. (actually, it’s just so I can remember what to do LOL)

So, in order to get a video to play across most browsers you need to first convert the movies into the following formats:

  1. MP4
  2. OGV
  3. WEBM
  4. SWF

To do so in Linux (more over Ubuntu) run the following commands in Shell…  just make sure to add in the path to the original file and output files…  oh yeah, also make sure you have the following installed:  ffmpeg and ffmpeg2theora

apt-get update && apt-get install ffmpeg && apt-get install ffmpeg2theora

Here are the commands for each:

MP4 to SWF

ffmped2theora -o MOVIE.swf MOVIE.mp4


ffmpeg -i MOVIE.mp4 MOVIE.webm

 MP4 to OGG

ffmpeg2theora -o MOVIE.ogv MOVIE.mp4

And here is the proper embed code (obviously change the height/width and add some style as you see fit):

<video width="280" height="189" controls autoplay>
  <source src="MOVIE.mp4" type="video/mp4" />
  <source src="MOVIE.ogg" type="video/ogg" />
  <source src="MOVIE.webm" type="video/webm" />
  <object data="MOVIE.mp4" width="280" height="189">
    <embed src="MOVIE" width="280" height="189" />

Kevin Pirnie

20+ Years of PC and server maintenance & over 15+ years of web development/design experience; you can rest assured that I take every measure possible to ensure your computers are running to their peak potentials. I treat them as if they were mine, and I am quite a stickler about keeping my machines up to date and optimized to run as well as they can.