Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm starting up a Debian web server which will host a website where users can upload video files and play them.

Hence, the video files need to be converted into the proper format (mp4, ogg, webm) for compatibility with the different browsers out there.

So far, I've written a bash script which does the trick using FFmpeg. The problem is, when a lot of users upload a video at the same time, my web server will get very slow.

I'm looking for a short and easy solution which queues different calls to the conversion script, so only one instance can run at the same time. I've tried using the batch command, but I can't find very much information on how to use it. I've also considered creating a named pipe, also without success.

Any help much appreciated

share|improve this question
Slightly off-topic, but you probably don't need to bother with ogg for HTML5 video - mp4 and webm will cover all major web browsers (and most minor ones too). – evilsoup Jan 31 '13 at 21:05
up vote 1 down vote accepted

Put all the completed uploaded files in one directory, with whatever web language you are using.

Then you can schedule a cronjob with your script, to run for example every hour and convert the videos that are in the pending/ directory.

You might want to use flock so that only one instance of this script can run at the same moment, even if it takes longer than expected and cron launches another script.

Within the script you can use nice to reduce it's priority so the web server will have higher priority.

share|improve this answer
Thanks for your answers, I really appreciate the effort I ended op implementing a simple queue in bash, based on the information I found on this website… – Flock Dawson Jan 31 '13 at 22:38

I've created a python3 video encode server for my internal use. With a few mods it should do the trick for you. With my python server, all you have to do is create a symlink in a special queue directory and it handles it from there, it also handles commercial skipping (of which I'm the Linux porter) which you could comment out if you're not interested in that.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.