国产探花免费观看_亚洲丰满少妇自慰呻吟_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');
}

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 榕江县| 太谷县| 观塘区| 巴东县| 神池县| 凭祥市| 澄迈县| 武城县| 正定县| 枞阳县| 边坝县| 梁山县| 鹤壁市| 横峰县| 明溪县| 黄浦区| 松桃| 犍为县| 昌邑市| 家居| 江源县| 哈巴河县| 青岛市| 天峨县| 甘泉县| 阿图什市| 苏尼特左旗| 四平市| 文登市| 拉孜县| 名山县| 苏尼特左旗| 南涧| 柘荣县| 九江县| 仙游县| 凤台县| 兴化市| 乌兰浩特市| 子洲县| 新干县|