johnska7 Posted March 12, 2008 Share Posted March 12, 2008 Hello everyone, I'm trying to set up a workflow for converting uploaded videos from flv, creating the screenshot, injecting metadata and then copying to the proper folder. I can do all of that stuff, but what I'm trying to figure out is, if I want to have a "queue" area (most of these files are over 1 gig, so they won't upload directly through PHP), I'll have the user select their movie and say "Convert", but is there a way to make it so that when PHP does the exec command to have it run as a different process, or escape from running it in the browser? A normal video conversion can take over 20 minutes, so I don't want to have the page sitting there loading or even timing out. I'd rather have it display a message that the conversion is happening and that an email will be sent to the person when it's all finished. Any help would be greatly appreciated! Link to comment https://forums.phpfreaks.com/topic/95818-do-i-need-to-fork-to-get-this-to-work/ Share on other sites More sharing options...
trq Posted March 12, 2008 Share Posted March 12, 2008 exec('commandtoexec &'); The & puts the process in the background. Link to comment https://forums.phpfreaks.com/topic/95818-do-i-need-to-fork-to-get-this-to-work/#findComment-490544 Share on other sites More sharing options...
johnska7 Posted March 12, 2008 Author Share Posted March 12, 2008 Amazing! Thank you very much. Link to comment https://forums.phpfreaks.com/topic/95818-do-i-need-to-fork-to-get-this-to-work/#findComment-490552 Share on other sites More sharing options...
johnska7 Posted March 12, 2008 Author Share Posted March 12, 2008 O.k., so I was able to get the process to work directly with exec("ffmpeg... >/dev/null &"); So my next question is, is it possible to have it alert me (email, etc) when it's done? Or stack commands, so I can encode, then launch an injector process, then copy? I know I can probably create a whole php file for it and then do a exec("php converter.php?action=convert"), etc for the actions, but how can I queue them up so they happen one after the other? Link to comment https://forums.phpfreaks.com/topic/95818-do-i-need-to-fork-to-get-this-to-work/#findComment-490720 Share on other sites More sharing options...
johnska7 Posted March 13, 2008 Author Share Posted March 13, 2008 O.k., so I made some advances today. I decided that I'm going to handle the bulk of the conversion with a perl script, since it seems to act a little better when doing multiple commands. I scripted out a PHP page that simply does: exec("convertvideo -source_movie=mtg_2.mov -final_name=mtg_2 > /dev/null &"); Problem is, it seems that php will still stop executing before this is done converting. I was trying to move away from PHP because I don't want to have to change my max_execution time... is this something that popen() can handle? Or do I have to find another way of pushing the process away from PHP? I or should I just suck it up and change my max_execution time? Link to comment https://forums.phpfreaks.com/topic/95818-do-i-need-to-fork-to-get-this-to-work/#findComment-491586 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.