获取文件的视频时长托管在亚马逊S3亚马逊、时长、文件、视频

2023-09-11 10:02:46 作者:丹蔻清纯

我开始一个门户网站分发视频。我们的想法是上传视频到Amazon S3和使用PHP从我的服务器收集必要的数据。到目前为止,一切正常......我不能设法得到的唯一的事情是视频的持续时间:-(任何人可以给我如何实现它的提示?

I'm starting a portal which distributes videos. The idea is to upload the videos to Amazon S3 and gather the necessary data using PHP from my server. So far everything works fine... the only thing I could not manage to get is the duration of the video :-( Could anybody give me a hint on how to accomplish it?

谢谢, 米格尔

更新:

我最终选择使用FFmpeg的做到这一点。我已经安装了FFmpeg的服务器上,我现在正在努力的用PHP执行它的前壳执行命令。我通过它从亚马逊的网址(我想无论是CloudFront的URL和S3 URL),但它说,有没有这样的目录或文件。我已经看到了使用外部文件在网络上的例子,所以我希望它的工作。

I finally opted to do it using FFmpeg. I have already installed FFmpeg on the server and I'm now trying to execute the command in the shell prior to execute it with PHP. I'm passing it the URL from Amazon (I tried both the cloudfront URL and the S3 URL) but it says that there is not such a directory or file. I've seen examples on the web using external files so I expected it to work.

我使用的命令是

ffmpeg -i https://s3-eu-west-1.amazonaws.com/path/to/file.m4v

有什么,我需要使用外部URL进行配置?

Is there something I need to configure in order to use external URLs?

推荐答案

有一个从长尾样本code段,它使用PHP和FFmpeg的 http://www.longtailvideo.com/support/forums/jw-player/setup-issues-and-embedding/9448/how-to-get-video-duration-with-ffmpeg-and-php

There is a sample code snippet from LongTail which uses PHP and FFMPeg http://www.longtailvideo.com/support/forums/jw-player/setup-issues-and-embedding/9448/how-to-get-video-duration-with-ffmpeg-and-php

是这里的另一种解决方案: 的http://www.jqueryphp.com/getting-video-duration-with-ffmpeg-php-function/2009/10/

Seems to be another solution here: http://www.jqueryphp.com/getting-video-duration-with-ffmpeg-php-function/2009/10/

您需要在服务器上安装FFmpeg的

You'll need FFMpeg installed on your server