简体   繁体   中英

Accessing frames from a video using Java

I have a video file which consists of series of rgb format images, for example:

video name : static_camera2.576v frame size : 480x368 frame rate : 12 frames/sec duration : 5 sec

I need to access each frame with starting frame as I and need to extract all frames so that I can calculate the Motion Vectors based on the previous frame – this is a similar to the block based MAD (mean absolute difference).

Any idea how to access each frame and then store them to manipulate them with the above given parameters?

Use Xuggler to decode each video frame. Then get the raw data behind the YUV images using the IVideoPicture#getData() method. This returns an IBuffer object which allows you either to copy the raw data into and out of Java byte[] arrays, or directly access the native memory from Java.

A quick google search yielded the following result using the Java Media Framework. If you this does not support the codecs you want to use, then you will need to look into using JNI.

http://www.oracle.com/technetwork/java/javase/tech/frameaccess-176882.html

http://forums.sun.com/thread.jspa?threadID=421678 (dead)

http://algoval.essex.ac.uk/software/video/JavaRTVK.html (dead)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM