国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > PHP > 正文

codeigniter教程之上傳視頻并使用ffmpeg轉flv示例

2024-05-04 23:21:14
字體:
來源:轉載
供稿:網友

復制代碼 代碼如下:


$file = 'video_file';
$config['upload_path'] = './video_folder/';
$config['allowed_types'] = 'mov|mpeg|mp3|avi';
$config['max_size'] = '50000';
$config['max_width']   = '';
$config['max_height']   = '';

$this->upload->initialize($config);
$this->load->library('upload', $config);

if(!$this->upload->do_upload($file))
{
// If there is any error
$err_msgs .= 'Error in Uploading video '.$this->upload->display_errors().'<br />';
}
else
{
$data=array('upload_data' => $this->upload->data());
$video_path = $data['upload_data']['file_name'];
  $directory_path = $data['upload_data']['file_path'];
$directory_path_full      = $data['upload_data']['full_path'];
$file_name = $data['upload_data']['raw_name'];

// ffmpeg command to convert video

exec("ffmpeg -i ".$directory_path_full." ".$directory_path.$file_name.".flv");

// $file_name is same file name that is being uploaded but you can give your custom video name after converting So use something like myfile.flv.

/// In the end update video name in DB
$array = array(
'video' => $file_name.'.'.'flv',
);
$this->db->set($array);
$this->db->where('id',$id); // Table where you put video name
$query = $this->db->update('user_videos');
}

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 霍州市| 天镇县| 旬邑县| 利津县| 正阳县| 保定市| 庆元县| 高邮市| 葵青区| 高陵县| 东宁县| 久治县| 喀喇沁旗| 高州市| 湘乡市| 岑溪市| 五指山市| 合川市| 兰考县| 肥西县| 都匀市| 松阳县| 博白县| 出国| 会昌县| 绥德县| 湖南省| 泰安市| 固原市| 锦屏县| 太保市| 敖汉旗| 冷水江市| 东莞市| 庐江县| 和硕县| 铅山县| 贵阳市| 邢台县| 甘谷县| 肥西县|