free adults movies 用php將任何格式影片轉換為flv的程式碼

WBOY
發布: 2016-07-29 08:40:37
原創
2637 人瀏覽過

複製程式碼 程式碼如下:



define("ROOT_DIR",dirname(__FILE);
define("ROOT_DIR",dirname(__FILE__)); <__>class EcodeFlv {
var $fromFile; //上傳來的檔案
var $toFilePath; //儲存檔案路徑
var $toPicPath; //儲存圖片路徑
var $mpeg; //ffmpeg. exe檔的路徑
var $mencode; //mencode.exe檔的路徑
var $cmdToFile; //轉換檔指令
var $cmdToPic; //轉換圖片指令
var $toFileName; //轉換後的檔名
var $mpegComm; //ffmpeg.exe的轉換指令
var $mencodeComm; //mencode.exe的指令
var $mpegType;
var $mencodeType;
var $midi; //mdi.exe的路徑
var $cmdMidi; //mdi.exe的命令
//初始化類別
function EcodeFlv($fromFile,$toFilePath,$toPicPath, $mpeg,$mencode,$midi) {
$this->mpegComm = false;
$this->mencodeComm = false;
$this->fromFile = $fromFile;
$this- >toFilePath = $toFilePath;
$this->toPicPath = ROOT_DIR."/".$toPicPath;
$this->mpeg = ROOT_DIR.$mpeg;
$this->mencode = ROOT_DIR.$ mencode;
$this->midi = ROOT_DIR.$midi;
$this->mpegType=array (
"audio/x-mpeg"=>".mp3",
"video/ mpeg"=>".mpeg",
"video/3gpp"=>".3gp",
"video/x-ms-asf"=>".asf",
"video/x -msvideo"=>".avi"
);
$this->mencodeType = array(
"application/vnd.rn-realmedia"=>".rm",
"audio/ x-pn-realaudio"=>".rmvb",
"audio/x-ms-wmv"=>".wmv",
);
}
//檢查檔案類型
function checkType() {
if(function_exists(mime_content_type)){
return false;
}else{
//$contentType = mime_content_type($this-this>A. $exe = "D:serverphpextrasmagic";
$handel = new finfo(FILEINFO_MIME, $exe);
$contentType = $handel->file($this->fromFile);
}
foreach($this->mpegType as $index=>$key){
if($contentType == $index){
$name = md5(date("Ymd").tiime());
$this->toFileName = $name;
$this->$mpegComm = true;
return true;
}
}
foreach($this->mencodeType as $index =>$key){
if($contentType == $index){
$name = md5(date("Ymd").time());
$this->toFileName = $name ;
$this->mencodeComm = true;
return true;
}else{
return false;
}
}
}
//設定文件,圖片大小
function setSize($flvSize,$picSize) {
$flvWidth = $flvSize[0];
$flvHeight = $flvSize[1];
$picWidth = $picSize[0] ;
$picHeight = $picSize[1];
$picName = $this->toPicPath.$this->toFileName.".jpg";
$flvName = $this->toFilePath.$this ->toFileName.".flv";
$toMdi = ROOT_DIR."/".$flvName;
$size = $picWidth."x".$picHeight;
if($this->mpegComm ){
$this->cmdToFile= "$this->mpeg -i $this->fromFile -y -ab 56 -ar 22050 -b 500 -r 15 -s $flvWith*$flvHeight $flvName";
}
elseif($this->mencodeComm){
$this->cmdToFile = "$this->mencode $this->fromFile -vf scale=$flvWidth:$flvHeight -ffourcc FLV1 - lavf -ovc lavc -lavcopts vcodec=flv:vbitrate=70:acodec=mp3:abitrate=56:dia=-1 -ofps 25 -srate 22050 -oac mp3lame -o $flvName";
}
this- >cmdToPic = "$this->mpeg -i $toMdi -y -f image2 -ss 8 -t 0.003 -s $size $picName";
$this->cmdMidi = "$this->midi $toMdi / k";
echo $this->cmdToPic;
}
//開始轉換
function toEcode() {
set_time_limit(0);
exec($this->cmdToFile ,$flvStatus)
exec($this->cmdToPic,$picStatus);
exec($this->cmdMidi,$mStatus);
}
}
?>

以上就介紹了free adults movies 用php將任何格式影片轉換為flv的程式碼,包括了free adults movies方面的內容,希望對PHP教學有興趣的朋友有所幫助。

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板