optris::sdk::rec::VideoExportConfig
How to write the video: where, how big, how fast, in what codec, and what the frames handed over will be.
Three of these have no sensible default and are refused when left at zero -- see width. Everything else carries the SDK's own default, so a config with only output_path, width, height and frame_rate set writes a Motion JPEG radiometric export: in a .mkv file with every temperature kept on a lossless track beside the Motion JPEG one, and in an MP4, MOV or WebM file the Motion JPEG picture only, which does not keep them (VideoContent::kRadiometric).
Public attributes
output_path
std::string output_path
Output file path. Required.
width
uint32_t width = 0
Frame width in pixels.
Zero, which Create() refuses by name. These three are initialised deliberately: a VideoExportConfig declared and then partly filled -- which is how every example in this header uses it -- would otherwise carry whatever the stack happened to hold for whichever field the caller did not set.
height
uint32_t height = 0
Frame height in pixels. See width.
frame_rate
float frame_rate = 0.0F
Output frame rate in Hz. See width.
codec
VideoCodec codec = VideoCodec::kMjpeg
Codec to use. Default: MJPEG, because it is the only one that is certainly there.
This defaulted to kH264, which meant a default-constructed config asked for an encoder that does not exist in the build this SDK ships on Windows -- that one is deliberately LGPL (ci/platform/windows_fetch_ffmpeg.ps1) and x264 is GPL. The zero-configuration path was the one that failed, and it failed only on the delivered platform. MJPEG is native to FFmpeg and present in every build, so the default now works everywhere and a caller who wants a better ratio asks for it and can check with IsCodecAvailable() first.
content
VideoContent content = VideoContent::kRadiometric
What WriteFrame() will be handed. kRadiometric keeps every existing caller's meaning. Whether the temperatures survive is VideoExporter::KeepsTemperatures().
preset
VideoPreset preset = VideoPreset::kMedium
Encoding speed preset. Default: medium.
bitrate_kbps
int bitrate_kbps = 0
Target bitrate in kbps. 0 = auto/CRF mode: a quality, not a size.
At 0, the default, each lossy encoder (H.264, H.265, VP9, AV1) runs in its own constant-quality mode, at a value measured to give the same quality on every encoder, and the file is as large as the pictures need. Above 0 the encoder aims at this bitrate instead. MJPEG ignores it (see mjpeg_quality), and FFV1 is lossless.
mjpeg_quality
int mjpeg_quality = 4
MJPEG quality, 2 (best) to 31 (worst). Ignored by other codecs.
One integer that visibly trades picture for size. Measured on a 160x120 colorized export with gradients, edges and grain: 2 wrote 182 KB at 40.0 dB luma PSNR, 4 wrote 113 KB at 35.9 dB, and 31 wrote 28 KB at 30.5 dB.
At 640x480, over 300 colorized pictures, as file size, luma PSNR and mean luma error (of 255 levels):
- a smooth gradient: 2 wrote 5.67 MB (53.9 dB, 0.41), 3 wrote 4.84 MB (53.7 dB, 0.42), 4 wrote 4.13 MB (53.4 dB, 0.43);
- a hot spot: 2 wrote 3.58 MB (48.3 dB, 0.82), 3 wrote 2.87 MB (48.3 dB, 0.83), 4 wrote 2.63 MB (48.2 dB, 0.84);
- noise in every pixel: 2 wrote 170.6 MB (39.4 dB, 2.18), 3 wrote 148.9 MB (35.8 dB, 3.27), 4 wrote 133.4 MB (33.2 dB, 4.42).
So 2 costs 28 % to 37 % more file than 4, and what it buys grows with the detail in the picture: next to nothing on a smooth scene, half the error on a noisy one. In a radiometric Matroska export the number reaches only the packed picture: the lossless track that holds the temperatures is the same at every quality.
Before 12.0.27 every value wrote what 2 writes, because the number never reached the encoder. Set it. This initialiser stays 4 because it is compiled into every C++ program built against this header, so changing it in a 12.0.x release changes nothing for a program already built and is a break for the API gate; a C++ program that leaves it alone is now written at 4. The C interface's optris_sdk_video_export_config_init(), and through it the C#, Python and Rust packages, default to 2, which is what every export they made was written at.
temp_min_c
float temp_min_c = 20.0f
Temperature range for colorization (reserved for future use), in the SDK's temperature unit (Celsius unless SetTemperatureUnit() chose Fahrenheit). The defaults, 20 and 40, are compile-time Celsius numbers.
Neither is read today: colorizing is the caller's, which is what VideoContent::kColorized means.
temp_max_c
float temp_max_c = 40.0f
The other end of the reserved range. See temp_min_c.
pace_by_arrival
bool pace_by_arrival = false
Time each frame by when it ARRIVES, not by how many came before.
Off by default, which is right for an export: a converter feeds a file's frames as fast as it can read them, and they belong at frame_rate apart however quickly they were handed over.
On for a LIVE take, where the caller is passing frames through from a camera. Without it the file's timeline is the frame count, so it declares itself frame_rate however fast the frames really came: a camera delivering 9 pictures a second into a file that says 32 replays three and a half times too fast, and nothing about the file looks wrong -- the pictures are all there, in order. frame_rate still sets the declared rate and the time base; this decides what the timestamps mean.