bnnoor
bnnoor

Reputation: 696

ffmpeg-php exec not work on server

I use FFmpeg in my local xamp and it works fine. But on my server (FFmpeg installed) exec does not work and FFmpeg does not create output file.

This is my code:

<?php

extension_loaded('ffmpeg') or die('Error in loading ffmpeg');

$vid = realpath('test.mp4');

$ffmpegInstance = new ffmpeg_movie($vid);
echo "getDuration: " . $ffmpegInstance->getDuration() . "<br />".
"getFrameCount: " . $ffmpegInstance->getFrameCount() . "<br />".

$cmd = "ffmpeg -i $vid -s 640x360 -vcodec libx264 -preset medium -crf 23 -acodec libmp3lame -ar 44100 -q:a 5 out.flv  1> block.txt 2>&1";

//$cmd = "ffmpeg -i $vid -vcodec libvpx -cpu-used -5 -deadline realtime out.mp4 1> block.txt 2>&1";

exec($cmd);
?>

Upvotes: 0

Views: 767

Answers (1)

Jelle
Jelle

Reputation: 1034

I'm not sure why you are loading the extension ffmpeg but calling the shell to run ffmpeg. Perhaps you are mixing up if you want to call ffmpeg inside php or using exec/shell.

Can you first do a echo system('which ffmpeg'); to verify that ffmpeg can be found on the server? Also check the version of ffmpeg in a similar way. Please use the output and return value of the system and exec commands to see what the real problem is. See exec() and system() for more information.

Upvotes: 0

Related Questions