设为首页 - 加入收藏
广告 1000x90
您的当前位置:主页 > 建站教程 > 正文

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

来源:建站教学网 编辑:小编 时间:2019-10-09 11:05
codeigniter教程之上传视频并使用ffmpeg转flv示例

复制代码 代码如下:
$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');
}


    本文网址:http://www.shlzwl.cn/a/jianzhan/2019/1009/68260.html ,喜欢请注明来源。

网友评论:

发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 验证码:点击我更换图片
codeigniter教程之上传视频并使用ffmpeg转flv示例

站长沙龙 www.shlzwl.cn 中国百万站长的福音,一站式服务。网站地图

Copyright © 2002-2019 站长沙龙 客服qq:2501324206

Top