CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/maven-org-bytedeco--libdc1394

JavaCPP Presets for libdc1394 - Java bindings for controlling IEEE 1394 (FireWire) digital cameras following IIDC/DCAM specifications

Pending
Overview
Eval results
Files

video-modes.mddocs/

Video Modes and Formats

Video mode configuration with support for standard formats, framerates, and color codings for libdc1394.

Capabilities

Video Mode Control

Controls the camera's video mode, which defines image resolution, color format, and capture characteristics.

/**
 * Gets supported video modes for the camera
 * @param camera Camera instance
 * @param modes Output structure containing supported modes
 * @return DC1394_SUCCESS on success, error code on failure
 */
int dc1394_video_get_supported_modes(dc1394camera_t camera, dc1394video_modes_t modes);

/**
 * Sets the camera's video mode
 * @param camera Camera instance
 * @param video_mode Video mode constant (DC1394_VIDEO_MODE_*)
 * @return DC1394_SUCCESS on success, error code on failure
 */
int dc1394_video_set_mode(dc1394camera_t camera, int video_mode);

/**
 * Gets the current video mode
 * @param camera Camera instance
 * @param video_mode Output parameter for current video mode
 * @return DC1394_SUCCESS on success, error code on failure
 */
int dc1394_video_get_mode(dc1394camera_t camera, IntPointer video_mode);

/**
 * Checks if a video mode is scalable (Format7)
 * @param video_mode Video mode to check
 * @return true if mode is scalable, false otherwise
 */
boolean dc1394_is_video_mode_scalable(int video_mode);

Usage Example:

import org.bytedeco.libdc1394.*;
import static org.bytedeco.libdc1394.global.dc1394.*;

// Get supported video modes
dc1394video_modes_t modes = new dc1394video_modes_t();
int err = dc1394_video_get_supported_modes(camera, modes);
if (err != DC1394_SUCCESS) {
    dc1394_log_error("Failed to get video modes: " + err);
    return;
}

System.out.println("Supported video modes: " + modes.num());
for (int i = 0; i < modes.num(); i++) {
    int mode = modes.modes(i);
    System.out.println("Mode " + i + ": " + mode + 
                      (dc1394_is_video_mode_scalable(mode) ? " (Format7)" : " (Standard)"));
}

// Set 640x480 RGB8 mode
err = dc1394_video_set_mode(camera, DC1394_VIDEO_MODE_640x480_RGB8);
if (err != DC1394_SUCCESS) {
    dc1394_log_error("Failed to set video mode: " + err);
}

Framerate Control

Controls the camera's framerate within the constraints of the selected video mode.

/**
 * Gets supported framerates for current video mode
 * @param camera Camera instance
 * @param framerates Output structure containing supported framerates
 * @return DC1394_SUCCESS on success, error code on failure
 */
int dc1394_video_get_supported_framerates(dc1394camera_t camera, dc1394framerates_t framerates);

/**
 * Sets the camera's framerate
 * @param camera Camera instance
 * @param framerate Framerate constant (DC1394_FRAMERATE_*)
 * @return DC1394_SUCCESS on success, error code on failure
 */
int dc1394_video_set_framerate(dc1394camera_t camera, int framerate);

/**
 * Gets the current framerate
 * @param camera Camera instance
 * @param framerate Output parameter for current framerate
 * @return DC1394_SUCCESS on success, error code on failure
 */
int dc1394_video_get_framerate(dc1394camera_t camera, IntPointer framerate);

/**
 * Converts framerate constant to floating-point value
 * @param framerate Framerate constant
 * @return Framerate as float (frames per second)
 */
float dc1394_framerate_as_float(int framerate);

Usage Example:

// Set video mode first
dc1394_video_set_mode(camera, DC1394_VIDEO_MODE_640x480_RGB8);

// Get supported framerates for this mode
dc1394framerates_t framerates = new dc1394framerates_t();
dc1394_video_get_supported_framerates(camera, framerates);

System.out.println("Supported framerates:");
for (int i = 0; i < framerates.num(); i++) {
    int framerate = framerates.framerates(i);
    float fps = dc1394_framerate_as_float(framerate);
    System.out.println("  " + fps + " fps");
}

// Set 30 fps
dc1394_video_set_framerate(camera, DC1394_FRAMERATE_30);

ISO Speed Control

Controls the IEEE 1394 isochronous speed used for data transmission.

/**
 * Sets the ISO speed for data transmission
 * @param camera Camera instance
 * @param speed ISO speed constant (DC1394_ISO_SPEED_*)
 * @return DC1394_SUCCESS on success, error code on failure
 */
int dc1394_video_set_iso_speed(dc1394camera_t camera, int speed);

