I have a problem that is driving me crazy. I have a php script that uploads a file into a directory. I could then convert it with ffmpeg but I don’t want the user to have to wait on that page, I want them to be able to change page while the ffmpeg is running on the file. How can I achieve this, do I use batch or cron or what? How will I be able to communicate with my web application once the file is processed, do I run a php file in cmd to add mysql entry?
This is my ffmpeg, if someone could give me some clarity on this I would really appreciate it. I would be willing to donate like half my points at this point.
$command =
shell_exec(‘/usr/local/bin/ffmpeg -i
/home/geoff/Desktop/cave.wmv -acodec
libfaac -aq 100 -vcodec libx264
-preset slow -crf 22 -threads 0 /home/geoff/Desktop/newvideo.flv’);
I would go for crons or just create an another php script which will do converting. After user will submit the form, process the form and send the data with $_POST to video converter script and execute it without waiting for response.
Here is an example from my framework, you can modify to your needs.
EDIT:
You can read cURL manual. This is nothing to do with $_FILE.
Let me explain you in different way;
page where users see the form and
submit the form.
form_process.php; this page is going
to record any data needed from user
submitted form to your database.
In the page where you are processing user submitted data, just record it to database, upload the file, after uploading the file, prepare $_POST array or any array with information which you need to convert the file.
For example;
In video_converter.php -> Just get the ID with $_GET, right after find the record in database, and convert the file, update the record.
Of course, as I said you need to modify curlPost function I wrote above to your own needs. And if you have questions about what is cURL, I strongly recomend you to read the cURL manual first. If you still have questions you can ask another question always right?