March 7th, 2007
It seems like it’s been part of the fabric of the internet now for ages but in reality the mass acceptance of video use in webpages didn’t occur until early 2006 with the likes of Youtube gaining the publics attention, coinciding with a massive public uptake in broadband connectivity.
Now many people want the capability to add videos easily to their site .. but this demand for that technical capability is often not matched by an understanding of the potential difficulties in implementation, particularly when faced with limited resources in development or hosting provision. The variety of sources which produce video, from 100’s of mobile phone models to webcams to dv-cams, combined with different operating systems, software, codecs etc could potentially be confusing. So how do video sites deal with the all the potential options in their user input?
The battle for the dominant format for web video consumption has been won – Flash video scores very highly on cross platform capabilities, browser compatability and general public ubiquity and acceptance. It also is highly maleable in its ability to be integrated into customised interfaces and branded scenarios unlike more traditional video contenders such as quicktime and windows media, which are more suited when the use case of the media is to be downloaded and viewed on the desktop rather than embedded within a web page.
To convert user uploads to flash video (flv) we have a number of options – we could use Sorenson Squeeze installed on a (windows) server and use its ‘watch folder’ capability to convert files, or similar products such as On2 Flix SDK. These work great ‘out of the box’ but incur ongoing licence fees that are quite expensive except if you are using them at an enterprise level.
On the other hand FFMPEG is an entirely free and open source library that will convert many popular video file formats to flv, but it does require more developer effort to get to a useable solution. Like many open source projects it has its foibles (the documentation is scattered and patchy, the mailing list obtuse and unhelpful, there are complications brought by dependance on other external libraries) but if you persevere you can create a cross platform application that can be hosted on windows or linux servers without any licence fee cost.
The first step in creating a solution is to visualise the processes involved:
upload file-> analyse format of uploaded file -> convert to flv -> display
In stage 2 I’ll describe how to implement these stages using php, an ffmpeg binary and a flash video player.