Video Converter uses the FFmpeg multimedia framework for actual file processing, and adds an easy-to-use API for probing and converting media files on top of it.
Supported codecs and formats:
Features:
Module documentation is available here.
This module uses the ffmpeg utilities to do the actual media processing, and so requires them to be installed on the system (either system-wide, or to a custom location). Support for a particular format/codec depends on the underlying ffmpeg utilities being compiled with support for it.
Import the module and create the Converter object:
>>> from converter import Converter
>>> c = Converter()
Examine video file:
>>> info = c.probe('test1.ogg')
>>> info.format.format
'ogg'
>>> info.format.duration
33.0
>>> info.video.codec
'theora'
>>> info.audio.codec
'vorbis'
>>> info.video.video_width
720
>>> info.video.video_height
400
Resize the video:
>>> conv = c.convert('test1.ogg', '/tmp/output.ogg', {
'format': 'ogg',
'video': {
'codec': 'theora',
'width': 160,
'height': 120,
'fps': 15,
'bitrate': 300 },
'audio': {
'codec': 'vorbis',
'channels': 1,
'bitrate': 32 } })
>>> for timecode in conv:
pass
Extract a thumbnail from the frame 10 seconds in the video:
>>> c.thumbnail('test1.ogg', 10, '/tmp/shot.png')
It looks solid, but all the paths are hard-coded for Linux and it doesn't play nice with Windows.
Questions & Comments