我现在正在使用ffmpeg php库,我已经完成了视频转换的所有事情,并且还成功缩略图,但问题是html5没有播放转换后的视频,因为它在Windows媒体播放器中运行它总是说视频已损坏。 请指导
以下是已转换视频的链接
$ffmpeg = "/usr/bin/ffmpeg";
$image_name = rand();
$image_name = md5($image_name);
$video = escapeshellarg($_FILES['file']['tmp_name']);
$size = "200x100";
$imageFile = "uploads/video_thumbnails/".$image_name.".jpg";
$getFromSecond = "00:0:50";
$p4ath = "which ffmpeg";
//$cmd = "$ffmpeg -ss $getFromSecond -i $video -s $size -vframes 1 $imageFile";
$cmd = "$ffmpeg -i $video -f image2 -ss 14.342 -vframes 1 $imageFile";
$cmd_convert = "$ffmpeg -i $video uploads/news_videos/$image_name.mp4 &";
//$cmd = "$ffmpeg -i $video -an -ss $getFromSecond -an -r 1 -vframes 1 -y %d.png";
exec($cmd);
exec($cmd_convert);
echo $image_name;
Html5视频标记
<video width="400" controls>
<source src="<?php echo $video_image ?>" type="video/mp4">
<source src="mov_bbb.ogg" type="video/ogg">
Your browser does not support HTML5 video.
</video>