Playing with Drupal Themes and Video

I’ve been using Drupal since 2002 and building my own sites in Drupal since 2003. I find it a great environment to work in. Over the past few weeks I’ve spoken at a couple different Drupal gatherings in Connecticut, and this is a followup to some of those discussions. Earlier this month I spoke at the Connecticut Drupal Group. Mostly, I spoke about some of the history of Drupal, especially as it related to Ecademy, DeanSpace, and CivicSpace. It provided a good opportunity to talk about various aspects such as multisite configurations.

Later, I spoke at the Southern Connecticut Open Source Users Group about Drupal. It was a well attended group that I adjusted to the level of the participants, who were mostly well versed in computers but had not done much with Drupal.

Since then, I’ve had a few frustrating Drupal projects cancelled, but I’ve done some interesting things.

Drupal Themes

I did not speak a lot about Drupal Theming at either gathering, but it is a topic a lot of people are very interested in. Theming has never been a big focus of mine. In most cases, there is some theme that is close enough and I just run with that, with perhaps a little tweak here or there. People have always said that the best theme to use as a starting point for a customized theme is Zen. It seems like a great starting point. However, there is another theme, Basic, which is a stripped down version of Zen. It seems to work really nicely.

One of the things that I’ve appreciated about the evolution of themes in Drupal is that there are now lots of different regions that you can use on a Drupal site. It used to be that you had the left column and the right column as location where you can place blocks. The Zen theme has eight different regions that you can use, and you could easily add more if you needed them.

Video

One project I ran into wanted to video. Specifically, they wanted to upload a video in one format, and have the Drupal site transcode the video for easy streaming. The video module does a nice job of this, but there are a bunch of things you need to deal with to get this working nicely. Video depends on the Content module from the Content Creation Kit, and if you want to upload videos, you want to turn on the Video Upload module which depends on the FileField module. Then, to play the videos, you need the SWF Tools.

Videos are typically fairly large, so you may want to tweak some of the settings of your site. For example, I tweaked the post_max_size line in my php.ini file to be 50M. It seems like people often have problems finding the php.ini file. For my Ubuntu server running Apache, it is /etc/php5/apache2/php.ini

I also had to go to admin, settings, uploads and change the default maximum file size for upload. While I was there, I added “mov” to the list of files that could be uploaded because I wanted to include quicktime movies for transcoding.

You also need to change the allowed extensions in the video content type. To do this, go to content type, Video, Manage Fields, and click on configure next to the video filed. Add mov to the list of permitted extensions.

Another thing you may want to do, but that is not required is to add the uploadprogress PECL extension. In my case, I did not have PEAR installed, so I needed to do that first with the command “apt-get install php-pear”. Then, I instead uploadprogress using the command “pecl install uploadprogress”. You will need to do all of this with the sudo command or some other way of gaining root access.

The uploadprogress extension did not manage to add “extension=uploadprogress.so” automatically to the php.ini file, so I had to do this myself.

However, the bigger issue that I ran into was getting the transcoding to properly transcode the audio as well as the video. There were several things that I needed to do. First, I needed to get the mp3lame library. In the Ubuntu ffmpeg page, there is information about installing liblame-dev or libmp3lam-dev depending on the version of Ubuntu you are running. It is worth noting that you need to have the multiverse repository available to download this. (See Adding the Universe and Multiverse Repositories for more information about this.

Even with liblame installed, the transcoding would not include the audio. There is supposed to be a version of ffmpeg that is compiled to use liblame, but I could not get that version so work, so in the end, I recompiled ffmpeg myself using the instructions Compiling ffmpeg with mp3 support on Ubuntu. With this, the transcoding now includes the audio.

With that, I started adding SWF Tools. In my case, I loaded the SWF Tools module and the FlowPlayer module. I went to Admin, Site Configuration, SWF Tools, File Handling to set SWF Tools to use FlowPlayer. In Admin, Reports, SWF Tools, I checked to make sure that I had the Player properly installed. There is a link there for getting the tool. In Admin, Site Configuration, Input Formats, I enabled SWF Tools in the Filtered HTML format. With that, I could then add a line like
swf file="sample1.mov.flv" params="width=640&&height=480" inside of square brackets to the Read More section of a node, so that people would be able to see the video when they clicked on Read More.

I also played a bit with Galleries and Slideshows, but that can wait for another post.

Are you doing anything interesting with themes and videos on your Drupal site? Was this helpful? Are there things I’ve missed?

(Categories: )