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

vai*_*312 2 python django video video-thumbnails

我有一个视频文件的 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.
Run Code Online (Sandbox Code Playgroud)

有没有办法在不下载完整视频和生成缩略图的情况下做到这一点。

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

谢谢

mar*_*cpt 8

你应该试试ffmpegsudo apt-get install ffmpeg

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

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

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

来源:从视频中提取特定帧的最快方法(PHP/ffmpeg/anything)

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

ffmpeg -i "http://subdomain.cloudfront.net/video.mp4" -ss 00:00:10 -vframes 1 -f image2     
"image%03d.jpg"
Run Code Online (Sandbox Code Playgroud)

来源:如何使用 ffmpeg 在 Amazon S3 上读取远程视频

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