菜单 学习猿地 - LMONKEY

VIP

开通学习猿地VIP

尊享10项VIP特权 持续新增

知识通关挑战

打卡带练!告别无效练习

接私单赚外块

VIP优先接,累计金额超百万

学习猿地私房课免费学

大厂实战课仅对VIP开放

你的一对一导师

每月可免费咨询大牛30次

领取更多软件工程师实用特权

入驻
93
0

codeigniter教程之上传视频并使用ffmpeg转flv示例

原创
05/13 14:22
阅读数 17425
复制代码 代码如下:

$file = 'video_file';
$www.cppcns.comconfig['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   &nbsphttp://www.cppcns.com;  = $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_namewww.cppcns.com.'.'.'flv',
);
$this->db->set($array);
$this->db->where('id',$id); // Table where you put video name
$query = $this->db->update('user_videos');
}

本文标题: codeigniter教程之上传视频并使用ffmpeg转flv示例
本文地址: http://www.cppcns.com/wangluo/php/105024.html

发表评论

0/200
93 点赞
0 评论
收藏
为你推荐 换一批