Home

Installation

In Ubuntu you can install the above using the following commands:

sudo aptitude install python-dev cython libavcodec-dev libavformat-dev libswscale-dev

tar -xf FFVideo-0.0.13.tar.gz
cd FFVideo-0.0.13
python setup.py install

or:

sudo aptitude install python-dev cython libavcodec-dev libavformat-dev libswscale-dev python-pip
pip install ffvideo

How to use

Getting thumbnails or videostream info

from ffvideo import VideoStream

def print_info(vs):
    print '-' * 20
    print "codec: %s" % vs.codec_name
    print "duration: %.2f" % vs.duration
    print "bit rate: %d" % vs.bitrate
    print "frame size: %dx%d" % (vs.frame_width, vs.frame_height)
    print "frame_mode: %s" % vs.frame_mode


vs = VideoStream('0.flv')
print_info(vs)

vs = VideoStream('0.flv',
                 frame_size=(128, None), # scale to width 128px
                 frame_mode='L') # convert to grayscale
print_info(vs)

frame = vs.get_frame_at_sec(2)
print frame.size

# PIL image, required installed PIL
frame.image().save('frame2sec.jpeg')

# numpy.ndarray, required installed numpy
print frame.ndarray().shape

Iterating over frame sequence

from ffvideo import VideoStream

for frame in VideoStream('0.flv'):
    print frame.timestamp

Updated

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.