org.jcodec.api
Class FrameGrab

java.lang.Object
  extended by org.jcodec.api.FrameGrab

public class FrameGrab
extends Object

This class is part of JCodec ( www.jcodec.org ) This software is distributed under FreeBSD License Extracts frames from a movie into uncompressed images suitable for processing. Supports going to random points inside of a movie ( seeking ) by frame number of by second. NOTE: Supports only AVC ( H.264 ) in MP4 ( ISO BMF, QuickTime ) at this point.

Author:
The JCodec project

Constructor Summary
FrameGrab(DemuxerTrack videoTrack, ContainerAdaptor decoder)
           
FrameGrab(SeekableByteChannel in)
           
 
Method Summary
 BufferedImage getFrame()
          Get frame at current position in AWT image
static BufferedImage getFrame(DemuxerTrack vt, ContainerAdaptor decoder, double second)
          Get a specified frame by second from an already open demuxer track
static BufferedImage getFrame(DemuxerTrack vt, ContainerAdaptor decoder, int frameNumber)
          Get a specified frame by number from an already open demuxer track
static BufferedImage getFrame(File file, double second)
          Get frame at a specified second as AWT image
static BufferedImage getFrame(File file, int frameNumber)
          Get frame at a specified frame number as AWT image
static BufferedImage getFrame(SeekableByteChannel file, double second)
          Get frame at a specified second as AWT image
static BufferedImage getFrame(SeekableByteChannel file, int frameNumber)
          Get frame at a specified frame number as AWT image
