使用 FFMPEG 或可能的 HTML5 获取视频信息

发布于 2024-10-04 15:54:39 字数 94 浏览 0 评论 0原文

我正在制作一个视频库,并想提取一些有关视频的信息以供显示。有谁知道我将如何使用 ffmpeg 检索视频持续时间?是否可以使用 HTML5 获取此信息?

谢谢。

I'm making a video gallery and would like to pull some info about the video for displaying. Does anyone know how I would go about retrieving the video duration using ffmpeg? Is it possible to get this info using HTML5?

Thanks.

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

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

发布评论

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

评论(3

我所做的(在 Linux 上)是这样的:

tcprobe -i $FILE |尾-n1 | cut -d '=' -f3

tcprobe 来自转码 Debian 软件包。

如果您使用的是 Windows,有一个名为 MediaInfo 的工具,但我还没有尝试过,所以我可以'不评论其有效性。

What I do (on Linux) is this:

tcprobe -i $FILE | tail -n1 | cut -d '=' -f3

tcprobe is from the transcode Debian package.

If you're on Windows there's a tool called MediaInfo, but I haven't tried it so I can't remark on its effectiveness.

各自安好 2024-10-11 15:54:40

我推荐 PHPVideoToolkit...

这个类是一个包装器
FFmpeg、FLVTools2 和 Mencoder
程序允许 PHP 开发人员
操作和转换视频文件
任何易于使用的面向对象的方式。
目前还提供FFmpeg-PHP
纯 PHP 模拟,这样你就不会
需要编译并安装
模块。请注意,它并不是旨在作为
FFmpeg-PHP 替代品,仅一个
替代解决方案是
建议如果您大量使用
您可以了解 FFmpeg-PHP 的功能
应该按原样安装模块
效率更高。

PHPVideoToolkit 几乎是
您只会参加的视频/音频课程
从现在开始需要。它执行几个
操纵操作的类型
包括视频格式转换,
将视频帧提取为单独的
图像文件,组装视频流
来自一组单独的视频图像,
从视频中提取音频、水印
视频和提取的帧。一些
参数也可以这样配置
输出视频文件格式(其中
可以是 Flash 视频或任何其他
由ffmpeg支持),视频和音频
比特率和采样率,视频
尺寸和长宽比。它可以
还检索有关的信息
媒体文件,例如持续时间、比特率、
帧速率、格式、尺寸、显示
长宽比、像素长宽比、
音频立体声、音频和
音频格式,没有任何其他
附加库,例如 ffmpeg-php。

  • 请注意,它是我写的,因此您可以询问有关使用它的任何问题。

I would recommend PHPVideoToolkit...

This class is a wrapper around the
FFmpeg, FLVTools2 and Mencoder
programs to allow PHP developers to
manipulate and convert video files in
any easy to use object oriented way.
It also currently provides FFmpeg-PHP
emulation in pure PHP so you wouldn't
need to compile and install the
module. Note, it isn't intended as a
FFmpeg-PHP replacement, only an
alternative solution and it is
recommended that if you make heavy use
of the FFmpeg-PHP functionality you
should install the module as it is
more efficient.

PHPVideoToolkit is pretty much the
only video/audio class that you will
need from now on. It performs several
types of manipulation operations that
include video format conversion,
extract video frames into separate
image files, assemble a video stream
from a set of separate video images,
extract audio from video, watermark
videos and extracted frames. Several
parameters can also be configured like
the output video file format (which
can be Flash video or any other
supported by ffmpeg), video and audio
bit rate and sample rate, video
dimensions and aspect ratio. It can
also retrieve information about the
media file, such as duration, bitrate,
framerate, format, dimensions, display
aspect ratio, pixel aspect ratio,
audio stereo, audio frequency and
audio format, without any other
additional library such as ffmpeg-php.

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