我已经使用这个命令对我的视频进行了编码。
$encode_comand="ffmpeg -i $input_path -ac 1 -ab 128k -y -vcodec libx264 -vpre ultrafast -g 30 -r 30 -crf 22 $target_path &";
exec($encode_comand);
它适用于下面的脚本
echo '<!-- START OF THE PLAYER EMBEDDING TO COPY-PASTE -->
<div id="mediaplayer'."11111".'" style="margin:0px auto; text-align:center; width:auto; display:blog;" class="vdoplayer">JW Player goes here</div>
<script type="text/javascript" src="jwplayer/jwplayer.js"></script>
<script type="text/javascript">jwplayer.key="OOD7GkWbyNXOL6MbstF2Sa/YrQPgtNUPqxm5NA==";</script>
<script type="text/javascript">
jwplayer("mediaplayer'."11111".'").setup({
flashplayer: "jwplayer/jwplayer.flash.swf",
file: "$video_file",
width: "'.$width.'",
height: "'.$height.'",
stretching: "uniform",
type: "mp4",
skin: "jwplayer/jwplayer-skins-free/six.xml",
});
</script>
<!-- END OF THE PLAYER EMBEDDING -->'
//$video_file="http://myhost.com/project/files/1/video/file3.mp4";
但是在我更改脚本之后
echo '<!-- START OF THE PLAYER EMBEDDING TO COPY-PASTE -->
<div id="mediaplayer'."11111".'" style="margin:0px auto; text-align:center; width:auto; display:blog;" class="vdoplayer">JW Player goes here</div>
<script type="text/javascript" src="jwplayer/jwplayer.js"></script>
<script type="text/javascript">jwplayer.key="OOD7GkWbyNXOL6MbstF2Sa/YrQPgtNUPqxm5NA==";</script>
<script type="text/javascript">
jwplayer("mediaplayer'."11111".'").setup({
flashplayer: "jwplayer/jwplayer.flash.swf",
file: "readfile.php",
width: "'.$width.'",
height: "'.$height.'",
stretching: "uniform",
type: "mp4",
skin: "jwplayer/jwplayer-skins-free/six.xml",
abouttext: "project",
aboutlink: "project",
});
</script>
<!-- END OF THE PLAYER EMBEDDING -->'
它不适用于我的视频编码,但我尝试了不对其进行编码的视频。
视频 尺寸:853 x 840 编解码器:H.264 帧率:每秒 30 帧比特率 408 kbps 音频 编解码器:MPEG-4 AAC 通道:立体声 采样率:44100 Hz ์ 比特率:N/A
具有读取文件功能的Readfile.php
<?php
$filename= 'http://www.longtailvideo.com/jw/upload/bunny.mp4'; //can read
$video_file = "http://myhost.com/project/files/1/video/file3.mp4";
//cannot read Same file as script below
if (file_exists($video_file)) { ob_clean(); flush(); };
header('Content-Type: video/mp4');
header('Content-Disposition: attachment;filename=file.mp4');
readfile($video_file);
?>
谢谢