Page 1 of 1

php assignment

Posted: Fri Nov 30, 2007 6:20 am
by user___
Hi guys,
I have a movie converter which uses ffmpeg. After the form is submitted there is a big delay while converting. Is it possible to start converting and a user to continue browsing?

Posted: Fri Nov 30, 2007 7:00 am
by VladSun
Put the ffmpeg process in background.

Reply

Posted: Fri Nov 30, 2007 7:05 am
by user___
Thanks for your reply man but I do not get what you mean by in the background?

Posted: Fri Nov 30, 2007 7:24 am
by VladSun

Reply

Posted: Fri Nov 30, 2007 7:38 am
by user___
thanks but if I have two execs?

The second does not work.

ANy suggestions?

Posted: Fri Nov 30, 2007 7:47 am
by VladSun
Put'em both in background ...

Reply

Posted: Fri Nov 30, 2007 7:52 am
by user___

Code: Select all

exec("ffmpeg -i ".$root_dir.$filename."  -r 29.97 -ab 64 -ar 22050 -b 500 -s 1280x720 -aspect 16:9 ".$root_dir."/".$flvNameStrHD." > /dev/null &");

						exec("ffmpeg -i ".$root_dir.$filename."  -r 20.33 -ab 32 -ar 11025 -b 500 -s 640x360  -aspect 16:9 ".$root_dir."/".$flvNameStrNormal." > /dev/null &");

only the first is executed.

Posted: Fri Nov 30, 2007 8:02 am
by VladSun
You may try to execute it in a single command - something like this

Code: Select all

exec("(process1 && process2) &")

Reply

Posted: Fri Nov 30, 2007 8:09 am
by user___
It does not work. Can you make the whole exec and I will test it? Thanks

Posted: Fri Nov 30, 2007 8:27 am
by VladSun

Code: Select all

exec(" (ffmpeg -i ".$root_dir.$filename."  -r 29.97 -ab 64 -ar 22050 -b 500 -s 1280x720 -aspect 16:9 ".$root_dir."/".$flvNameStrHD." && ffmpeg -i ".$root_dir.$filename."  -r 20.33 -ab 32 -ar 11025 -b 500 -s 640x360  -aspect 16:9 ".$root_dir."/".$flvNameStrNormal.") 2>&1> /dev/null &");

Re: Reply

Posted: Fri Nov 30, 2007 8:29 am
by VladSun
user___ wrote:It does not work.
This would be the worst explanation of your problem... especially for people trying to help ;)

Reply

Posted: Fri Nov 30, 2007 8:37 am
by user___
Sorry for that explanation. So it only executes the first command. The latter does not run.

Reply

Posted: Fri Nov 30, 2007 8:40 am
by user___
Thanks for your solution but it does take the whole time if they were executed separately not in the background. I mean they do what they are supposed to but the page has a big delay.Any suggestions.

Reply

Posted: Fri Nov 30, 2007 9:44 am
by user___
I have found the bug. I removed the resource and the application did not have anything to convert. Thanks for the help.