手机
当前位置:查字典教程网 >编程开发 >php教程 >codeigniter教程之上传视频并使用ffmpeg转flv示例
codeigniter教程之上传视频并使用ffmpeg转flv示例
摘要:复制代码代码如下:$file='video_file';$config['upload_path']='./video_folder/';$...

复制代码 代码如下:

$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');

}

【codeigniter教程之上传视频并使用ffmpeg转flv示例】相关文章:

在Windows中安装Apache2和PHP4的权威指南

配置PHP使之能同时支持GIF和JPEG

php生成zip文件类实例

在php中使用sockets:从新闻组中获取文章

php使用指定编码导出mysql数据到csv文件的方法

php统计数组元素个数的方法

第三节 定义一个类 [3]

PHP程序员一般都忽略了的几点精华

php分别做为cgi和module来运行的配置

PHP默认安装产生系统漏洞

精品推荐
分类导航