ADC - Innovative Data Solutions
Streaming multimedia content with Apache
Although the intention of this blog is to post about business intelligence related topics the nature of a blog makes it an ideal medium to log digital content and to subsequently retrieve this information. This post is more of an aide memoir although hopefully it will prove useful to others.
Those users who have looked around the site, will have come across several multimedia clips in the form of flash videos. Well today I decided to enabled pseudo streaming of these videos on the website using an apache extension.
So what exactly is pseudo streaming ? When you visit a website such as youtube you can skip within the file to a point of interest, this is enabled by streaming the content to the client. It confers several advantages, firstly the entire video does not need to be downloaded upfront which makes the whole experience more responsive and if the user effectively fast forwards the content then only data from that part of the video onwards is streamed.
Although this sounds simply the commercial reality is quite different. Typically to stream media you are required to purchase a separate streaming media server, which is often an expensive proposition. For unix users there is the possibility of using the open source Darwin Steaming Media server from apple, but again this means installing a separate software component.
Fortunately there are some alternatives, although these are not full streaming media server they are a decent compromise.
The apache module mod_flvx can be used to achieve pseudo streaming of media. Effectively what happens here is when a user skips to the middle of a video the module will read the contents of the file, truncate the part the user wishes to skip and the send the remaining content.
To use this module the following steps were taken.
1)Install the httpd-devel tools
sudo yum install httpd-devel
2)Download the extension from the apache website
3)Compile the extension
apxs -c -i ./mod_flvx.c
4)Edit your apache configuration file (often called httpd.conf) and add the following lines
LoadModule flvx_module modules/mod_flvx.so
AddHandler flv-stream .flv
5)Restart apache
/etc/init.d/httpd restart
Wednesday, 4 November 2009
Pseudo streaming with Apache