Split video in frames

Skip to first unread message

Dragos Raducanu

May 4, 2012, 6:12:29 AM5/4/12
to android...@googlegroups.com

Can anyone point me in the right direction for splitting a video into frames? (export each frame to raw image data for processing)
I know OpenCV for android doesn't currently support video capture and other video related processing, but maybe there's a workaround this for just grabbing the frames. 
I don't need to recreate the video after the frame processing is done, just need to grab the frames.

Also, if this is not possible with OpenCV, how can I achieve this? (without ffmpeg or native code)

Thanks in advance.

Kirill Kornyakov

May 5, 2012, 4:49:18 AM5/5/12
  1. If you want to just record a video, you can use the standard Android camera application. We do this sometimes for creation of test videos, after that you can copy them to the host and work on your algorithm.
  2. If you need a method to split a video into separate frames on desktop, you can use the following advice: http://stackoverflow.com/questions/3917601/ffmpeg-split-avi-into-frames-with-known-frame-rate.
  3. On Android you can create an application which gets frames from camera and then calls Highgui.imwrite OpenCV function. But most likely that FPS will not be sufficient. If so, you can keep Mat's in RAM and then write them to the SD card -- you should be able to keep several hundreds of images in memory (native memory is not visible for Dalvik).
  4. Or you can record a video with Java code (I don't know how to do this), then read it with Java code, and export individual frames as Bitmap, or convert Bitmaps to Mats and imwrite them.
Reply all
Reply to author
0 new messages