2

I am trying to create a thumbnail for my uploading video. searching for easiest way to generate thumbnail at the time of video upload itself. i think if some provide the code without using ffmpeg will be life saving for me. because i'm running my code on windows wamp or any other alternative welcomed too thank you.

my real code is in CodeIgniter, not able to figure out how to do it.

$postname = $this->input->post('post-name');

            $configVideo['upload_path'] = './video';
            $configVideo['max_size'] = '1000000024';
            $configVideo['allowed_types'] = 'avi|flv|wmv|mp4';
            $configVideo['overwrite'] = TRUE;
            $configVideo['remove_spaces'] = TRUE;
            $ext = get_mime_by_extension($_FILES['video']['name']);
            $video_name = str_replace(' ', '_', $postname);
            $configVideo['file_name'] = $video_name;

            $this->load->library('upload', $configVideo);
            $this->upload->initialize($configVideo);

            if (!$this->upload->do_upload('video')) {

                $msg = $this->upload->display_errors();
                $this->session->set_flashdata('error', $msg);


            } else {
                $videoDetails = $this->upload->data(); 
  • Why do you want to avoid `ffmpeg`? – llogan May 18 '16 at 16:48
  • coz i'm using godaddy hosting could be a business planm thy dn't support ffmpeg on it. even i dn't knw it can wrk on my local wamp server with windows 7 64 bit. if any solution, giv m the UR's for such tutorials. so tht, i cn get any solution on roblem. thnak u.! – Amol Phad sudhakar May 19 '16 at 04:28
  • You can probably [download a `ffmpeg` binary](http://johnvansickle.com/ffmpeg/) and use it on your server. – llogan May 19 '16 at 05:39
  • what man, probably?? i want complete solution. Im not telling anyone to code for me. but, can give a specified solution or link where i can follow the procedure for PHP and codeigniter only. :) – Amol Phad sudhakar May 19 '16 at 06:10

1 Answers1

1

I think you will find it hard to get a solution for video manipulation that does not use ffmpeg in the open source world. Even if you can find something specifically for thumbnails, you may find in future you want to do other things like compression, add audio tracks etc for which ffpmeg will be useful.

The good news is that ffmpeg on a windows server and using PHP is a common solution, and there is a well used and supported PHP ffmpeg library you can use:

This includes a link to a set of ffmpeg builds that you can download onto your windows server, so you don't need to build ffmpeg yourself.

Take a look at the 'frame' method to capture a still to use as a thumbnail at a particular time in the video:

$video
    ->frame(FFMpeg\Coordinate\TimeCode::fromSeconds(10))
    ->save('frame.jpg');
Mick
  • 24,231
  • 1
  • 54
  • 120