I have been in need of a video thumbnailer for some time now and so I decided to create a proof of concept django model field that does just that. Note that since this is just a proof of concept project, I don't recommend using this in a production settings. This project is based heavily on the django-thumbs project but for videos instead. In order to create thumbnails for videos we must first extract a frame.
Extracting a frame can be done by using FFMpeg. The main problem is that the python FFMpeg libraries that currently exist are broken and have been for some time now. pyFFMpeg is getting a rewrite but it appears that it won't be ready anytime soon. As a quick hack, I simply pipe out to the command line and extract a group of frames. From there I find which frame has the most color and proceed with thumbnailing that frame. In case you were wondering, some videos contain black frames at the begin of the movie so instead of taking the very first frame, I take a sample of frames and find the frame with the most color.
For obvious reasons, this is NOT the best solution. In the future, if/when I get the time I plan on experimenting with ctypes since its a standard library that ships with python 2.5+. If you have any questions or would like to help please contact me.
Here is the Project Location.
blog comments powered by Disqus