如何使用 Delphi 7 显示 MP4 文件中的缩略图或第一帧

发布于 2024-09-03 08:20:38 字数 194 浏览 1 评论 0原文

我需要显示充满 MP4 文件的文件夹的缩略图预览。

那么,是否有一个 Delphi 7 组件可以从 MP4 文件中提取缩略图(如果 MP4 确实包含缩略图),或者是否有一个 Delphi 7 组件可以从 MP4 文件中提取第一帧?

我需要提取它,以便将其保存到 .jpg 或 .png 文件(稍后再次使用)。

任何想法,谢谢。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不及他 2024-09-10 08:20:39

Delphi的视频处理能力确实有限。但它确实包含一个简单的 activeX/OLE 媒体播放器。因此一种选择是使用媒体播放器组件打开 MP4 文件,然后对 BMP 表面进行快照。然后调整大小并保存该 BMP。但是...这要求您的用户拥有 Windows Media Player 播放整个 MP4 文件所需的所有 MP4 解复用器和解码器,而他们可能尚未安装。您可能会在视频图像中遇到变形宽高比的情况。

另一种选择是使用精彩的免费开源 ffmpeg.org 项目。它可以使用 1 个小 EXE 打开并重新保存数千个音频/视频/图像文件。你的delphi程序可以弹出一个ffmpeg.exe命令行,从电影中的任意点提取单个帧,然后ffmpeg可以调整大小并保存为jpg。您所要做的就是等待 JPG 写入。

如果您不想使用命令行,并且不介意购买组件,则可以从 www.delphiffmpeg.com 购买 FFVCL。它是 ffmpeg 的 VCL 包装器。我自己从未使用过它,但据说它可以执行 ffmpeg.exe 命令行可以执行的任何操作,但可以在 Delphi IDE 中通过 VCL 包装器执行。

还有免费的 Pascal 头文件,如果您喜欢冒险,可以通过它的 C API 和 DLL 在 delphi 中使用 ffmpeg。 www.iversenit.dk/dev/ffmpeg-headers

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文