Is there an alternative to PyMedia to decode different video formats and be able to extract frames as images for further processing?
Currently I have to be able to do something like the following (not worki开发者_JAVA百科ng code extract, just to give an idea):
demuxer = muxer.Demuxer(FORMAT)
streams = demuxer.parse(open(VIDEO).read(BUFFER_SIZE))
codec = vcodec.Decoder(CODEC)
for stream in streams:
frame = codec.decode(stream[1])
fdata = frame.convert(2)
img = Image.fromstring("RGB", fdata.size, fdata.data)
# ...further processing of image...
You can try Pyffmpeg https://code.google.com/p/pyffmpeg/...
Pyffmpeg seems to be lagging a few years behind most recent ffmpeg releases, so not sure whats the status there :S One possible solution could be moviePy, which is also ffmpeg based... According to this video intro it may be promising
精彩评论