开发者

How to display a thumb image or first frame from a MP4 file using Delphi 7

开发者 https://www.devze.com 2023-01-01 10:24 出处:网络
I need to di开发者_开发技巧splay 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

I need to di开发者_开发技巧splay 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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消