views:

429

answers:

1

Hi, I need to display a thumbnail preview of a folder full of MP4 files.

So, is there a Delphi 7 component which extract a thumbnail image from MP4 files (if MP4 does contain a thumbnail image), or is there a Delphi 7 component which can extract the 1st frame from a MP4 file ?

I need to extract it so I can save it to a .jpg or .png file (to be used again later on).

Any ideas, Thanks.

+1  A: 

Delphi's video processing capabilities are really limited. But it does include a simple activeX/OLE media player. So one option is to use the media player component to open the MP4 file, then snapshot the BMP surface. Then resize and save that BMP. But... that requires that your user has all the neccessary MP4 demuxers and decoders for windows media player to play the whole MP4 file, which they might not have installed yet. And you might run into anamorphic aspect ratios in your video image.

Another option is to use the wonderful free and open source ffmpeg.org project. It can open and re-save literally thousands of audio/video/image files using 1 small EXE. Your delphi program could just pop out a ffmpeg.exe commandline that extracts a single frame from any point in the movie and then ffmpeg can resize and save to jpg. All you'd have to do is wait for the JPG to write.

If you don't want to go the commandline route, and don't mind paying for a component, you could buy FFVCL from www.delphiffmpeg.com. It's a VCL wrapper for ffmpeg. I've never used it myself, but it supposedly can do anything a ffmpeg.exe commandline can do, but instead within the Delphi IDE from a VCL wrapper.

There's also free Pascal headers, to use ffmpeg in delphi from it's C APIs and DLLs if you're adventuresome. www.iversenit.dk/dev/ffmpeg-headers

Brad Phipps
@brad phipps: Brad, the FFVCL is a bit overkill and expensive for the purpose I need it for, but the ffmpeg method works fine. Thanks very much for pointing this out. Sorry, it took me some time to try this out, but it's working now.
Edelcom