Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

extract an image from video file

by jscjso (Initiate)
on Nov 02, 2009 at 04:55 UTC ( #804415=perlquestion: print w/replies, xml ) Need Help??

jscjso has asked for the wisdom of the Perl Monks concerning the following question:

I have setup a video upload for my website with Perl. However, I want to extract an icon to represent each video. Is there a way to construct a Perl script to do the job? For example, extract a jpg or gif from a wmv file.

Replies are listed 'Best First'.
Re: extract an image from video file
by hangon (Deacon) on Nov 02, 2009 at 06:16 UTC
Re: extract an image from video file
by zentara (Archbishop) on Nov 02, 2009 at 13:14 UTC
    mplayer does it,
    > I am looking for Linux tools for extracting the individual frames of > an AVI movie file, and saving them to files in bitmap formats such a +s > JPEG. Any suggestions? mplayer -vo jpeg file.avi (generates 1 JPEG per frame, plays all frames) mplayer -vo jpeg -ss 1:23:45 -frames 20 file.avi (-sseeks to 1 hour 23 minutes 45 seconds in file.avi, generates 20 JPE +Gs from the subsequent frames, quits) "man mplayer" for more stuff, like skipping to the start of a DVD chapter.
    how to run mplayer from Perl is another question, see ztk-v4l-video-bloger/recorder for ideas

    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku
      Zentara, My environment Perl in Windows. It is not Linux. Seems like the command are using Linux. I do need the find a way to run from Perl. Thanks,
        i do believe there is an mplayer binary out there for Windows.... but I can't assure you that it will work.... but probably will.... you probably will need a different command line syntax.... google for "mplayer win32" and of course, google for the companion program, mencoder..... mencoder assembles frames back together

        you also might want to see if the win32 version of ImageMagick will rip a frame from an wmv or avi.... its available for Windows too

        I'm not really a human, but I play one on earth.
        Old Perl Programmer Haiku
Re: extract an image from video file
by spx2 (Deacon) on Nov 02, 2009 at 17:01 UTC
Re: extract an image from video file
by ramlight (Friar) on Nov 02, 2009 at 17:32 UTC
    You might also want to take a look at VideoLAN. They have a Win32 client that I have used successfully on a number of different systems.

    Of particular interest to you might be How_to_create_thumbnails

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://804415]
Approved by wfsp
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (8)
As of 2023-12-07 17:52 GMT
Find Nodes?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?

    Results (33 votes). Check out past polls.