user1524855
user1524855

Reputation:

Creating thumbnails from video files with Python on my website

I need to create thumbnails for a video file which users uploaded to web site running django.

How would I go about this...which function can do this ? I can display thumbnail images but I cant capture a view from a video. Thanks for helps.

Upvotes: 4

Views: 3472

Answers (1)

miki725
miki725

Reputation: 27861

Videos are tricky business due to the vastness of codecs, containers, etc. I would recommend to use ffmpeg due to it's vast support and call it in Python using subprocess module. Following the first Google hit for ffmpeg video thumbnail, you can do it like:

from subprocess import check_output
check_output('ffmpeg  -itsoffset -4  -i test.avi -vcodec mjpeg -vframes 1 -an -f rawvideo -s 320x240 test.jpg', shell=True)

Obviously you have to change the command string but this should get you started.

Upvotes: 2

Related Questions