PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
user___
Forum Contributor
Posts: 297 Joined: Tue Dec 05, 2006 3:05 pm
Post
by user___ » Fri Nov 30, 2007 6:20 am
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?
VladSun
DevNet Master
Posts: 4313 Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria
Post
by VladSun » Fri Nov 30, 2007 7:00 am
Put the ffmpeg process in background.
There are 10 types of people in this world, those who understand binary and those who don't
user___
Forum Contributor
Posts: 297 Joined: Tue Dec 05, 2006 3:05 pm
Post
by user___ » Fri Nov 30, 2007 7:05 am
Thanks for your reply man but I do not get what you mean by in the background?
VladSun
DevNet Master
Posts: 4313 Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria
Post
by VladSun » Fri Nov 30, 2007 7:24 am
There are 10 types of people in this world, those who understand binary and those who don't
user___
Forum Contributor
Posts: 297 Joined: Tue Dec 05, 2006 3:05 pm
Post
by user___ » Fri Nov 30, 2007 7:38 am
thanks but if I have two execs?
The second does not work.
ANy suggestions?
VladSun
DevNet Master
Posts: 4313 Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria
Post
by VladSun » Fri Nov 30, 2007 7:47 am
Put'em both in background ...
There are 10 types of people in this world, those who understand binary and those who don't
user___
Forum Contributor
Posts: 297 Joined: Tue Dec 05, 2006 3:05 pm
Post
by user___ » Fri Nov 30, 2007 7:52 am
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.
VladSun
DevNet Master
Posts: 4313 Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria
Post
by VladSun » Fri Nov 30, 2007 8:02 am
You may try to execute it in a single command - something like this
There are 10 types of people in this world, those who understand binary and those who don't
user___
Forum Contributor
Posts: 297 Joined: Tue Dec 05, 2006 3:05 pm
Post
by user___ » Fri Nov 30, 2007 8:09 am
It does not work. Can you make the whole exec and I will test it? Thanks
VladSun
DevNet Master
Posts: 4313 Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria
Post
by VladSun » Fri Nov 30, 2007 8:27 am
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 &");
There are 10 types of people in this world, those who understand binary and those who don't
VladSun
DevNet Master
Posts: 4313 Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria
Post
by VladSun » Fri Nov 30, 2007 8:29 am
user___ wrote: It does not work.
This would be the worst explanation of your problem... especially for people trying to help
There are 10 types of people in this world, those who understand binary and those who don't
user___
Forum Contributor
Posts: 297 Joined: Tue Dec 05, 2006 3:05 pm
Post
by user___ » Fri Nov 30, 2007 8:37 am
Sorry for that explanation. So it only executes the first command. The latter does not run.
user___
Forum Contributor
Posts: 297 Joined: Tue Dec 05, 2006 3:05 pm
Post
by user___ » Fri Nov 30, 2007 8:40 am
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.
user___
Forum Contributor
Posts: 297 Joined: Tue Dec 05, 2006 3:05 pm
Post
by user___ » Fri Nov 30, 2007 9:44 am
I have found the bug. I removed the resource and the application did not have anything to convert. Thanks for the help.