Monday, October 24, 2011

Download Youtube clip, Convert to MP4 and OGG for HTML 5 video tag

I am working with Mac. One of my tasks was ... "36613, put this youtube video on our website !! using latest fancy portable HTML 5 !!"


"Yes. My Lord! " ... HTML 5 is not really being supported by all latest browser yet. and some of them only support some particular encoding schemes. So, what I had to do for this task was ...

  1. Download the video from youtube
  2. Convert the video to .mp4
  3. Convert the video to .ogg
  4. Write little HTML(5) code

I am going to talk about the freeware converters I used on Mac only. They are all real free, no watermark, no limited functions, no trial expiry date.

If you want to write a video tag that support all browsers, visit the following post: http://henriksjokvist.net/archive/2009/2/using-the-html5-video-tag-with-a-flash-fallback. It talked about including .mp4, .ogg and also .flv in order to support all browsers.



1. Download the .flv video from youtube

"Firefox" and Firefox Add-on "Ant Video Downloader": https://addons.mozilla.org/en-US/firefox/addon/video-downloader-player/

Usage:
  1. Use Firefox, go to the youtube video page you want to download.
  2. click the Ant video button next to the address bar.
  3. select the video name in the dropdown list.


2. Convert the .flv to .mp4

MPEG Streamclip: http://www.squared5.com/

Usage:
  1. Open the downloaded .flv file using MPEG Streamclip
  2. Choose Export to MPEG-4 in the menu
  3. Select the resolutions you want (usually defaults are alright).


3. Convert the .flv to .ogg

ffmpeg2theora: http://v2v.cc/~j/ffmpeg2theora

Usage:
  1. run the following command to convert the .flv file:
  2. ffmpeg2theora DownloadedYoutubeVideo.flv