OptrisOptrisDocumentation

Documentation/OTC SDK/OTC SDK — C++ API referencev12.0

optris::sdk::rec::GlobalConfig

Controls the MKV container-level settings. Pass to Recorder::Create() before adding streams.

Public attributes

output_path

std::string output_path

Output file path (.mkv extension recommended).

max_segment_duration_sec

uint32_t max_segment_duration_sec = 0

Maximum segment duration in seconds. When exceeded, the recorder closes the current file and starts a new one. Set to 0 (default) to disable segmentation.

Segments are named after output_path with _part000, _part001, _part002 and so on before the extension. Every part carries a suffix, the first one included, so run.mkv with a segment limit writes run_part000.mkv and nothing is written at run.mkv. The number is the same number as series.part in otc-meta.json, so the two never disagree.

This changed in API version 24 and it breaks callers that reopened the path they passed. The first file used to keep the path exactly as given. An application that hands over run.mkv and then opens run.mkv now finds nothing; it must either open run_part000.mkv, or ask rec::OpenSeries() for the parts, or read the path out of the RecordingPhase::kSegmentCompleted notification. With no segment limit the path is still kept exactly as given -- one whole file is not a part of anything -- so only recordings that asked to roll over are affected.

Every segment carries the full metadata and every attachment, because a segment is a file someone can be handed on its own, and one that cannot say which camera produced it is not much use. The attachment provider is asked again for each, so an application can vary what it attaches as a long recording runs.

max_segment_bytes

uint64_t max_segment_bytes = 0

Maximum size of one segment file in bytes. When the next frame would carry the file past this, the recorder closes it and opens the next one. Set to 0 (default) to disable size segmentation.

The point of it is a destination that caps a single file: a long lossless recording of a 640x480 sensor passes 4 GiB in well under an hour, and without a size limit the recording simply dies at whatever boundary the destination has. Set it a little below that cap -- the SDK does not presume to know what it is.

A ceiling for the finished file, trailer included. See RecordingOptions::max_segment_bytes: the recorder rolls over while what the part will hold still fits, the open Cluster, the interleaving queue, the frame being written and the Cues included. Setting it "a little below the filesystem's limit" is therefore belt and braces rather than a requirement.

Naming, metadata and attachments work exactly as for duration segmentation, and the two can be used together: whichever triggers first rolls the file over.

use_fixed_framerate

bool use_fixed_framerate = false

When true, timestamps are derived from frame_rate rather than the SDK's FrameMetadata timestamps.

write_preview

bool write_preview = true

Write a cover image into every file this recording produces.

A recording's video track is sixteen-bit temperatures, not a picture. Opened in a player or a file manager it looks like a black rectangle or like noise, and nothing distinguishes a healthy recording from a broken one. The cover is a colorized still of the frame the file opens on (drawn with the palette and colour scale the recording itself recorded), with a notice across the bottom saying the file holds raw temperature data.

It goes in as a Matroska attachment named cover.jpg, which is that format's own cover-art convention: players and file managers already look for it, and an FFmpeg-based reader presents it as a one-frame video track marked "attached pic", which is what makes it unmistakable for the measurement.

Costs one JPEG per file: tens of kilobytes, measured in RecordingPreviewTest.CoverCostsLessThanOneFrame. Set false to write files byte-identical to those from before this existed.

A recording that never receives a frame gets no cover: the container's header, which is where attachments live, goes down when the first frame arrives, and there is no picture to draw before then.

The cover's subject is chosen, not taken: The cover's subject is chosen, not taken A camera delivers a frame or two before its first internal calibration has a reference, and those are not pictures of anything, measured as a flat 125 C across the sensor in a room at 25 C. So the recorder looks a short way ahead, at most six frames or 400 ms of capture time, and draws the cover from the first frame that shows the scene.

No frame is held back from the file. Everything the look-ahead sees is written, in order, the moment it resolves: on a good subject, on the bound, or on Stop(). WriteFrame() returns success for a held frame because the frame will be written. The only thing that lags is GetBytesWritten(), which reports nothing until the header goes down and then catches up in one step.

With this false the look-ahead is never entered and the write path is the one it has always been.

preview_quality

int preview_quality = 6

Cover quality, 2 (best) to 31 (worst), as FFmpeg's mjpeg encoder scales it. The default trades about 30 KB against a notice that stays crisp.