/**
 * Gets the current ISO speed
 * @param camera Camera instance
 * @param speed Output parameter for current ISO speed
 * @return DC1394_SUCCESS on success, error code on failure
 */
int dc1394_video_get_iso_speed(dc1394camera_t camera, IntPointer speed);

/**
 * Gets the ISO channel being used
 * @param camera Camera instance
 * @param channel Output parameter for ISO channel
 * @return DC1394_SUCCESS on success, error code on failure
 */
int dc1394_video_get_iso_channel(dc1394camera_t camera, IntPointer channel);

Usage Example:

// Set ISO speed to 400 Mbps (most common)
int err = dc1394_video_set_iso_speed(camera, DC1394_ISO_SPEED_400);
if (err != DC1394_SUCCESS) {
    dc1394_log_error("Failed to set ISO speed: " + err);
}

// Check current ISO settings
IntPointer speed = new IntPointer(1);
IntPointer channel = new IntPointer(1);
dc1394_video_get_iso_speed(camera, speed);
dc1394_video_get_iso_channel(camera, channel);
System.out.println("ISO Speed: " + speed.get() + ", Channel: " + channel.get());

Special Video Modes

Controls special capture modes like one-shot and multi-shot.

/**
 * Triggers one-shot capture
 * @param camera Camera instance
 * @return DC1394_SUCCESS on success, error code on failure
 */
int dc1394_video_set_one_shot(dc1394camera_t camera);

/**
 * Sets multi-shot capture with specified number of frames
 * @param camera Camera instance
 * @param numframes Number of frames to capture
 * @return DC1394_SUCCESS on success, error code on failure
 */
int dc1394_video_set_multi_shot(dc1394camera_t camera, int numframes);

/**
 * Gets multi-shot frame count
 * @param camera Camera instance
 * @param numframes Output parameter for frame count
 * @return DC1394_SUCCESS on success, error code on failure
 */
int dc1394_video_get_multi_shot(dc1394camera_t camera, IntPointer numframes);

Image Size and Color Information

Utility functions for getting image properties from video modes.

/**
 * Gets image dimensions for a video mode
 * @param camera Camera instance
 * @param video_mode Video mode to query
 * @param width Output parameter for image width
 * @param height Output parameter for image height
 * @return DC1394_SUCCESS on success, error code on failure
 */
int dc1394_get_image_size_from_video_mode(dc1394camera_t camera, int video_mode, 
                                         IntPointer width, IntPointer height);

/**
 * Gets color coding from video mode
 * @param camera Camera instance
 * @param video_mode Video mode to query
 * @param color_coding Output parameter for color coding
 * @return DC1394_SUCCESS on success, error code on failure
 */
int dc1394_get_color_coding_from_video_mode(dc1394camera_t camera, int video_mode, 
                                           IntPointer color_coding);

/**
 * Checks if a color coding represents color (vs monochrome) data
 * @param color_coding Color coding to check
 * @return true if color format, false if monochrome
 */
boolean dc1394_is_color(int color_coding);

/**
 * Gets data depth (bits per pixel) for a color coding
 * @param color_coding Color coding to query
 * @return Bits per pixel, or 0 for variable/unknown
 */
int dc1394_get_color_coding_data_depth(int color_coding);

Usage Example:

// Get image properties for current video mode
IntPointer width = new IntPointer(1);
IntPointer height = new IntPointer(1);
IntPointer colorCoding = new IntPointer(1);

dc1394_get_image_size_from_video_mode(camera, DC1394_VIDEO_MODE_640x480_RGB8, width, height);
dc1394_get_color_coding_from_video_mode(camera, DC1394_VIDEO_MODE_640x480_RGB8, colorCoding);

System.out.println("Image size: " + width.get() + "x" + height.get());
System.out.println("Color format: " + (dc1394_is_color(colorCoding.get()) ? "Color" : "Monochrome"));
System.out.println("Bits per pixel: " + dc1394_get_color_coding_data_depth(colorCoding.get()));

Types

Video Mode Lists

/**
 * Container for supported video modes
 */
class dc1394video_modes_t extends Pointer {
    /**
     * Number of supported video modes
     * @return Mode count
     */
    int num();
    
    /**
     * Array of supported video mode constants
     * @param i Mode index
     * @return Video mode constant
     */
    int modes(int i);
}

Framerate Lists

/**
 * Container for supported framerates
 */
class dc1394framerates_t extends Pointer {
    /**
     * Number of supported framerates
     * @return Framerate count
     */
    int num();
    
    /**
     * Array of supported framerate constants
     * @param i Framerate index
     * @return Framerate constant
     */
    int framerates(int i);
}

Color Coding Lists

/**
 * Container for supported color codings (used with Format7)
 */
