如何使用 ffmpeg 在 Amazon S3 上读取远程视频 [英] How to read remote video on Amazon S3 using ffmpeg

查看:29
本文介绍了如何使用 ffmpeg 在 Amazon S3 上读取远程视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要通过 ffmpeg 从 Amazon S3 上托管的视频创建海报帧.

I need to create poster frames from videos hosted on Amazon S3 via ffmpeg.

那么有没有办法像这样在ffmpeg命令行中直接使用远程视频文件:
ffmpeg -i "http://bucket.s3.amazonaws.com/video.mp4" -ss 00:00:10 -vframes 1 -f image2 "image%03d.jpg"

So is there a way to use the remote video file directly in ffmpeg command line like this:
ffmpeg -i "http://bucket.s3.amazonaws.com/video.mp4" -ss 00:00:10 -vframes 1 -f image2 "image%03d.jpg"

ffmpeg 刚刚返回:
http://bucket.s3.amazonaws.com/video.mp4:发生 I/O 错误
通常这意味着输入文件被截断和/或损坏.

ffmpeg just returns:
http://bucket.s3.amazonaws.com/video.mp4: I/O error occurred
Usually that means that input file is truncated and/or corrupted.

我还尝试强制 ffmpeg 使用视频 mp4 容器进行阅读:
ffmpeg -f mp4 -i "http://bucket.s3.amazonaws.com/video.mp4" ...
但没有运气.

I also tried forcing ffmpeg to use the videos mp4 container for reading:
ffmpeg -f mp4 -i "http://bucket.s3.amazonaws.com/video.mp4" ...
But no luck.

从 S3 获取此视频并在本地处理它当然可以正常工作,
以及从其他标准"http 服务器远程读取文件.
所以我知道ffmpeg支持远程文件读取,但为什么在S3上不支持?

Wget this video from S3 and processing it locally works fine of course,
as well as reading the file remotely from other 'standard' http servers.
So I know that ffmpeg supports remote file reading, but why not on S3?

推荐答案

没关系,我找到了解决问题的简单方法.

Nevermind, I found an easy way to solve my problem.

我设置了一个指向我的 S3 存储桶的 amazon cloudfront 下载分发.
通过 cloudfront,可以通过 http 使用 ffmpeg 访问这些文件:

I set up an amazon cloudfront download distribution pointing to my S3 bucket.
Via cloudfront the files are accessible with ffmpeg over http:

ffmpeg -i "http://subdomain.cloudfront.net/video.mp4" -ss 00:00:10 -vframes 1 -f image2 "image%03d.jpg"

而且数据传输更便宜!但仍然想知道为什么这不能直接与 S3 一起使用...

And the data transfer is even cheaper! But still wondering why this won't work with S3 directly...

这篇关于如何使用 ffmpeg 在 Amazon S3 上读取远程视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