-
Notifications
You must be signed in to change notification settings - Fork 17
Home
Simple Scalable, Parallel, 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 & developed 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. Also we want to build this solution on top of CentOS and ffmpeg. So I decided to design and 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:
- Upload file to FTP. After a successful upload CallUploadScript(pure-ftpd function) will call script:
- Script is responsible for syncing files to all nodes(Disabled ssh encryptions to speed up transfer)
- Updating duration, file path, filename of video and number of nodes available currently for transcoding to MYSQL
- Transcode Nodes will split the work into even sized chunks for each node
- Each Node will then process their segments of video and raise a flag when done
- Master node will wait for each of the all-done flags, and then any master will pick the job to concatenate the result
- Upload converted files to different CDN
- bc
- nproc
- ffmpeg
- mysql
- mysql-server(For master node)
- mplayer
- rsync
- Password less ssh login
- nfs server and client
- screen
- ffprobe
- Install ffmpeg(Click here for instruction)
- Download and copy all scripts to /srv directory
- Change file permission to 755
- Install Pure-FTPD and change CallUploadscript directive to yes in /etc/pure-ftpd.conf file
- Create test user 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
7. start pure-ftp service
8. Change Master/DB IP in all three scripts (MASTER_NODE variable)
9. Make sure to change WORKERS variable in CallUpload.sh script(all servers hostname)
10. start screen named master and run below command
# screen -S master
# bash -x /srv/transcode-master.sh > /home/master.log 2>&1
11. start screen named nodes and run below command
# screen -S nodes
# bash -x /srv/transcode-nodes.sh > /home/nodes.log 2>&1