I have my upload script that handles the file upload and then calls exec(ffmpeg -i……
I call ffmpeg 3 times. One to convert to mp4, one to convert to wemb and one to get thumbnail.
Problem is that if an investigator uploads ALL his footage, he doesnt want to have to sit there and wait for it to convert before he can do anything else. So how can i send the 3 commands and then exit the script?
I also want to run exec(rm -r /path/to/original) so the original video is deleted but obviously I have to wait for conversions to be complete before it can be run
You can use the ampersand character after the command to run it in the background and get your prompt (control) back right away.
I suggest creating a bash script like:
Then run it from php like:
The following example uses
ifstructure to decide whether to use sound or no. The first parameter is the filename, if the second one equals0then no sound on the mp4, if the third one is zero then no sound on the webm.You can use it from PHP like:
… but remember you can even start a PHP file instead of a shellscript like: