Jump to content

Do I need to fork to get this to work?


johnska7

Recommended Posts

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

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?

 

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?

 

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.