Copy Code code as follows:
$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 '. $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
EXEC ("Ffmpeg-i". $directory _path_full. " ". $directory _path. $file _name.". flv ");
$file _name is same file name this is being uploaded but your can give your custom video name over converting so use som Ething like myfile.flv.
In the "End Update" name in DB
$array = Array (
' Video ' => $file _name '. ' FLV ',
);
$this->db->set ($array);
$this->db->where (' id ', $id); Table where you put the video name
$query = $this->db->update (' User_videos ');
}