2013-12-23 50 views
1

我已使用此命令編碼了我的視頻。如何爲jwplayer腳本編碼ffmepg哪個腳本讀取通過php文件?

$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 幀率:MPEG-4 AAC 通道:甾 採樣率:44100每秒比特率 408 kbps的 音頻 編解碼器30層的幀赫茲์ 比特率: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); 
    ?> 

謝謝

回答

0

下:

file: "$video_file", 

地址:

type: "mp4", 
+0

是的,我發現了一些文件,可以玩一些文件not.So我看文件屬性和文件,該文件無法播放音頻採樣率爲N/A –

+0

視頻屬性----- 尺寸:853 x 840 編解碼器:H.264 幀率:每幀30幀第二 比特率408 kbps的 音頻屬性--- 編解碼器:MPEG-4 AAC 通道:甾 採樣率:44100赫茲 ์比特率:N/A –

+0

文件:「http://myhost.com/project/文件/ 1/video/file3.mp4「===可以播放。 file:「checkfile.php」===無法播放 –