源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

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

  • 时间:2022-12-12 22:19 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:codeigniter教程之上传视频并使用ffmpeg转flv示例
[u]复制代码[/u] 代码如下:
$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'); }
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部