使用Amazon s3上传视频并提取缩略图 [英] Upload video and extract thumbnail using Amazon s3

查看:1653
本文介绍了使用Amazon s3上传视频并提取缩略图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在视频网站[平台:php]中工作,我需要在Amazon S3服务器中上传视频并提取缩略图.

i have been working in a video website [platform: php] where i need to upload videos in Amazon S3 server and extract thumbnail.

我创建了一个存储桶,并在该存储桶中成功上传了视频文件.但是我不知道如何从上传的视频中提取缩略图.所以,这就是我坚持的地方.

I have created a bucket and uploaded video file successfully in that bucket. But i don't know how to extract the thumbnail from that uploaded video. So, that's where i stuck.

任何帮助将不胜感激.预先感谢!

Any help will be appreciated. Thanks in advance!

推荐答案

在这里,您有一些选择.

Here you've got some options.

首先-您可以从视频中提取"缩略图,然后再将其上传到AWS.诸如此类:将视频上传到您的服务器,根据需要将其转换为适当的格式,获取缩略图(或多个缩略图),将其保存在某处(例如,在S3或您的本地服务器上),然后再将视频上传到S3.这种方法的缺点是您的本地服务器将不得不做很多额外的工作,而不是为您的Web访问者提供服务.

First - you can "extract" a thumbnail from the video before you upload it to AWS. Something like: upload video to your server, convert it to appropriate format if needed, take a thumbnail (or thumbnails), save them somewhere (e.g. on S3 or your local server) and then upload the video to S3. The disatvantage of this method is that your local server will have to do a lot of extra work, instead of serving your web visitors.

第二-您可以为此使用Amazon EC2计算服务:将视频上传到S3,触发EC2(例如,使用cron作业)以从S3中获取视频,进行转换,获取缩略图并上传最终结果(转换后的视频+缩略图)返回到S3.缺点是:实施这种通信"并不是一件容易的事(您必须解决很多问题,例如确保稳定的转换,创建作业队列等),另外,您还必须使用一个AWS服务以及S3.

Second - you can use Amazon EC2 computing service for that: upload video to S3, trigger EC2 (e.g. with cron jobs) to take the video from S3, convert it, take thumbnails and upload the final result (converted video + thumbnails) back to S3. Disatvantages are: it's not very easy to implement this "communication" (you'll have to solve a lot of problems, like ensuring stable converts, creating job queues etc.), plus you'll have to use one more AWS service along with S3.

如何进行视频转换和获取缩略图?有很多工具和程序可用于此.我喜欢使用 ffmpeg 进行视频转换(也有PHP包装器将其功能与php结合使用-

What's about video converting and getting thumbnails? There are many tools and programs for that. I like using ffmpeg for video converting (also there's PHP wrapper for using it's functionality with php - php-ffmpeg, but using ffmpeg itself (e.g. using php's exec() function) will give you more flexibility and features, please read documentation for more details). FFMpeg can extract thumbnails from videos as well, but it takes some time (there are lots of discussions about how to do it effectively), but I'd suggest you to use ffmpegthumbnailer for this purpose. It has simpler usage and is optimized especially for getting thumbnails from video files.

这篇关于使用Amazon s3上传视频并提取缩略图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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