在python中从视频源创建视频缩略图 [英] Create video thumbnail from video source in python

查看:353
本文介绍了在python中从视频源创建视频缩略图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have url of a video files and I want to generate the thumbnail each of this video source url.I'm using Django.

我的应用程序执行此操作:-

My application does this:-

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.

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

Is there any way to do this without downloading the complete video and generating thumbnails.

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

If I download each video, then there will be lot of bandwidth wastage and require lot time.

谢谢

推荐答案

您应尝试 ffmpeg . sudo apt-get install ffmpeg

我还没有测试过该解决方案,但是我只是有兴趣,所以我环顾了一下.

I haven't tested this solution but I was just interested so I looked around a bit.

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

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

此示例将在电影开始的第三分钟左右的某个地方生成一个图像帧(out1.jpg).输入将使用关键帧进行解析,这非常快.缺点是它还会在某个关键帧(不一定位于指定时间(00:03:00))上完成搜索,因此搜索将不会像预期的那样准确.

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.

来源:

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

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

Another answer claims it's possible to use it via http on remote videos so it may worth a try.

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

来源:

Source: How to read remote video on Amazon S3 using ffmpeg

希望它会有所帮助.让我们知道结果.

Hope it helps. Let us know about results.

这篇关于在python中从视频源创建视频缩略图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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