class dc1394color_codings_t extends Pointer {
    /**
     * Number of supported color codings
     * @return Color coding count
     */
    int num();
    
    /**
     * Array of supported color coding constants
     * @param i Color coding index
     * @return Color coding constant
     */
    int codings(int i);
}

Constants

Standard Video Modes

// 160x120 resolution
static final int DC1394_VIDEO_MODE_160x120_YUV444 = 64;

// 320x240 resolution
static final int DC1394_VIDEO_MODE_320x240_YUV422 = 65;

// 640x480 resolution
static final int DC1394_VIDEO_MODE_640x480_YUV411 = 66;
static final int DC1394_VIDEO_MODE_640x480_YUV422 = 67;
static final int DC1394_VIDEO_MODE_640x480_RGB8 = 68;
static final int DC1394_VIDEO_MODE_640x480_MONO8 = 69;
static final int DC1394_VIDEO_MODE_640x480_MONO16 = 70;

// 800x600 resolution
static final int DC1394_VIDEO_MODE_800x600_YUV422 = 71;
static final int DC1394_VIDEO_MODE_800x600_RGB8 = 72;
static final int DC1394_VIDEO_MODE_800x600_MONO8 = 73;
static final int DC1394_VIDEO_MODE_800x600_MONO16 = 77;

// 1024x768 resolution
static final int DC1394_VIDEO_MODE_1024x768_YUV422 = 74;
static final int DC1394_VIDEO_MODE_1024x768_RGB8 = 75;
static final int DC1394_VIDEO_MODE_1024x768_MONO8 = 76;
static final int DC1394_VIDEO_MODE_1024x768_MONO16 = 78;

// 1280x960 resolution
static final int DC1394_VIDEO_MODE_1280x960_YUV422 = 79;
static final int DC1394_VIDEO_MODE_1280x960_RGB8 = 80;
static final int DC1394_VIDEO_MODE_1280x960_MONO8 = 81;
static final int DC1394_VIDEO_MODE_1280x960_MONO16 = 85;

// 1600x1200 resolution
static final int DC1394_VIDEO_MODE_1600x1200_YUV422 = 82;
static final int DC1394_VIDEO_MODE_1600x1200_RGB8 = 83;
static final int DC1394_VIDEO_MODE_1600x1200_MONO8 = 84;
static final int DC1394_VIDEO_MODE_1600x1200_MONO16 = 86;

// Special modes
static final int DC1394_VIDEO_MODE_EXIF = 87;

Format7 Video Modes

// Format7 (scalable) modes
static final int DC1394_VIDEO_MODE_FORMAT7_0 = 88;
static final int DC1394_VIDEO_MODE_FORMAT7_1 = 89;
static final int DC1394_VIDEO_MODE_FORMAT7_2 = 90;
static final int DC1394_VIDEO_MODE_FORMAT7_3 = 91;
static final int DC1394_VIDEO_MODE_FORMAT7_4 = 92;
static final int DC1394_VIDEO_MODE_FORMAT7_5 = 93;
static final int DC1394_VIDEO_MODE_FORMAT7_6 = 94;
static final int DC1394_VIDEO_MODE_FORMAT7_7 = 95;

// Video mode range
static final int DC1394_VIDEO_MODE_MIN = DC1394_VIDEO_MODE_160x120_YUV444;
static final int DC1394_VIDEO_MODE_MAX = DC1394_VIDEO_MODE_FORMAT7_7;
static final int DC1394_VIDEO_MODE_NUM = (DC1394_VIDEO_MODE_MAX - DC1394_VIDEO_MODE_MIN + 1);

Color Coding Formats

// Monochrome formats
static final int DC1394_COLOR_CODING_MONO8 = 352;   // 8-bit monochrome
static final int DC1394_COLOR_CODING_MONO16 = 358;  // 16-bit monochrome
static final int DC1394_COLOR_CODING_MONO16S = 359; // 16-bit signed monochrome

// YUV formats
static final int DC1394_COLOR_CODING_YUV411 = 353;  // YUV 4:1:1
static final int DC1394_COLOR_CODING_YUV422 = 354;  // YUV 4:2:2
static final int DC1394_COLOR_CODING_YUV444 = 355;  // YUV 4:4:4

// RGB formats
static final int DC1394_COLOR_CODING_RGB8 = 357;    // 8-bit RGB (24-bit total)
static final int DC1394_COLOR_CODING_RGB16 = 356;   // 16-bit RGB (48-bit total)
static final int DC1394_COLOR_CODING_RGB16S = 364;  // 16-bit signed RGB

// Raw Bayer formats
static final int DC1394_COLOR_CODING_RAW8 = 360;    // 8-bit Bayer pattern
static final int DC1394_COLOR_CODING_RAW16 = 361;   // 16-bit Bayer pattern

