Meena
Meena

Reputation: 967

how to convert video from one format to another using php

hi i want to include the vedio download option in my webpage. I am using ffmpeg, but it seems to work very slow. Is there is any other way to do this or how to spead up the ffmpeg. i am using this code to get the frames from the vedio.

to convert the vedio

$call="ffmpeg -i ".$_SESSION['video_to_convert']." -vcodec libvpx  -r 30 -b ".$quality." -acodec libvorbis -ab 128000   -ar ".$audio." -ac 2 -s ".$size." ".$converted_vids.$name.".".$type." -y 2> log/".$name.".txt";
$convert = (popen("start /b ".$call, "r"));
pclose($convert);

to get the frame from the vedio

exec("ffmpeg -vframes 1 -ss ".$time_in_seconds." -i $converted_vids video_images.jpg -y 2>); 

but this code does not generate any error its loading continously.

Upvotes: 2

Views: 1146

Answers (3)

Shinnok
Shinnok

Reputation: 6399

Use the ffmpeg-php library. Should boost up some processes rather then manually calling the ffmpeg command line tool using exec.

Upvotes: 1

trickwallett
trickwallett

Reputation: 2468

I'd first of all take PHP out of the equasion and time how long it takes to do what you're after via the command line.

Once you're happy that works the way you'd like it to, make sure you've tweaked your script's execution time (see http://php.net/manual/en/function.set-time-limit.php) to accomodate what's likely to take a while.

Consider an async approach if it's getting in the way of UX.

Ta

Upvotes: 0

symcbean
symcbean

Reputation: 48387

Cache or pre-generate the output format.

Upvotes: 1

Related Questions