Wednesday 5 September 2018

ffmpeg does not work from the php script but runs from the command line

I can run youtube-dl.php from command line "php youtube-dl.php" works fine
but not working from http... is it someting with chown?
$url = "https://www.youtube.com/watch?v=KdS6HFQ_LUc";

echo "Saving $url";

$cmd = 'youtube-dl -o "/var/www/domain.com/test/%(title)s.%(ext)s" '.$url.' -f bestvideo+bestaudio';
exec($cmd, $output, $ret);
echo 'output: ';
var_export($output);

echo "\nret: "; var_export($ret);

There is no need to run any scripts in the first place. Simply add -f bestvideo+bestaudio/best to your youtube-dl command-line and let youtube-dl merge the video automatically. Don't forget to install ffmpeg!

0 comments:

Post a Comment