I allow users to upload videos and then they get converted using ffmpeg. The video takes a really long time to convert which usually results in an error. I have done my rese
Here is a basic run-down of how to make your own queue using a scheduling system such as Cron:
queue
containing (id, created_at, file_path, id_user, result, error)
. The file_path
contains the location of the uploaded video to process, the result is null
before processing and then true/false
afterwards depending on success, and if it failed error
contains any messages. The primary key of the user table can be saved here too, if appropriate.ps aux | grep (scriptname)
to help here, if you are running in a *nix-like operating system.Inside your web application, you need to somewhat modify the workflow - rather than expecting a video to be processed immediately, you need to:
This approach is very useful for shared hosting where you cannot install your own queue processors. However, if you are on a VPS or cloud system, you may wish to look into Gearman or one of many other queueing systems. They are a bit more complex than the above, but have more features for managing queues of work.