SitePoint Sponsor

User Tag List

Results 1 to 8 of 8

Thread: Movie thumbnail

  1. #1
    SitePoint Zealot
    Join Date
    Apr 2006
    Posts
    158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Movie thumbnail

    hi,
    i need a thumbnail generator script for my web site for movie file (.mpeg,.mov). I have googled it and can't find out the best solution for that.
    Please help me.

    Thnx.

  2. #2
    SitePoint Addict tina88's Avatar
    Join Date
    Jan 2007
    Location
    UK
    Posts
    270
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hiya, is this any use? http://ffmpeg-php.sourceforge.net/

  3. #3
    SitePoint Zealot
    Join Date
    Apr 2006
    Posts
    158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is it going to work on windows?

  4. #4
    SitePoint Addict tina88's Avatar
    Join Date
    Jan 2007
    Location
    UK
    Posts
    270
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have never used it, just did a google search Check the compatibility section on the link. It seems to suggest that it will.

  5. #5
    SitePoint Zealot
    Join Date
    Apr 2006
    Posts
    158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i have already checked that, and it seems to work with linux.
    Anything for windows please.
    Last edited by jito; Apr 3, 2007 at 01:49.

  6. #6
    SitePoint Zealot the DtTvB's Avatar
    Join Date
    Jul 2006
    Location
    Thailand
    Posts
    162
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This method works for me.

    First, download FFMpeg for Windows, and put the exe file in the directory of the PHP script.

    Now, use this code.

    Code:
    exec ('ffmpeg -i input.mpg -f image2 -ss 3 -vframes 1 -an -s 160x120 output.jpg');
    Command explained:

    • ffmpeg - The program's name.
    • -i input.mpg - Input file. Don't forget to change this! If the file contains special characters, wrap it in double quotes. e.g. "input file.mov"
    • -f image2 - The output format. Setting it to image2 is recommended for image outputting.
    • -ss 3 - The time to capture, in seconds. If you set it to 3, the you will get the image of the third second of the movie.
    • -vframes 1 -an - -vframes sets the number of frames to output. Just set it to 1, because an image has 1 frame. -an disables the audio.
    • -s 160x120 Size of the output
    • output.jpg - Output file. Don't forget to change this!


    In case you want to output as an animated gif, you can use this command.

    Code:
    ffmpeg -i file.flv -ss 3 -f gif -vframes 30 -an -r 10 -pix_fmt rgb24 -s 160x120 -loop_output 0 file.gif
    Details:

    • -ss 3 - Time to capture. This will capture from the first 3 seconds
    • -f gif - The output format, should be set to gif in order to do this.
    • -vframes 30 - Output the first 30 frames, which is 3 seconds.
    • -an - Disable audio
    • -r 10 - Set the framerate to 10. 30frames / 10fps = 3 seconds!
    • -pix_fmt rgb24 - I don't know, but without this it should give an error.
    • -s 160x120 - The output size.
    • -loop_output 0 - Loop it forever.

  7. #7
    SitePoint Zealot
    Join Date
    Apr 2006
    Posts
    158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Many many thanks. Let me try it once.
    Thanks again.

  8. #8
    SitePoint Zealot
    Join Date
    Apr 2006
    Posts
    158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks again, it's working fine. Now another question can i load ffmpeg as module in php 5. I've tried many times but failed.


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
  •