Today, I will show, how can we upload and convert a video file to flv using FFmpeg in CodeIgniter website. FFmpeg commands runs in Linux but in Window server we need to download FFmpeg.exe file from its site. Which we have to put in our site root folder. IF your server is Linux then you also need verify that your hosting server has FFmpeg installed or you need it to be installed. For checking FFmpeg availability print phpinfo() in any file and run this command on server where you will get PHP version and other server settings. Find FFmpeg on that window if it doesn’t found then it means server has no FFmpeg installed.
Similar Posts
How can We Integrate the Authorize.Net Payment Gateway in Codeigniter?
Authorize.Net is my favorite payment mode for using in web development. It is simple, easy and secure payment connection. I use authorize.Net in my codeigniter based projects and here…

Ajax Voting System: Create Ajax Rating/Voting system in Dzone and Digg Style. Part 2
In my previous tutorial i explain how to create simple ajax rating using Ajax, PHP and CSS3. In this part i am going to create Digg.com and Dzone.com voting…
Create Simple Rounded News Scroller using Mootools.
Mootools is very easy to use library and has a large number of functionalities which reduce lot of our work to do. News scroller is used to put a…

CSS | JQuery | Miscellaneous | PHP Tutorials
Fresh JQuery Image Gallery with Captions and Auto Play/Pause Rotation
Tutorials on image galleries and menus are my favorite because these two things put an attractive look into your web pages. That’s why in the last few weeks I…
AJAX | JQuery | Miscellaneous | PHP Tutorials | Tutorials
Super Shopping Cart with JQuery. Part II
You have seen and liked the previous shopping cart tutorials and here is part 2 for that one. I was wandering over the internet and I checked a cart…

Ajax Tutorial: Dynamic Loading of ComboBox using jQuery and Ajax in PHP
Here is a script for beginners to create a dynamic loading of dropdown. Simple solution which is created by jQuery.
2 Comments
Comments are closed.
Hi i put this code in controller but i am unable to upload plz tell me how i do this. plz tell me step by step i am new………
load->model(‘files_model’);
$this->load->database();
$this->load->helper(‘url’);
}
public function index()
{
$this->load->view(‘upload’);
}
public function upload_file()
{
$status = “”;
$msg = “”;
$file_element_name = ‘userfile’;
$filename = $_FILES[‘userfile’][‘name’];
if ($status != “error”)
{
$config[‘upload_path’] = ‘./uploads/’;
$config[‘allowed_types’] = ‘*’;
$config[‘max_size’] = 1024 * 8;
$config[‘encrypt_name’] = TRUE;
$this->load->library(‘upload’, $config);
if (!$this->upload->do_upload($file_element_name))
{
$status = ‘error’;
$msg = $this->upload->display_errors(”, ”);
}
else
{
$data = $this->upload->data();
// echo “
"; print_r($data); die; $file_id = $this->files_model->insert_file($data['file_name']); if($file_id) { $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']; 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('files_upload'); $status = "success"; $msg = "File successfully uploaded"; } else { unlink($data['full_path']); $status = "error"; $msg = "Something went wrong when saving the file, please try again."; } } @unlink($_FILES[$file_element_name]); } echo json_encode(array( $status, $msg)); } } ?>I used this code but the converter is not worked what to do now…. Please help me…