欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

用php將任何格式視頻轉(zhuǎn)為flv的代碼

 更新時(shí)間:2009年09月03日 00:19:22   作者:  
用php將任何格式視頻轉(zhuǎn)為flv的實(shí)現(xiàn)代碼,大家可以參考下。
復(fù)制代碼 代碼如下:

<?
define("ROOT_DIR",dirname(__FILE__));
class EcodeFlv {
var $fromFile; //上傳來的文件
var $toFilePath; //保存文件路徑
var $toPicPath; //保存圖片路徑
var $mpeg; //ffmpeg.exe文件的路徑
var $mencode; //mencode.exe文件的路徑
var $cmdToFile; //轉(zhuǎn)換文件命令
var $cmdToPic; //轉(zhuǎn)換圖片命令
var $toFileName; //轉(zhuǎn)換后的文件名
var $mpegComm; //ffmpeg.exe的轉(zhuǎn)換命令
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->fromFile);
$exe = "D:\server\php\extras\magic";
$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;
}
}
}

//設(shè)置文件,圖片大小
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 -of 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;
}

//開始轉(zhuǎn)換
function toEcode() {
set_time_limit(0);
exec($this->cmdToFile,$flvStatus)
exec($this->cmdToPic,$picStatus);
exec($this->cmdMidi,$mStatus);
}

}
?>

相關(guān)文章

  • Java和PHP在Web開發(fā)方面對(duì)比分析

    Java和PHP在Web開發(fā)方面對(duì)比分析

    本文主要從8個(gè)方面對(duì)php和java在做web開發(fā)方面的優(yōu)劣性做了分析對(duì)比,非常不錯(cuò)的一篇文章,這里推薦給小伙伴們。
    2015-03-03
  • php實(shí)現(xiàn)的操作excel類詳解

    php實(shí)現(xiàn)的操作excel類詳解

    這篇文章主要介紹了php實(shí)現(xiàn)的操作excel類,較為詳細(xì)的分析說明了PHP操作excel的具體技巧,包括PHP針對(duì)excel的創(chuàng)建、打開、讀取、修改等,需要的朋友可以參考下
    2016-01-01
  • php語言的7種基本的排序方法

    php語言的7種基本的排序方法

    這篇文章主要為大家詳細(xì)介紹了7種php基本排序?qū)崿F(xiàn)方法,感興趣的小伙伴們可以參考一下
    2016-03-03
  • jQuery 源碼分析筆記

    jQuery 源碼分析筆記

    jQuery 最新版本1.6.1的時(shí)間戳2011年5月12日。開發(fā)未壓縮版本229KB,共8937行代碼。
    2011-05-05
  • PHP操作redis實(shí)現(xiàn)的分頁列表,新增,刪除功能封裝類與用法示例

    PHP操作redis實(shí)現(xiàn)的分頁列表,新增,刪除功能封裝類與用法示例

    這篇文章主要介紹了PHP操作redis實(shí)現(xiàn)的分頁列表,新增,刪除功能封裝類與用法,結(jié)合實(shí)例形式分析了php針對(duì)redis數(shù)據(jù)庫基本的連接、查詢、添加、分頁等操作封裝與使用技巧,需要的朋友可以參考下
    2018-08-08
  • PHP下載遠(yuǎn)程文件到本地存儲(chǔ)的方法

    PHP下載遠(yuǎn)程文件到本地存儲(chǔ)的方法

    這篇文章主要介紹了PHP下載遠(yuǎn)程文件到本地存儲(chǔ)的方法,實(shí)例分析了php遠(yuǎn)程文件的操作技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下
    2015-03-03
  • 詳解phpmyadmin相關(guān)配置與錯(cuò)誤解決

    詳解phpmyadmin相關(guān)配置與錯(cuò)誤解決

    這篇文章主要介紹了詳解phpmyadmin相關(guān)配置與錯(cuò)誤解決的相關(guān)資料,希望通過本文能幫助到大家,讓大家遇到這種問題可以解決,需要的朋友可以參考下
    2017-10-10
  • PHP中讓curl支持sock5的代碼實(shí)例

    PHP中讓curl支持sock5的代碼實(shí)例

    這篇文章主要介紹了PHP中讓curl支持sock5的代碼實(shí)例,本文直接給出實(shí)現(xiàn)代碼,需要的朋友可以參考下
    2015-01-01
  • PHP連接數(shù)據(jù)庫實(shí)現(xiàn)頁面增刪改查效果

    PHP連接數(shù)據(jù)庫實(shí)現(xiàn)頁面增刪改查效果

    這篇文章主要介紹了如何利用PHP實(shí)現(xiàn)連接SQL數(shù)據(jù)庫,從而對(duì)頁面進(jìn)行增刪改查功能,文中的示例代碼講解詳細(xì),感興趣的可以了解一下
    2022-03-03
  • PHP文件與目錄操作示例

    PHP文件與目錄操作示例

    這篇文章主要介紹了PHP文件與目錄操作,涉及php針對(duì)文件與目錄的遍歷、判斷與排序相關(guān)操作技巧,注釋中備有較為詳細(xì)的說明,需要的朋友可以參考下
    2016-12-12

最新評(píng)論