Recording File Format
An ordinary Matroska file, and the part of it a third party may rely on. Read this if you intend to open a recording with something other than this SDK. The preview pictures inside it are Preview Pictures.
The recording chapter is seven pages, each answering one question:
| Page | Question |
|---|---|
| Recording | How do I write a camera to a file? |
| A Running Recording | What is it telling me while it runs? |
| Recording File Format | What is the file, and what may a third party rely on? |
| Preview Pictures | Why does the file open on a picture, and which frame is it? |
| Snapshots and Interval Capture | How do I save one frame, or one every N seconds? |
| Recording Attachments | How do I put my own files inside the recording? |
| Playback | How do I read one back? |
MKV Container Format
Recordings use the Matroska (MKV) container. The tracks are in a deliberate order (track one is the picture a player should show, track two is the measurement) because most players show the first video track they find, and the measurement as brightness is a near-black rectangle. See The preview pictures.
- Notice track (track one): an MJPEG picture of the scene with the notice and a QR code on it, marked
forcedand taggedOTC_TRACK_ROLE=placard. This is what an ordinary player shows. It is one picture, written again once a second for the first three minutes of the recording, because a player stops showing a track the moment that track runs out of frames; see How long the notice stays up. - Video stream (track two): FFV1 lossless codec, 16-bit grayscale (
GRAY16LE). Each pixel stores the SDK's internal thermal format ((celsius * 10) + 1000), preserving full radiometric precision. Frames are stored in sensor orientation; the orientation in force when recording is stored beside them and applied on playback, so a recording can be re-oriented afterwards. - Metadata stream: a text track, immediately after the video track it belongs to, with one JSON record per video frame, carrying the timestamp, sequence number, flag, box and chip temperatures, shutter state, and the per-frame region record described below.
- Attachments:
otc-meta.json(device identity, radiometry and measurement range, in the same schema a snapshot uses),config.json(regions and rules, radiation parameters, orientation, temperature range; the regions live here, not inotc-meta.json),calibration.jsonwhen calibration data was supplied,cover.jpg(the preview picture, see below), and any files your attachment providers return.Player::Open()reads these to restore the device description, the radiation parameters and the measuring areas. Which document wins. The radiometry and the measurement range appear in both, andotc-meta.jsonis believed where it states them, the same preference the per-frame ambient follows, which is what keepsGetRadiation()and the ambient the frames are measured against equal rather than merely usually equal.config.jsonanswers for a file that carries only it, and is the sole source ofambient_estimated, the orientation and the regions. A file stating the radiometry in neither leavesGetRadiation()reporting the SDK's defaults, andPlayer::HasRadiation()is what tells that apart from a recording genuinely made at 1.0 / 1.0 / 20 °C. The range has exactly the same pair: a file stating it in neither document leavesGetConfig()reporting −20..100 °C, andPlayer::HasTemperatureRange()is what tells that apart from a recording genuinely made in that range. It is true only where the file states both bounds, soconfig.jsonnaming a minimum and no maximum answers no. - Container tags:
OTC_FORMATandOTC_SOFTWARE, beside the creation time. These are what identifies the file after somebody has passed it through another tool; see below.
What a third party may rely on
Read this one if anything other than this SDK opens your recordings: a shell extension, an analysis script, a customer's own reader. It is a contract, so it says which parts are promises and which are not.
How to tell an Optris recording from any other .mkv
Three markers, all of them in the file header before the first block of video, so a reader decides from the first few kilobytes without decoding a frame. Every file of a split recording carries all three.
| Marker | What it says |
|---|---|
the otc-meta.json attachment |
otc_format (a whole number), encoding, width, height, and software, which begins "OTC.SDK " |
the OTC_FORMAT and OTC_SOFTWARE container tags |
the same number and the same string |
a text track whose title ends in Metadata |
the per-frame telemetry |
Why both a tag and an attachment. Passing a file through another tool (ffmpeg -c copy, a cutter, anything that repackages without re-encoding) keeps the container tags. It usually throws the attachments away: FFmpeg's ordinary -c copy takes one track per media type and no attachments at all, so the metadata document and the cover picture go together. (ffmpeg -map 0 -c copy keeps them, but that is not what anyone types.) Before these tags existed, a recording that had been through such a tool carried nothing whatever that said what it was. Now it still says. The document, the picture and the per-frame telemetry are still lost in that operation, so keep the original; but the file can still be recognised.
How much of the file you have to read: the header, and it is small
All three markers are in the file header, before the first block of video, so the question is answered without decoding anything. Measured on recordings the SDK writes: 1 KiB with no preview at all, 5 KiB at 320×240, 10 KiB at 640×480; the header is mostly the cover picture. A 64 KiB read covers every case, and that budget is re-checked on every build of the SDK rather than being a number in this page.
Saying no is cheaper, which matters if you are checking a whole folder: a file that is not Matroska at all is rejected on four bytes, and a .mkv that is not ours is rejected at its own first block of video: 585 bytes for an ordinary ffmpeg-written file. A finished recording is cheaper still, because its index names exactly where the tags are, so you can read 4 KiB and then seek straight to them.
A recording being written is recognisable too, within about a second of the first frame. Treat an empty or truncated file as "cannot tell yet" rather than "not an Optris recording"; a file caught in that first second is a recording that has not finished announcing itself.
On Windows these files stay .mkv. There is no Optris-specific extension and no attempt to take .mkv over from whatever already handles it. Optris Connect adds itself as an additional "Open with" choice and decides per file (icon, thumbnail and context menu) by inspecting the file with the markers above.
Do not count video tracks, and do not take the first one
A recording carries up to three: the notice placard (tagged OTC_TRACK_ROLE=placard, one picture repeated once a second), the thermal track, and the cover picture (which tools show as a one-frame attached pic). To find the measurement, take the video track that is not an attached picture and whose OTC_TRACK_ROLE is thermal or absent, not "the first track", and not "the only video track". It is 16-bit greyscale at the size otc-meta.json states. A role tag you do not recognise is not the measurement: that is how a future false-colour track will stay out of your way. There is one metadata text track per thermal track, not per video track; the two pictures have none.
A file with several cameras
A file recorded with RecordingSession in C#, SessionRecorder in C++ or the optris_sdk_session_ functions in C holds several cameras in one file. It carries the same three markers as any recording, in every one of its files, so a reader that checks them recognises it. What it adds:
- one track per camera, tagged
OTC_TRACK_ROLE=thermal(orvisualfor a visual-light camera), each followed by its own metadata text track; - an
otc-session.jsonattachment naming every camera: its name, model and serial number, size and frame rate; - a
sessionobject inotc-meta.json, withsources(how many cameras),described_source(which camera the rest of the document describes) anddocument("otc-session.json").
The width, height and device in otc-meta.json describe the first thermal camera, which is the one a single-camera player shows. The pixel rule below holds for every thermal track of the file.
To tell a file with several cameras from a one-camera recording, look for otc-session.json or the session object. To learn how many cameras it has from the header alone, count the tracks whose OTC_TRACK_ROLE is thermal or visual. A file with several cameras written by 12.0.12 or earlier carries only otc-session.json and the metadata text tracks, not the other two markers. It is still such a file and opens as before.
What a pixel is
The video track holds the SDK's internal 16-bit format, and the file states the rule rather than leaving you to know it:
celsius = (pixel - 1000) / 10
In the document, that is encoding: "temperature" (which says what the quantity is and deliberately not which numeric grid it sits on) together with unit: "K", scale: 0.1 and offset: 173.15, which do. The rule the schema uses everywhere is value = pixel * scale + offset, in the stated unit. A still image uses the same rule with a finer scale and no offset at all, which means zero: a snapshot's grid is anchored at absolute zero, and a recording's is not, which is the whole reason offset exists.
Do not infer a grid from encoding alone; it has never implied one. A recording written before these fields were added declares neither unit nor scale; the rule above is still the one it was written with, and the pixels never changed.
One sample is not a temperature: 0x8000. 32768 unsigned, −32768 as int16, and it means this pixel was not measured. The rule above does not apply to it: run it through and you get −3376.8 °C and a picture scaled to that. Exclude it from anything that averages, ranks, compares or scales; the SDK's own name for it is optris::sdk::kInvalidPixel.
It is neither rare nor a fault. Radial distortion correction in Wide mode keeps the full field of view, and the price is a border along the edges and in the corners where no sensor sits behind the output pixel: 15.8 % of the frame on a G7, a few per cent on a PI. Every frame of such a recording carries it. The value is reserved: the pipeline clamps filtered results to −32767 so that a genuinely very cold pixel cannot saturate onto it.
Recordings written before September 2026 do not carry it. The sentinel was lost on the way out of the pipeline and those pixels were written as internal 0, which decodes to −100.0 °C. Nothing in such a file tells them apart from a measurement, so this SDK reads them as −100.0 °C and does not guess. Treating −100.0 °C as unmeasured in a file written before the fix is usually right (no Optris measuring range reaches it), but that is your decision, and the file gives no marker saying which rule applies to it.
The colours
otc-meta.json carries a render block (palette, colour-scale ends, auto-scale mode) and so does any frame for which the file-level block would be wrong. Your rule is one line: use the frame's own block if it has one, otherwise the file's. The block is written for every recording, including one that starts before the first picture has been drawn; in that case it names the palette, and the colour range if you had fixed one, and leaves absent only what genuinely did not exist yet.
Palette names are spelled the way the palette files in the installation are named (Iron, IronHi, Rainbow, RainbowHi, GrayBW, GrayWB, Medical, AlarmBlue, AlarmBlueHi, AlarmGreen, AlarmRed, Jet, Hot, Plasma, Arctic, Lava), the same names SDK 11 and PIX Connect used.
custom means your own colours were in force, and they are stored in the file
otc-meta.json carries them at the top level as palette_colors: exactly 240 "#rrggbb" strings, coldest first, about 2.4 KB written once for the file. palette_name is the label you gave them: a caption, not something anything looks up. Until September 2026 the colours were not stored at all, and the consequence was a file that rendered three different ways: the cover in your colours, this SDK's player in a default, and any other reader in a third. Playback now opens such a recording with your colours, so Player::GetCustomPalette() gives them straight back.
The colours are the ones in force when the file opened. That is the container's limit, not a choice: the file's header is written as it opens and nothing can be added to it afterwards. A segmented recording writes a header per segment, so each segment carries the palette its own start was made with. If you switch to a different custom palette while recording, the per-frame blocks name the new one and a reader can see the stored colours stopped applying, but only if you also change the name. Two different palettes sharing one name are indistinguishable in the file, so change the name when you change the colours.
A replay opens on the recording's scale, and says so
Playback adopts what the file names: the palette, and either the auto-scale mode or (when the recording was made on a fixed range) that range.
Two calls, and they answer different questions. What the handle draws with now: FrameSource::GetColorRange(), optris_sdk_imager_get_color_range(), ThermalCamera.ColorRange. Both ends present is what "the scale is fixed" means, and .NET's ColorScaling reports Manual from exactly that. What the recording was made with: Player::GetRecordedRender(), optris_sdk_imager_get_recorded_render(), ThermalCamera.RecordedRender. They agree when the file opens and stop agreeing the moment you re-scale the replay, which is why showing "recorded on 15..130 °C" beside what is on screen needs both. In the recorded block, an empty auto_scale_mode with both ends present is a fixed range; an empty one with no ends is a file from before this metadata existed.
A recording that predates this metadata carries no colours. Draw it with a palette of your own and say that you did, rather than presenting the picture as the one the operator saw; the colour scale is exact in every case, so a legend's numbers are right regardless.
What is ordered on purpose
Track one is the picture a player should show and the measurement follows it. That is the one thing a player which takes "the first video track" can act on, so it is deliberate rather than incidental. Recordings written before this have the measurement first and carry no role tag, and the rule above reads both.
Whether the shutter was held back while it was written
otc-meta.json carries a flag_policy object when, and only when, the recording was made with the shutter suppressed: while_recording naming the policy ("use", "avoid", "avoid_unless_drift") and override_drift_c beside it where the policy consults one. Its absence means the shutter ran normally, which is the case for every recording written before September 2026 and for every recording made at the default setting.
This matters more than most of the document, because the file's temperatures are finished: drift the camera did not correct is in the pixels permanently and cannot be reprocessed out. A reader that cares whether the numbers are trustworthy has to look. The degraded frames also say so individually, on the per-frame telemetry track, as a flag_policy object with held: true and a drift_c in Celsius, the worst internal-probe drift since the last correction, which is roughly how wrong that frame is. Those appear only on the frames a correction was refused on, so the stretch of a recording to distrust is exactly the stretch that carries them, and the largest drift_c in the file is the worst the take ever got. A drift_c that is absent is one the camera had not measured yet, never a drift of zero. An unrecognised while_recording means a policy from a newer writer: treat the file as suppressed by something and do not guess what. See Turning the flag off while recording.
What is advisory
Attachment order and track numbers beyond that, the exact title of the metadata track beyond its Metadata ending, the presence and contents of cover.jpg, and every attachment other than otc-meta.json. Match attachments by name, never by position. Everything libavformat writes by itself (MuxingApp, WritingApp) names the FFmpeg that built the file and may change at any time.
The older shape. Recordings written by pre-release v12 builds in July 2026 carry device.json and config.json and no otc-meta.json. They are Optris recordings; device.json is the legacy spelling of what otc-meta.json now holds. They carry no format number, so treat them as the earliest shape. Nothing writes that pair any more.