Copy CodeThe code is 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 video '. $this->upload->display_errors (). '
';
}
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 "is being uploaded" can give your custom video name after converting so use som Ething 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 ');
}