0
# Video Modes and Formats
1
2
Video mode configuration with support for standard formats, framerates, and color codings for libdc1394.
3
4
## Capabilities
5
6
### Video Mode Control
7
8
Controls the camera's video mode, which defines image resolution, color format, and capture characteristics.
9
10
```java { .api }
11
/**
12
* Gets supported video modes for the camera
13
* @param camera Camera instance
14
* @param modes Output structure containing supported modes
15
* @return DC1394_SUCCESS on success, error code on failure
16
*/
17
int dc1394_video_get_supported_modes(dc1394camera_t camera, dc1394video_modes_t modes);
18
19
/**
20
* Sets the camera's video mode
21
* @param camera Camera instance
22
* @param video_mode Video mode constant (DC1394_VIDEO_MODE_*)
23
* @return DC1394_SUCCESS on success, error code on failure
24
*/
25
int dc1394_video_set_mode(dc1394camera_t camera, int video_mode);
26
27
/**
28
* Gets the current video mode
29
* @param camera Camera instance
30
* @param video_mode Output parameter for current video mode
31
* @return DC1394_SUCCESS on success, error code on failure
32
*/
33
int dc1394_video_get_mode(dc1394camera_t camera, IntPointer video_mode);
34
35
/**
36
* Checks if a video mode is scalable (Format7)
37
* @param video_mode Video mode to check
38
* @return true if mode is scalable, false otherwise
39
*/
40
boolean dc1394_is_video_mode_scalable(int video_mode);
41
```
42
43
**Usage Example:**
44
45
```java
46
import org.bytedeco.libdc1394.*;
47
import static org.bytedeco.libdc1394.global.dc1394.*;
48
49
// Get supported video modes
50
dc1394video_modes_t modes = new dc1394video_modes_t();
51
int err = dc1394_video_get_supported_modes(camera, modes);
52
if (err != DC1394_SUCCESS) {
53
dc1394_log_error("Failed to get video modes: " + err);
54
return;
55
}
56
57
System.out.println("Supported video modes: " + modes.num());
58
for (int i = 0; i < modes.num(); i++) {
59
int mode = modes.modes(i);
60
System.out.println("Mode " + i + ": " + mode +
61
(dc1394_is_video_mode_scalable(mode) ? " (Format7)" : " (Standard)"));
62
}
63
64
// Set 640x480 RGB8 mode
65
err = dc1394_video_set_mode(camera, DC1394_VIDEO_MODE_640x480_RGB8);
66
if (err != DC1394_SUCCESS) {
67
dc1394_log_error("Failed to set video mode: " + err);
68
}
69
```
70
71
### Framerate Control
72
73
Controls the camera's framerate within the constraints of the selected video mode.
74
75
```java { .api }
76
/**
77
* Gets supported framerates for current video mode
78
* @param camera Camera instance
79
* @param framerates Output structure containing supported framerates
80
* @return DC1394_SUCCESS on success, error code on failure
81
*/
82
int dc1394_video_get_supported_framerates(dc1394camera_t camera, dc1394framerates_t framerates);
83
84
/**
85
* Sets the camera's framerate
86
* @param camera Camera instance
87
* @param framerate Framerate constant (DC1394_FRAMERATE_*)
88
* @return DC1394_SUCCESS on success, error code on failure
89
*/
90
int dc1394_video_set_framerate(dc1394camera_t camera, int framerate);
91
92
/**
93
* Gets the current framerate
94
* @param camera Camera instance
95
* @param framerate Output parameter for current framerate
96
* @return DC1394_SUCCESS on success, error code on failure
97
*/
98
int dc1394_video_get_framerate(dc1394camera_t camera, IntPointer framerate);
99
100
/**
101
* Converts framerate constant to floating-point value
102
* @param framerate Framerate constant
103
* @return Framerate as float (frames per second)
104
*/
105
float dc1394_framerate_as_float(int framerate);
106
```
107
108
**Usage Example:**
109
110
```java
111
// Set video mode first
112
dc1394_video_set_mode(camera, DC1394_VIDEO_MODE_640x480_RGB8);
113
114
// Get supported framerates for this mode
115
dc1394framerates_t framerates = new dc1394framerates_t();
116
dc1394_video_get_supported_framerates(camera, framerates);
117
118
System.out.println("Supported framerates:");
119
for (int i = 0; i < framerates.num(); i++) {
120
int framerate = framerates.framerates(i);
121
float fps = dc1394_framerate_as_float(framerate);
122
System.out.println(" " + fps + " fps");
123
}
124
125
// Set 30 fps
126
dc1394_video_set_framerate(camera, DC1394_FRAMERATE_30);
127
```
128
129
### ISO Speed Control
130
131
Controls the IEEE 1394 isochronous speed used for data transmission.
132
133
```java { .api }
134
/**
135
* Sets the ISO speed for data transmission
136
* @param camera Camera instance
137
* @param speed ISO speed constant (DC1394_ISO_SPEED_*)
138
* @return DC1394_SUCCESS on success, error code on failure
139
*/
140
int dc1394_video_set_iso_speed(dc1394camera_t camera, int speed);
141
142
/**
143
* Gets the current ISO speed
144
* @param camera Camera instance
145
* @param speed Output parameter for current ISO speed
146
* @return DC1394_SUCCESS on success, error code on failure
147
*/
148
int dc1394_video_get_iso_speed(dc1394camera_t camera, IntPointer speed);
149
150
/**
151
* Gets the ISO channel being used
152
* @param camera Camera instance
153
* @param channel Output parameter for ISO channel
154
* @return DC1394_SUCCESS on success, error code on failure
155
*/
156
int dc1394_video_get_iso_channel(dc1394camera_t camera, IntPointer channel);
157
```
158
159
**Usage Example:**
160
161
```java
162
// Set ISO speed to 400 Mbps (most common)
163
int err = dc1394_video_set_iso_speed(camera, DC1394_ISO_SPEED_400);
164
if (err != DC1394_SUCCESS) {
165
dc1394_log_error("Failed to set ISO speed: " + err);
166
}
167
168
// Check current ISO settings
169
IntPointer speed = new IntPointer(1);
170
IntPointer channel = new IntPointer(1);
171
dc1394_video_get_iso_speed(camera, speed);
172
dc1394_video_get_iso_channel(camera, channel);
173
System.out.println("ISO Speed: " + speed.get() + ", Channel: " + channel.get());
174
```
175
176
### Special Video Modes
177
178
Controls special capture modes like one-shot and multi-shot.
179
180
```java { .api }
181
/**
182
* Triggers one-shot capture
183
* @param camera Camera instance
184
* @return DC1394_SUCCESS on success, error code on failure
185
*/
186
int dc1394_video_set_one_shot(dc1394camera_t camera);
187
188
/**
189
* Sets multi-shot capture with specified number of frames
190
* @param camera Camera instance
191
* @param numframes Number of frames to capture
192
* @return DC1394_SUCCESS on success, error code on failure
193
*/
194
int dc1394_video_set_multi_shot(dc1394camera_t camera, int numframes);
195
196
/**
197
* Gets multi-shot frame count
198
* @param camera Camera instance
199
* @param numframes Output parameter for frame count
200
* @return DC1394_SUCCESS on success, error code on failure
201
*/
202
int dc1394_video_get_multi_shot(dc1394camera_t camera, IntPointer numframes);
203
```
204
205
### Image Size and Color Information
206
207
Utility functions for getting image properties from video modes.
208
209
```java { .api }
210
/**
211
* Gets image dimensions for a video mode
212
* @param camera Camera instance
213
* @param video_mode Video mode to query
214
* @param width Output parameter for image width
215
* @param height Output parameter for image height
216
* @return DC1394_SUCCESS on success, error code on failure
217
*/
218
int dc1394_get_image_size_from_video_mode(dc1394camera_t camera, int video_mode,
219
IntPointer width, IntPointer height);
220
221
/**
222
* Gets color coding from video mode
223
* @param camera Camera instance
224
* @param video_mode Video mode to query
225
* @param color_coding Output parameter for color coding
226
* @return DC1394_SUCCESS on success, error code on failure
227
*/
228
int dc1394_get_color_coding_from_video_mode(dc1394camera_t camera, int video_mode,
229
IntPointer color_coding);
230
231
/**
232
* Checks if a color coding represents color (vs monochrome) data
233
* @param color_coding Color coding to check
234
* @return true if color format, false if monochrome
235
*/
236
boolean dc1394_is_color(int color_coding);
237
238
/**
239
* Gets data depth (bits per pixel) for a color coding
240
* @param color_coding Color coding to query
241
* @return Bits per pixel, or 0 for variable/unknown
242
*/
243
int dc1394_get_color_coding_data_depth(int color_coding);
244
```
245
246
**Usage Example:**
247
248
```java
249
// Get image properties for current video mode
250
IntPointer width = new IntPointer(1);
251
IntPointer height = new IntPointer(1);
252
IntPointer colorCoding = new IntPointer(1);
253
254
dc1394_get_image_size_from_video_mode(camera, DC1394_VIDEO_MODE_640x480_RGB8, width, height);
255
dc1394_get_color_coding_from_video_mode(camera, DC1394_VIDEO_MODE_640x480_RGB8, colorCoding);
256
257
System.out.println("Image size: " + width.get() + "x" + height.get());
258
System.out.println("Color format: " + (dc1394_is_color(colorCoding.get()) ? "Color" : "Monochrome"));
259
System.out.println("Bits per pixel: " + dc1394_get_color_coding_data_depth(colorCoding.get()));
260
```
261
262
## Types
263
264
### Video Mode Lists
265
266
```java { .api }
267
/**
268
* Container for supported video modes
269
*/
270
class dc1394video_modes_t extends Pointer {
271
/**
272
* Number of supported video modes
273
* @return Mode count
274
*/
275
int num();
276
277
/**
278
* Array of supported video mode constants
279
* @param i Mode index
280
* @return Video mode constant
281
*/
282
int modes(int i);
283
}
284
```
285
286
### Framerate Lists
287
288
```java { .api }
289
/**
290
* Container for supported framerates
291
*/
292
class dc1394framerates_t extends Pointer {
293
/**
294
* Number of supported framerates
295
* @return Framerate count
296
*/
297
int num();
298
299
/**
300
* Array of supported framerate constants
301
* @param i Framerate index
302
* @return Framerate constant
303
*/
304
int framerates(int i);
305
}
306
```
307
308
### Color Coding Lists
309
310
```java { .api }
311
/**
312
* Container for supported color codings (used with Format7)
313
*/
314
class dc1394color_codings_t extends Pointer {
315
/**
316
* Number of supported color codings
317
* @return Color coding count
318
*/
319
int num();
320
321
/**
322
* Array of supported color coding constants
323
* @param i Color coding index
324
* @return Color coding constant
325
*/
326
int codings(int i);
327
}
328
```
329
330
## Constants
331
332
### Standard Video Modes
333
334
```java { .api }
335
// 160x120 resolution
336
static final int DC1394_VIDEO_MODE_160x120_YUV444 = 64;
337
338
// 320x240 resolution
339
static final int DC1394_VIDEO_MODE_320x240_YUV422 = 65;
340
341
// 640x480 resolution
342
static final int DC1394_VIDEO_MODE_640x480_YUV411 = 66;
343
static final int DC1394_VIDEO_MODE_640x480_YUV422 = 67;
344
static final int DC1394_VIDEO_MODE_640x480_RGB8 = 68;
345
static final int DC1394_VIDEO_MODE_640x480_MONO8 = 69;
346
static final int DC1394_VIDEO_MODE_640x480_MONO16 = 70;
347
348
// 800x600 resolution
349
static final int DC1394_VIDEO_MODE_800x600_YUV422 = 71;
350
static final int DC1394_VIDEO_MODE_800x600_RGB8 = 72;
351
static final int DC1394_VIDEO_MODE_800x600_MONO8 = 73;
352
static final int DC1394_VIDEO_MODE_800x600_MONO16 = 77;
353
354
// 1024x768 resolution
355
static final int DC1394_VIDEO_MODE_1024x768_YUV422 = 74;
356
static final int DC1394_VIDEO_MODE_1024x768_RGB8 = 75;
357
static final int DC1394_VIDEO_MODE_1024x768_MONO8 = 76;
358
static final int DC1394_VIDEO_MODE_1024x768_MONO16 = 78;
359
360
// 1280x960 resolution
361
static final int DC1394_VIDEO_MODE_1280x960_YUV422 = 79;
362
static final int DC1394_VIDEO_MODE_1280x960_RGB8 = 80;
363
static final int DC1394_VIDEO_MODE_1280x960_MONO8 = 81;
364
static final int DC1394_VIDEO_MODE_1280x960_MONO16 = 85;
365
366
// 1600x1200 resolution
367
static final int DC1394_VIDEO_MODE_1600x1200_YUV422 = 82;
368
static final int DC1394_VIDEO_MODE_1600x1200_RGB8 = 83;
369
static final int DC1394_VIDEO_MODE_1600x1200_MONO8 = 84;
370
static final int DC1394_VIDEO_MODE_1600x1200_MONO16 = 86;
371
372
// Special modes
373
static final int DC1394_VIDEO_MODE_EXIF = 87;
374
```
375
376
### Format7 Video Modes
377
378
```java { .api }
379
// Format7 (scalable) modes
380
static final int DC1394_VIDEO_MODE_FORMAT7_0 = 88;
381
static final int DC1394_VIDEO_MODE_FORMAT7_1 = 89;
382
static final int DC1394_VIDEO_MODE_FORMAT7_2 = 90;
383
static final int DC1394_VIDEO_MODE_FORMAT7_3 = 91;
384
static final int DC1394_VIDEO_MODE_FORMAT7_4 = 92;
385
static final int DC1394_VIDEO_MODE_FORMAT7_5 = 93;
386
static final int DC1394_VIDEO_MODE_FORMAT7_6 = 94;
387
static final int DC1394_VIDEO_MODE_FORMAT7_7 = 95;
388
389
// Video mode range
390
static final int DC1394_VIDEO_MODE_MIN = DC1394_VIDEO_MODE_160x120_YUV444;
391
static final int DC1394_VIDEO_MODE_MAX = DC1394_VIDEO_MODE_FORMAT7_7;
392
static final int DC1394_VIDEO_MODE_NUM = (DC1394_VIDEO_MODE_MAX - DC1394_VIDEO_MODE_MIN + 1);
393
```
394
395
### Color Coding Formats
396
397
```java { .api }
398
// Monochrome formats
399
static final int DC1394_COLOR_CODING_MONO8 = 352; // 8-bit monochrome
400
static final int DC1394_COLOR_CODING_MONO16 = 358; // 16-bit monochrome
401
static final int DC1394_COLOR_CODING_MONO16S = 359; // 16-bit signed monochrome
402
403
// YUV formats
404
static final int DC1394_COLOR_CODING_YUV411 = 353; // YUV 4:1:1
405
static final int DC1394_COLOR_CODING_YUV422 = 354; // YUV 4:2:2
406
static final int DC1394_COLOR_CODING_YUV444 = 355; // YUV 4:4:4
407
408
// RGB formats
409
static final int DC1394_COLOR_CODING_RGB8 = 357; // 8-bit RGB (24-bit total)
410
static final int DC1394_COLOR_CODING_RGB16 = 356; // 16-bit RGB (48-bit total)
411
static final int DC1394_COLOR_CODING_RGB16S = 364; // 16-bit signed RGB
412
413
// Raw Bayer formats
414
static final int DC1394_COLOR_CODING_RAW8 = 360; // 8-bit Bayer pattern
415
static final int DC1394_COLOR_CODING_RAW16 = 361; // 16-bit Bayer pattern
416
417
// Color coding range
418
static final int DC1394_COLOR_CODING_MIN = DC1394_COLOR_CODING_MONO8;
419
static final int DC1394_COLOR_CODING_MAX = DC1394_COLOR_CODING_RGB16S;
420
```
421
422
### Framerate Constants
423
424
```java { .api }
425
// Standard framerates (frames per second)
426
static final int DC1394_FRAMERATE_1_875 = 32; // 1.875 fps
427
static final int DC1394_FRAMERATE_3_75 = 33; // 3.75 fps
428
static final int DC1394_FRAMERATE_7_5 = 34; // 7.5 fps
429
static final int DC1394_FRAMERATE_15 = 35; // 15 fps
430
static final int DC1394_FRAMERATE_30 = 36; // 30 fps
431
static final int DC1394_FRAMERATE_60 = 37; // 60 fps
432
static final int DC1394_FRAMERATE_120 = 38; // 120 fps
433
static final int DC1394_FRAMERATE_240 = 39; // 240 fps
434
435
// Framerate range
436
static final int DC1394_FRAMERATE_MIN = DC1394_FRAMERATE_1_875;
437
static final int DC1394_FRAMERATE_MAX = DC1394_FRAMERATE_240;
438
static final int DC1394_FRAMERATE_NUM = (DC1394_FRAMERATE_MAX - DC1394_FRAMERATE_MIN + 1);
439
```
440
441
### ISO Speed Constants
442
443
```java { .api }
444
// IEEE 1394 isochronous speeds (Mbps)
445
static final int DC1394_ISO_SPEED_100 = 0; // 100 Mbps
446
static final int DC1394_ISO_SPEED_200 = 1; // 200 Mbps
447
static final int DC1394_ISO_SPEED_400 = 2; // 400 Mbps (most common)
448
static final int DC1394_ISO_SPEED_800 = 3; // 800 Mbps
449
static final int DC1394_ISO_SPEED_1600 = 4; // 1600 Mbps
450
static final int DC1394_ISO_SPEED_3200 = 5; // 3200 Mbps
451
452
// ISO speed range
453
static final int DC1394_ISO_SPEED_MIN = DC1394_ISO_SPEED_100;
454
static final int DC1394_ISO_SPEED_MAX = DC1394_ISO_SPEED_3200;
455
static final int DC1394_ISO_SPEED_NUM = (DC1394_ISO_SPEED_MAX - DC1394_ISO_SPEED_MIN + 1);
456
```
457
458
## Video Mode Selection Guidelines
459
460
### Resolution and Performance
461
462
- **Lower resolutions** (160x120, 320x240): Higher framerates possible
463
- **Medium resolutions** (640x480, 800x600): Good balance of quality and performance
464
- **High resolutions** (1280x960, 1600x1200): Best quality but lower framerates
465
466
### Color Format Selection
467
468
- **RGB8**: Direct color output, 3 bytes per pixel, no conversion needed
469
- **YUV422**: Efficient color format, good for video applications
470
- **MONO8/MONO16**: Monochrome formats, fastest processing
471
- **RAW8/RAW16**: Bayer pattern, requires demosaicing but best quality
472
473
### ISO Speed Considerations
474
475
- **100-200 Mbps**: Sufficient for lower resolutions and framerates
476
- **400 Mbps**: Most commonly used, good for standard applications
477
- **800+ Mbps**: Required for high resolution at high framerates
478
479
## Common Video Mode Configurations
480
481
### High-Speed Monitoring
482
483
```java
484
// Fast frame rate for motion capture
485
dc1394_video_set_mode(camera, DC1394_VIDEO_MODE_320x240_YUV422);
486
dc1394_video_set_framerate(camera, DC1394_FRAMERATE_120);
487
dc1394_video_set_iso_speed(camera, DC1394_ISO_SPEED_400);
488
```
489
490
### High-Quality Imaging
491
492
```java
493
// High resolution for detailed imaging
494
dc1394_video_set_mode(camera, DC1394_VIDEO_MODE_1600x1200_RGB8);
495
dc1394_video_set_framerate(camera, DC1394_FRAMERATE_7_5);
496
dc1394_video_set_iso_speed(camera, DC1394_ISO_SPEED_800);
497
```
498
499
### Raw Image Capture
500
501
```java
502
// Raw Bayer for maximum image quality
503
dc1394_video_set_mode(camera, DC1394_VIDEO_MODE_1024x768_MONO8); // Often RAW8
504
dc1394_video_set_framerate(camera, DC1394_FRAMERATE_15);
505
dc1394_video_set_iso_speed(camera, DC1394_ISO_SPEED_400);
506
```
507
508
### Video Streaming
509
510
```java
511
// Balanced settings for video applications
512
dc1394_video_set_mode(camera, DC1394_VIDEO_MODE_640x480_YUV422);
513
dc1394_video_set_framerate(camera, DC1394_FRAMERATE_30);
514
dc1394_video_set_iso_speed(camera, DC1394_ISO_SPEED_400);
515
```