JMF Solutions

Accesing Individual Decoded Video Frames
[Pass-through Video Codec]

 
Problem
How to access individual decoded video frames from a Processor while processing the media.  This could be used for scanning the decoded data; computing statistics for each video frame, etc.

Solution
There are basically 2 ways to do it: 1) get the data from the output DataSource of the Processor; 2) using a pass-through plugin codec as a callback when individual frames are being processed.

This example will demonstrate the second approach:
  • Build the pass-through codec.  Specify what input format you desire and define that as the Codec.getSupportedInputFormats().
  • Create a processor from the input file.
  • Get the TrackControls from the processor.
  • Set your codec on the video track: TrackControl.setCodecChain(your_codec[]).
That way, your codec's process call will be the "callback" whenever a video frame goes through your plugin.

To require for a specific input to your codec, you can define your codec to support only your desirable type of input.  Then the processor will try its best to construct a data flow path to connect to your codec.
 
 
Requirements
 
Platform: JDK 1.1.6 or later
JMF API: 2.0 or later
Implementation: AJ, WPP, SPP *


* AJ = All Java, WPP = Windows Performance Pack, SPP = Solaris Performance Pack
 
Related Classes
 
 
How to run this sample
 
  1. Download the source and compile it.
  2. Run as command line "java FrameAccess <URL>".
 
Source Code
 
 
 
Left Curve
Java SDKs and Tools
Right Curve
Left Curve
Java Resources
Right Curve
July 2015 Java Sidebar Banner

Java SE Advanced Best Practices WebCast

Duke's Choice RHS Banner

JavaOne 2014 Replay banner