简体   繁体   English

如何在Xamp PHP中从ffmpeg创建视频缩略图

[英]how to create video thumbnail from ffmpeg in xamp php

<?php
$ffmpeg = 'C:\ffmpeg\ffmpeg.exe';  

//video dir  
$video = 'C:\Users\Public\Videos\Sample Videos\upload.mp4';  
echo $video ;
//where to save the image  
$image = 'C:\ffmpeg\image\image.jpg';  

//time to take screenshot at  
$interval = 5;  

//screenshot size  pn 
$size = '640x480';  

//ffmpeg command  
//$cmd = "$ffmpeg -i ".$video "-deinterlace -an -ss".$interval". -f mjpeg -t 1 -r 1 -y    -s". $size." ". $image." 2>&1";  
$cmd="$ffmpeg -i ".$video." -ss 00:00:14.435 -f image2 -vframes 1 ".$image;
echo $cmd
//$cmd = "$ffmpeg  -i $video -f mjpeg -vframes 1 -s 150x150 -an myimage.jpg";
exec($cmd);
//$return = '$cmd';  
//print_r($outputData);
?>

i want to create thunbnail from video file . 我想从视频文件创建thunbnail。 i have correctly configured ffmpeg to xamp as it shows in phpinfo. 我已经将ffmpeg正确配置为xamp,如phpinfo中所示。 my code is running correctly , there is no error showing . 我的代码正常运行,没有错误显示。 But video thumb nail is no where generating. 但是视频指甲不是在哪里产生的。 Please provide me the source code . 请提供给我源代码。 if it is possible . 如果可能的话 。 its very urgent 非常紧急

Your path to the video contains spaces, so it must be quoted 您的视频路径包含空格,因此必须加引号

Change 更改

$video = 'C:\Users\Public\Videos\Sample Videos\upload.mp4'; 

to

$video = '"C:\Users\Public\Videos\Sample Videos\upload.mp4"'; 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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