[Product-Developers] Capture still image from video/automatically assign P4A file image

Brayton Osgood braytonosgood at gmail.com
Tue Sep 22 19:38:23 UTC 2009

I'm trying to extend P4A Video to automatically generate the file  
images that can be added to each video via the edit panel of any  
IVideoEnhanced content. Ideally, the result will be an adapter (I  
think) that responds to the IVideoEnhanced interface.

Right now I'm running into trouble capturing an image from a video  
file once it's stored in Plone. I've tried calling ffmpeg as a  
subprocess, but I get an I/O error (see below):

 >>> image = subprocess.Popen('ffmpeg -i moviefile -ss 1 -an -vframes  
1 -f image2 thumb%2d.jpg', shell=True, stdin=subprocess.PIPE,  
stdout=subprocess.PIPE, stderr=subprocess.STDOUT, close_fds=True)
 >>> print image.stdout.read()
FFmpeg version SVN-rUNKNOWN, Copyright (c) 2000-2007 Fabrice Bellard,  
et al.
   configuration: --enable-gpl --enable-pp --enable-swscaler --enable- 
pthreads --enable-libvorbis --enable-libtheora --enable-libogg --	  
enable-libgsm --enable-dc1394 --disable-debug --enable-shared -- 
   libavutil version: 1d.49.3.0
   libavcodec version: 1d.51.38.0
   libavformat version: 1d.51.10.0
   built on Mar 16 2009 21:19:49, gcc: 4.2.4 (Ubuntu 4.2.4-1ubuntu3)
moviefile: I/O error occured
Usually that means that input file is truncated and/or corrupted.

I've tried doing this where 'moviefile' is an <ATFile at /Plone/ 
Members/brayt/jumping2.mov> object, a <p4a.video _ATCTFileVideo>  
object (applying the IVideo interface to the ATFile), and even the  
binary data (passed by moviefile.getData()). Each case gives me the  
same error.

I suspect this is because ffmpeg expects to receive certain file  
types, and Plone files are somehow wrapped so they aren't recognized.  
I guess my question may boil down to how do I access (and do something  
useful with) the data in a file that's not normally read by Plone? I  
suspect that the indexing of PDFs behaves similarly to what I'm hoping  
to do, but I haven't quite figured out how that works.

Any help would be greatly appreciated!

Thanks much,


More information about the Product-Developers mailing list