Ped*_*eto 4 php ffmpeg thumbnails
我读过这个,但没有太大帮助。
我有一个名为视频的文件夹和另一个名为缩略图的文件夹。我在视频文件夹中有很多 mp4 视频,想在第 4 秒使用 ffmpeg 和 php 将缩略图捕捉到缩略图文件夹。
我将 7z 文件解压缩到我的网站根目录,
这是我的 php 代码:
$ffmpeg = "includes/ffmpeg/bin/ffmpeg";
foreach(glob('files/videos/*.mp4') as $pathname){
$filename = substr($pathname,13,strripos($pathname,'.mp4')-13);
$thumbnail = 'files/thumbnails/'.$filename.'.jpg';
exec("ffmpeg -i $pathname -an -y -f mjpeg -ss 00:00:04 -vframes 1 $thumbnail");
}
Run Code Online (Sandbox Code Playgroud)但没有任何反应,缩略图文件夹始终为空!
- 如何确定我的服务器上是否安装了 ffmpeg?
- 我怎样才能让我的脚本工作?
请帮忙
小智 5
尝试这个:
$ffmpeg = "c:/wamp/www/includes/ffmpeg/bin/ffmpeg";
$videos = "c:/wamp/www/files/videos/*.mp4";
$ouput_path = "c:/wamp/www/files/thumbnails/";
foreach(glob($videos) as $v_file){
$fname = basename($v_file, ".mp4");
$thmb = $ouput_path.$fname.'_tn.jpg';
$cmd = "$ffmpeg -i $v_file -an -y -f mjpeg -ss 00:00:04 -vframes 1 $thmb";
$stat = system ($cmd);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5444 次 |
| 最近记录: |