PyFFmpeg is a wrapper around FFmpeg's libavcodec and libavformat libraries whose main purpose it to provide access to individual frames of video files of various formats (including MPEG and DIVX encoded videos).
FFmpeg
http://ffmpeg.mplayerhq.hu/ is a software package containing libraries and utilities for encoding, decoding and converting audio and video files. It includes libavcodec, a leading audio/video codec library that can work with most video and audio formats. This library generally uses its own codec. And thus it does not depend on your operating system installed libraries.
Using FFmpeg and libavcodec you can develop applications that can parse and display video files and be sure they will work on most platform, including of course Linux, Macintosh and Windows boxes.
PyFFmpeg
The libavcodec and libavformat libraries of the FFmpeg project are quite complex to use, especially from Python. PyFFmpeg provides a simple object oriented interface to those libraries.
PyFFmpeg-1 : Original release
PyFFmpeg has stayed in minimal status where it could be used to extract individual frames from video files and create PIL image objects from them.
While there were several Python libraries that offer to play video files (like wx.MediaCtrl from the wxPython library, most of them could not extract frames, and this is the reason PyFFmpeg was created.
A more complex wrapper around FFMPEG has been implemented within PyMedia. However, PyMEDIA is now based on and old version of ffmpeg, and probably also need some minor rewrites.
Example
Here's a simple example that extracts the first frame from a video file and saves it in .png format. You'll need PIL to run it.
import pyffmpeg
stream = pyffmpeg.VideoStream()
stream.open('myvideo.avi')
image = stream.GetFrameNo(0)
image.save('firstframe.png')PyFFmpeg : Upcoming beta
We have performed a complete rewrite of PyFFMPEG.
The new PyFFMPEG is bound to NumPy rather than to Python Imaging Library (PIL), it supports video and audio decoding. (But still not encoding or streaming/thought we are thinking about it)
This version is currently only available to SVN users, but it shall be released as a package for users to test it as beta during december 2009.