// Color coding range
static final int DC1394_COLOR_CODING_MIN = DC1394_COLOR_CODING_MONO8;
static final int DC1394_COLOR_CODING_MAX = DC1394_COLOR_CODING_RGB16S;

Framerate Constants

// Standard framerates (frames per second)
static final int DC1394_FRAMERATE_1_875 = 32;  // 1.875 fps
static final int DC1394_FRAMERATE_3_75 = 33;   // 3.75 fps
static final int DC1394_FRAMERATE_7_5 = 34;    // 7.5 fps
static final int DC1394_FRAMERATE_15 = 35;     // 15 fps
static final int DC1394_FRAMERATE_30 = 36;     // 30 fps
static final int DC1394_FRAMERATE_60 = 37;     // 60 fps
static final int DC1394_FRAMERATE_120 = 38;    // 120 fps
static final int DC1394_FRAMERATE_240 = 39;    // 240 fps

// Framerate range
static final int DC1394_FRAMERATE_MIN = DC1394_FRAMERATE_1_875;
static final int DC1394_FRAMERATE_MAX = DC1394_FRAMERATE_240;
static final int DC1394_FRAMERATE_NUM = (DC1394_FRAMERATE_MAX - DC1394_FRAMERATE_MIN + 1);

ISO Speed Constants

// IEEE 1394 isochronous speeds (Mbps)
static final int DC1394_ISO_SPEED_100 = 0;   // 100 Mbps
static final int DC1394_ISO_SPEED_200 = 1;   // 200 Mbps
static final int DC1394_ISO_SPEED_400 = 2;   // 400 Mbps (most common)
static final int DC1394_ISO_SPEED_800 = 3;   // 800 Mbps
static final int DC1394_ISO_SPEED_1600 = 4;  // 1600 Mbps
static final int DC1394_ISO_SPEED_3200 = 5;  // 3200 Mbps

// ISO speed range
static final int DC1394_ISO_SPEED_MIN = DC1394_ISO_SPEED_100;
static final int DC1394_ISO_SPEED_MAX = DC1394_ISO_SPEED_3200;
static final int DC1394_ISO_SPEED_NUM = (DC1394_ISO_SPEED_MAX - DC1394_ISO_SPEED_MIN + 1);

Video Mode Selection Guidelines

Resolution and Performance

  • Lower resolutions (160x120, 320x240): Higher framerates possible
  • Medium resolutions (640x480, 800x600): Good balance of quality and performance
  • High resolutions (1280x960, 1600x1200): Best quality but lower framerates

Color Format Selection

  • RGB8: Direct color output, 3 bytes per pixel, no conversion needed
  • YUV422: Efficient color format, good for video applications
  • MONO8/MONO16: Monochrome formats, fastest processing
  • RAW8/RAW16: Bayer pattern, requires demosaicing but best quality

ISO Speed Considerations

  • 100-200 Mbps: Sufficient for lower resolutions and framerates
  • 400 Mbps: Most commonly used, good for standard applications
  • 800+ Mbps: Required for high resolution at high framerates

Common Video Mode Configurations

High-Speed Monitoring

// Fast frame rate for motion capture
dc1394_video_set_mode(camera, DC1394_VIDEO_MODE_320x240_YUV422);
dc1394_video_set_framerate(camera, DC1394_FRAMERATE_120);
dc1394_video_set_iso_speed(camera, DC1394_ISO_SPEED_400);

High-Quality Imaging

// High resolution for detailed imaging
dc1394_video_set_mode(camera, DC1394_VIDEO_MODE_1600x1200_RGB8);
dc1394_video_set_framerate(camera, DC1394_FRAMERATE_7_5);
dc1394_video_set_iso_speed(camera, DC1394_ISO_SPEED_800);

Raw Image Capture

// Raw Bayer for maximum image quality
dc1394_video_set_mode(camera, DC1394_VIDEO_MODE_1024x768_MONO8); // Often RAW8
dc1394_video_set_framerate(camera, DC1394_FRAMERATE_15);
dc1394_video_set_iso_speed(camera, DC1394_ISO_SPEED_400);

Video Streaming

// Balanced settings for video applications
dc1394_video_set_mode(camera, DC1394_VIDEO_MODE_640x480_YUV422);
dc1394_video_set_framerate(camera, DC1394_FRAMERATE_30);
dc1394_video_set_iso_speed(camera, DC1394_ISO_SPEED_400);

Install with Tessl CLI

npx tessl i tessl/maven-org-bytedeco--libdc1394

docs

camera-features.md

format7.md

image-conversion.md

index.md

iso-resource-management.md

logging.md

system-management.md

trigger-control.md

utility-functions.md

video-capture.md

video-modes.md

tile.json