2014-12-19 59 views
1

创建视频缩略图我的视频文件的网址,我想生成缩略图每个使用Django这个视频源url.I'm的。从视频源在Python

我的应用程序是: -

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. 

有没有办法做到这一点,而无需下载完整的视频,并生成缩略图。

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

感谢

回答

4

你应该尝试的ffmpegsudo apt-get install 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

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

+0

我怎么使用它子打电话,我的意思是叫子很容易,但我GOR命令行error.SyntaxError:无效的语法 – vaibhav1312 2014-12-19 13:36:03

+0

您是否尝试过在终端运行呢?我会从第一个开始,然后在一切按预期工作之后将其实施到Django。 – martincpt 2014-12-19 13:45:08

+0

不过,如果你想运行与子命令:** subprocess.call(的命令行HERE“,壳=真)** 注意,Python官方文档中指明了关于使用shell = True参数警告。 “如果将 与不受信任的输入组合在一起,调用带有shell = True的系统shell可能会产生安全隐患” – martincpt 2014-12-19 13:50:50