[英]How create thumbnail using ffmpeg on server?
我正在嘗試從視頻創建縮略圖,我嘗試了以下代碼在xampp上創建縮略圖,它可以正常工作,但是在服務器上嘗試運行時不起作用。
$title ="xyz";
$ffmpeg = ".//ffmpeg//bin//ffmpeg";
$videofile = $_FILES["file"]["tmp_name"];
$thumbnail = ".//thumbnail//".$title.".jpg";
$size = "230x130";
$getfromsecond = 2;
$cmd = "$ffmpeg -i $videofile -an -ss $getfromsecond -s $size $thumbnail";
shell_exec($cmd);
還有其他方法可以從服務器上的ffmpeg創建縮略圖嗎?
有什么方法可以使用ffmpeg創建縮略圖而無需在cpanel上安裝,因為我無權在cpnel上安裝ffmpeg?
作為您的解決方案,請嘗試執行以下代碼段
$title ="xyz";
$ffmpeg = ".//ffmpeg//bin//ffmpeg";
$videofile = $_FILES["file"]["tmp_name"];
$thumbnail = ".//thumbnail//".$title.".jpg";
$size = "230x130";
$getfromsecond = 2;
$cmd = "$ffmpeg -i $videofile -y -vcodec mjpeg -vframes 1 -an -f rawvideo -s $size $thumbnail";
exec($cmd);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.