static BufferedImage getFrameSloppy(DemuxerTrack vt, ContainerAdaptor decoder, double second)
          Get a specified frame by second from an already open demuxer track ( sloppy mode, i.e.
static BufferedImage getFrameSloppy(DemuxerTrack vt, ContainerAdaptor decoder, int frameNumber)
          Get a specified frame by number from an already open demuxer track ( sloppy mode, i.e.
 Picture getNativeFrame()
          Get frame at current position in JCodec native image
static Picture getNativeFrame(DemuxerTrack vt, ContainerAdaptor decoder, double second)
          Get a specified frame by second from an already open demuxer track
static Picture getNativeFrame(DemuxerTrack vt, ContainerAdaptor decoder, int frameNumber)
          Get a specified frame by number from an already open demuxer track
static Picture getNativeFrame(File file, double second)
          Get frame at a specified second as JCodec image
static Picture getNativeFrame(File file, int frameNumber)
          Get frame at a specified frame number as JCodec image
static Picture getNativeFrame(SeekableByteChannel file, double second)
          Get frame at a specified second as JCodec image
static Picture getNativeFrame(SeekableByteChannel file, int frameNumber)
          Get frame at a specified frame number as JCodec image
static Picture getNativeFrameSloppy(DemuxerTrack vt, ContainerAdaptor decoder, double second)
          Get a specified frame by second from an already open demuxer track ( sloppy mode, i.e.
static Picture getNativeFrameSloppy(DemuxerTrack vt, ContainerAdaptor decoder, int frameNumber)
          Get a specified frame by number from an already open demuxer track ( sloppy mode, i.e.
 FrameGrab seekToFramePrecise(int frameNumber)
          Position frame grabber to a specific frame in a movie.
 FrameGrab seekToFrameSloppy(int frameNumber)
          Position frame grabber to a specific frame in a movie Performs a sloppy seek, meaning that it may actually not seek to exact frame requested, instead it will seek to the closest key frame NOTE: fast, as it just seeks to the closest previous key frame and doesn't try to decode frames in the middle
 FrameGrab seekToSecondPrecise(double second)
          Position frame grabber to a specific second in a movie.
 FrameGrab seekToSecondSloppy(double second)
          Position frame grabber to a specific second in a movie.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FrameGrab

public FrameGrab(SeekableByteChannel in)
          throws IOException,
                 JCodecException
Throws:
IOException
JCodecException

FrameGrab

public FrameGrab(DemuxerTrack videoTrack,
                 ContainerAdaptor decoder)
Method Detail

seekToSecondPrecise

public FrameGrab seekToSecondPrecise(double second)
                              throws IOException,
                                     JCodecException
Position frame grabber to a specific second in a movie. As a result the next decoded frame will be precisely at the requested second. WARNING: potentially very slow. Use only when you absolutely need precise seek. Tries to seek to exactly the requested second and for this it might have to decode a sequence of frames from the closes key frame. Depending on GOP structure this may be as many as 500 frames.

Parameters:
second -
Returns:
Throws:
IOException
JCodecException

seekToFramePrecise

public FrameGrab seekToFramePrecise(int frameNumber)
                             throws IOException,
                                    JCodecException
Position frame grabber to a specific frame in a movie. As a result the next decoded frame will be precisely the requested frame number. WARNING: potentially very slow. Use only when you absolutely need precise seek. Tries to seek to exactly the requested frame and for this it might have to decode a sequence of frames from the closes key frame. Depending on GOP structure this may be as many as 500 frames.

Parameters:
frameNumber -
Returns:
Throws:
IOException
JCodecException

seekToSecondSloppy

public FrameGrab seekToSecondSloppy(double second)
                             throws IOException,
                                    JCodecException
Position frame grabber to a specific second in a movie. Performs a sloppy seek, meaning that it may actually not seek to exact second requested, instead it will seek to the closest key frame NOTE: fast, as it just seeks to the closest previous key frame and doesn't try to decode frames in the middle

Parameters:
second -
Returns:
Throws:
IOException
JCodecException

seekToFrameSloppy

public FrameGrab seekToFrameSloppy(int frameNumber)
                            throws IOException,
                                   JCodecException
Position frame grabber to a specific frame in a movie Performs a sloppy seek, meaning that it may actually not seek to exact frame requested, instead it will seek to the closest key frame NOTE: fast, as it just seeks to the closest previous key frame and doesn't try to decode frames in the middle

Parameters:
frameNumber -
Returns:
Throws:
IOException
JCodecException

getFrame

public BufferedImage getFrame()
                       throws IOException
Get frame at current position in AWT image

Returns:
Throws:
IOException

getNativeFrame

public Picture getNativeFrame()
                       throws IOException
Get frame at current position in JCodec native image

Returns:
Throws:
IOException

getFrame

public static BufferedImage getFrame(File file,
                                     double second)
                              throws IOException,
                                     JCodecException
Get frame at a specified second as AWT image

Parameters:
file -
second -
Returns:
Throws:
IOException
JCodecException

getFrame

public static BufferedImage getFrame(SeekableByteChannel file,
                                     double second)
                              throws JCodecException,
                                     IOException
Get frame at a specified second as AWT image

Parameters:
file -
second -
Returns:
Throws:
UnsupportedFormatException
IOException
JCodecException

getNativeFrame

public static Picture getNativeFrame(File file,
                                     double second)
                              throws IOException,
                                     JCodecException
Get frame at a specified second as JCodec image

Parameters:
file -
second -
Returns:
Throws:
IOException
JCodecException

getNativeFrame

public static Picture getNativeFrame(SeekableByteChannel file,
                                     double second)
                              throws JCodecException,
                                     IOException
Get frame at a specified second as JCodec image

Parameters:
file -
second -
Returns:
Throws:
IOException
JCodecException

getFrame

public static BufferedImage getFrame(File file,
                                     int frameNumber)
                              throws IOException,
                                     JCodecException
Get frame at a specified frame number as AWT image

Parameters:
file -
second -
Returns:
Throws:
IOException
JCodecException

getFrame

public static BufferedImage getFrame(SeekableByteChannel file,
                                     int frameNumber)
                              throws JCodecException,
                                     IOException
Get frame at a specified frame number as AWT image

Parameters:
file -
second -
Returns:
Throws:
IOException
JCodecException

getNativeFrame

public static Picture getNativeFrame(File file,
                                     int frameNumber)
                              throws IOException,
                                     JCodecException
Get frame at a specified frame number as JCodec image

Parameters:
file -
second -
Returns:
Throws:
IOException
JCodecException

getNativeFrame

public static Picture getNativeFrame(SeekableByteChannel file,
                                     int frameNumber)
                              throws JCodecException,
                                     IOException
Get frame at a specified frame number as JCodec image

Parameters:
file -
second -
Returns:
Throws:
IOException
JCodecException

getFrame

public static BufferedImage getFrame(DemuxerTrack vt,
                                     ContainerAdaptor decoder,
                                     int frameNumber)
                              throws IOException,
                                     JCodecException
Get a specified frame by number from an already open demuxer track

Parameters:
vt -
decoder -
frameNumber -
Returns:
Throws:
IOException
JCodecException

getFrame

public static BufferedImage getFrame(DemuxerTrack vt,
                                     ContainerAdaptor decoder,
                                     double second)
                              throws IOException,
                                     JCodecException
Get a specified frame by second from an already open demuxer track

Parameters:
vt -
decoder -
frameNumber -
Returns:
Throws:
IOException
JCodecException

getFrameSloppy

public static BufferedImage getFrameSloppy(DemuxerTrack vt,
                                           ContainerAdaptor decoder,
                                           int frameNumber)
                                    throws IOException,
                                           JCodecException
Get a specified frame by number from an already open demuxer track ( sloppy mode, i.e. nearest keyframe )

Parameters:
vt -
decoder -
frameNumber -
Returns:
Throws:
IOException
JCodecException

getFrameSloppy

public static BufferedImage getFrameSloppy(DemuxerTrack vt,
                                           ContainerAdaptor decoder,
                                           double second)
                                    throws IOException,
                                           JCodecException
Get a specified frame by second from an already open demuxer track ( sloppy mode, i.e. nearest keyframe )

Parameters:
vt -
decoder -
frameNumber -
Returns:
Throws:
IOException
JCodecException

getNativeFrame

public static Picture getNativeFrame(DemuxerTrack vt,
                                     ContainerAdaptor decoder,
                                     int frameNumber)
                              throws IOException,
                                     JCodecException
Get a specified frame by number from an already open demuxer track

Parameters:
vt -
decoder -
frameNumber -
Returns:
Throws:
IOException
JCodecException

getNativeFrame

public static Picture getNativeFrame(DemuxerTrack vt,
                                     ContainerAdaptor decoder,
                                     double second)
                              throws IOException,
                                     JCodecException
Get a specified frame by second from an already open demuxer track

Parameters:
vt -
decoder -
frameNumber -
Returns:
Throws:
IOException
JCodecException

getNativeFrameSloppy

public static Picture getNativeFrameSloppy(DemuxerTrack vt,
                                           ContainerAdaptor decoder,
                                           int frameNumber)
                                    throws IOException,
                                           JCodecException
Get a specified frame by number from an already open demuxer track ( sloppy mode, i.e. nearest keyframe )

Parameters:
vt -
decoder -
frameNumber -
Returns:
Throws:
IOException
JCodecException

getNativeFrameSloppy

public static Picture getNativeFrameSloppy(DemuxerTrack vt,
                                           ContainerAdaptor decoder,
                                           double second)
                                    throws IOException,
                                           JCodecException
Get a specified frame by second from an already open demuxer track ( sloppy mode, i.e. nearest keyframe )

Parameters:
vt -
decoder -
frameNumber -
Returns:
Throws:
IOException
JCodecException


Copyright © 2013. All Rights Reserved.