Distributed Video Transcoding ( Centos / Ubuntu / Suse / RedHat )
Distributed Multi-bitrate Video Transcoding On Centos / Ubuntu / Suse / RedHat (Bash Scripts)
Multi-bitrate Video processing requires lots of computing power and time to process full movie. There are different open source video transcoding and processing tools freely available in Linux, like libav-tools, ffmpeg, mencoder, and handbrake. However, none of these tools support PARALLEL computing easily.
After some research, I found amazing solution designed by 'Dustin Kirkland' based on Ubuntu JUJU and avconv. But our requirement was little bit diffrent from Dustins's solution. Our requirement was to convert single video in Multi-bitrate and in formats like 3gp, flv and upload them to single or multiple CDN(like Akamai or tata). Also we want to build this solution on top of CentOS and ffmpeg. So I decided to develop "Simple Scalable, Parallel, Multi-bitrate Video Transcoding System" by myself. Here is my solution.
The Algorithm is same as Dustin's solution but with some changes:
Making this process fault tolerant to node failures, I have written small script checkNodeFailed.sh, which will check for failed nodes and will try to reassign that job to another node. We need to add every minute cron run this.
Create test user for FTP and set password
# useradd -m ftptest; passwd ftptest
Run below commands to change pure-ftpd init script
# sed -i 's#start() {#start() {\n\t/usr/sbin/pure-uploadscript -B -r /srv/CallUpload.sh#g' /etc/init.d/pure-ftpd
# sed -i 's#stop() {#stop() {\n\tkillall -9 pure-uploadscript#g' /etc/init.d/pure-ftpd
restart pure-ftp service
NFS Export /srv directory and mount it on all nodes with NFS client option "lookupcache=none"
On all servers install supervisord and copy supervisord.conf from download directory to /etc/supervisord.conf. Restart supervisord service.
Add every minute cron for checkNodeFailed.sh script.
*/1 * * * * /srv/checkNodeFailed.sh
To check the status of jobs you may use the dashboard. Copy frontend folder to your apache DocumentRoot. In my case its /var/www/html/
# cp -a frontend/ /var/www/html/