SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2010
    Location
    Bangladesh
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Post Need help about ffmpeg for creating and showing thumbnail of a video

    Hi,

    I want to create thumbnail from uploaded video in the website using ffmpeg and show the uploaded video from the front end of the site after creating thumbnail.How can i do this? Is it possible to create thumbnail during upload video in the website? Is there anyone can help me explain me this by example?

    Thanks,
    Rima.

  2. #2
    SitePoint Wizard bronze trophy Immerse's Avatar
    Join Date
    Mar 2006
    Location
    Netherlands
    Posts
    1,661
    Mentioned
    7 Post(s)
    Tagged
    1 Thread(s)
    You cannot do this during upload, however, after upload you can create a thumbnail.
    You'll need to run this on the command line:

    Code:
    ffmpeg  -itsoffset -4  -i uploaded_movie.avi -vcodec mjpeg -vframes 1 -an -f rawvideo -s 320x240 thumbnail.jpg
    From PHP, after uploading and saving the file:

    PHP Code:

    $output_file_name 
    '/var/www/your_site/images/thumbnail.jpg';

    $cmd 'ffmpeg  -itsoffset -4  -i ' $path_to_uploaded_file' -vcodec mjpeg -vframes 1 -an -f rawvideo -s 320x240 ' $output_file_name

  3. #3
    SitePoint Enthusiast
    Join Date
    Oct 2010
    Location
    Bangladesh
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Immerse.

    But can you please tell me which variable i will use to show the image? Please see the following code. In poster attribute which variable i have to pass?

    <video src="Media/<?=$row['videofile']?>" height="370" id="container" poster="images/<?=$cmd?>" width="590"> </video>


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •