# Class VideoFrame

java.lang.Object
com.codename1.media.VideoFrame

public final class VideoFrame extends Object

A single decoded video frame produced by a `VideoReader`. The pixels are exposed as a Codename One native ARGB `int[]` (the same layout used by `Image#getRGB()` and `Image#createImage(int[], int, int)`), and can also be copied out as a tightly packed RGBA byte array for interoperability with native pixel buffers.

Instances are immutable and safe to hand off between threads.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `VideoFrame(int[] argb, int width, int height, long timestampMillis)`
  Creates a new immutable frame.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int[]`
  `getARGB()`
  The raw pixels of this frame in ARGB order (the Codename One native layout).
  `int`
  `getHeight()`
  The frame height in pixels.
  `void`
  `getRGBA(byte[] dest)`
  Copies the pixels of this frame into the supplied buffer as tightly packed RGBA bytes (`R, G, B, A` per pixel, row major).
  `long`
  `getTimestampMillis()`
  The presentation timestamp of this frame within the source clip in milliseconds.
  `int`
  `getWidth()`
  The frame width in pixels.
  `Image`
  `toImage()`
  Wraps this frame's pixels in a Codename One `Image` for display or further processing.

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### VideoFrame

    public VideoFrame(int[] argb, int width, int height, long timestampMillis)

    Creates a new immutable frame. The supplied array is referenced directly (not copied) and must not be mutated by the caller after construction.

    ###### Parameters

    - `argb`: the pixels in ARGB order, length must equal `width * height`

    - `width`: the frame width in pixels

    - `height`: the frame height in pixels

    - `timestampMillis`: the presentation timestamp of this frame in milliseconds

- ## Method Details

  - ### getTimestampMillis

    public long getTimestampMillis()
    The presentation timestamp of this frame within the source clip in milliseconds.

  - ### getWidth

    public int getWidth()
    The frame width in pixels.

  - ### getHeight

    public int getHeight()
    The frame height in pixels.

  - ### getARGB

    public int[] getARGB()

    The raw pixels of this frame in ARGB order (the Codename One native layout). The returned array is the live backing array; treat it as read-only.

    ###### Returns

    an `int[]` of length `getWidth() * getHeight()`

  - ### getRGBA

    public void getRGBA(byte[] dest)

    Copies the pixels of this frame into the supplied buffer as tightly packed RGBA bytes (`R, G, B, A` per pixel, row major). This is convenient when feeding the frame to native APIs that expect an RGBA byte buffer.

    ###### Parameters

    - `dest`: a buffer of at least `getWidth() * getHeight() * 4` bytes

  - ### toImage

    public Image toImage()

    Wraps this frame's pixels in a Codename One `Image` for display or further processing. A new image is created on every call.

    ###### Returns

    an `Image` containing the frame pixels