编程语言
首页 > 编程语言> > 在python中从视频源创建视频缩略图

在python中从视频源创建视频缩略图

作者:互联网

我有一个视频文件的URL,我想为每个视频源URL生成缩略图.我正在使用Django.

我的应用程序这样做:

1. Crawl the some webpage
2. Extract all the video link from it.
3. If there are thumbnails, get those thumbnails.
4. if not thumbnails:
    #here I need to generate video thumbnails from the
    #links I extracted in 2nd step.

有什么方法可以执行此操作而无需下载完整的视频并生成缩略图.

如果我下载每个视频,则将浪费大量带宽并需要大量时间.

谢谢

解决方法:

您应该尝试ffmpeg. sudo apt安装ffmpeg

我尚未测试此解决方案,但我只是感兴趣,所以我环顾了一下.

ffmpeg -ss 00:03:00 -i Underworld.Awakening.avi -frames:v 1 out1.jpg

This example will produce one image frame (out1.jpg) somewhere around the third minute from the beginning of the movie. The input will be parsed using keyframes, which is very fast. The drawback is that it will also finish the seeking at some keyframe, not necessarily located at specified time (00:03:00), so the seeking will not be as accurate as expected.

来源:Fastest way to extract a specific frame from a video (PHP/ffmpeg/anything)

另一个答案声称可以通过远程视频上的http使用它,因此值得一试.

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

资料来源:How to read remote video on Amazon S3 using ffmpeg

希望能帮助到你.让我们知道结果.

标签:python,django,video,video-thumbnails
来源: https://codeday.me/bug/20191009/1879228.html