简体   繁体   中英

Get thumbnail image from video not working with PHP and ffmpeg (Ubuntu)

I have generated a $cmd string:

ffmpeg -i /home/alen/www/mysite/video/Guitarist-139.mp4 -an -ss 0 -s 1280x720 /home/alen/www/mysite/img/Guitarist-139.jpg

then I have typing a command in PHP:

shell_exec($cmd);

but not working,

then I have pasted this string in terminal but in terminal work perfectly.

What is wrong.

What is the output of the command? shell_exec returns you the result - which will point you to the error reason

Try escaping the command before executing with escapeshellcmd or individual arguments with escapeshellarg before passing to ffmpeg via shell. File path you passed has slashes, which needs backslashed/ escaped atleast

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM