php assignment

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

Post Reply
user___
Forum Contributor
Posts: 297
Joined: Tue Dec 05, 2006 3:05 pm

php assignment

Post 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?
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Post by VladSun »

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

Reply

Post by user___ »

Thanks for your reply man but I do not get what you mean by in the background?
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Post by VladSun »

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

Reply

Post by user___ »

thanks but if I have two execs?

The second does not work.

ANy suggestions?
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Post by VladSun »

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

Reply

Post 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.
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Post by VladSun »

You may try to execute it in a single command - something like this

Code: Select all

exec("(process1 && process2) &")
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

Reply

Post by user___ »

It does not work. Can you make the whole exec and I will test it? Thanks
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Post 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 &");
There are 10 types of people in this world, those who understand binary and those who don't
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: Reply

Post by VladSun »

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

Reply

Post by user___ »

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

Reply

Post 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.
user___
Forum Contributor
Posts: 297
Joined: Tue Dec 05, 2006 3:05 pm

Reply

Post by user___ »

I have found the bug. I removed the resource and the application did not have anything to convert. Thanks for the help.
Post Reply