Thursday, December 16, 2010

FFMPEG, Ubuntu and other drugs

First off, Video support for Drupal is a dandy piece of work. They got lots of modules for that. You got:
  1. FlashVideo
  2. Video_Upload
  3. Embed
  4. And of course, Video
Now combine Video with other modules like CCK, Views, etc. You get a Drupal website that can handle Video content very well.

Unfortunately, Video which I use doesn't convert/transcode video automatically without some support.  This is where FFMPEG comes in but FFMPEG comes with a few gotchas and quid pro quo's. The default FFMPEG but  doesn't have a lot of codecs, for example, it doesn't have mp3 support.

And to make thing a bit of a challege is that FFMPEG is not on your default Ubuntu Hardy repos. So, you can't directly do an apt-get install ffmpeg and be done with it. You have to jump a few hoops first.

The first hoop is you have to edit the source.list on the apt-get souce.list.d folder. Its located in /etc/apt/source.list.d. You'll have to use a text editor to edit it; vi for the hackers, nano for novices and sorry no emacs on my Ubuntu. Just uncomment the universe and multiverse repos and then issue an apt-get update after you are done editing the source.list file.

And then the second hoop is a bit more complicated. You'll have to read FakeOutdoorman's guide to installing FFMPEG for the details here. Basically, this is the part you get codecs for FFMPEG so you can transcode a lot more stuff like hi-def videos (H264), mp3 (libmp3lame), theora, etc.

After that and a little bit more tweaking and you'll get something like this:

My setup is using Flowplayer for Drupal. The whole idea is to use CCK with Video to handle the video content and then use FFMPEG to transcode the various video formats (eg. avi, mpeg, wmv, mov, mp4, etc.) to flv. Now combine that with flowplayer to play the transcoded videos and Views + taxonomy to sort and display the video content on the site.

Just remember, Video calls FFMPEG via the command-line. FFMPEG then processes the videos and then Video handles the resulting (now converted/transcoded) video.