how to upload video and generate thumbnail with ffmpeg in codeigniter

I need to upload video with FFMPEG in codeigniter and save value to mysql database. and after uploading how do i get the duration of video and generates thumbnail from video and insert thumbnail path to mysql database

here is my code for uploading video:

  public function uploadvideo()
  {
    $config['upload_path'] = "./admin_assets/videos/";
    $config['allowed_types'] = "3gp|mp4|mpeg4|avi|flv";
    $this->load->library('upload',$config);

    $uploadedby = $this->input->post('uploadedby');
    $video_title = $this->input->post('video_title');
    $privacy = $this->input->post('privacy');
    $description = $this->input->post('description');

    $vid_one_name= $this->upload->do_upload('video').$this->upload->data('file_name');

    $file_size =  $this->upload->data('file_size');

    $fs = $file_size." kbytes";
    $vid_one_path= substr($vid_one_name,1);

    $insert_video = $this->db->insert('videos',['uploadedby'=>$uploadedby,'video'=>$vid_one_path,'description'=>$description,'privacy'=>$privacy,'video_title'=>$video_title,'uploadDate'=>date('M-d-Y'),'file_size'=>$fs]);
    if ($insert_video) {
        return true;
    } else {
        return false;
    }
}

It is working but I want to upload video using ffmpeg so that I can generate thumbnail from it and get the duration and other data.