This document covers using the k4arecorder command line utility to record data streams emitted from the Sensor SDK to a file.
Recorder Options
k4arecorder provides various command line arguments for specifying the output file and recording modes.
Recordings are stored in Matroska .mkv format. Recordings contain color and depth images over multiple video tracks, along with camera calibration and other metadata.
k4arecorder [options] output.mkv Options: -h, --help Prints this help --list List the currently connected K4A devices --device Specify the device index to use (default: 0) -l, --record-length Limit the recording to N seconds (default: infinite) -c, --color-mode Set the color sensor mode (default: 1080p), Available options: 3072p, 2160p, 1536p, 1440p, 1080p, 720p, 720p_NV12, 720p_YUY2, OFF -d, --depth-mode Set the depth sensor mode (default: NFOV_UNBINNED), Available options: NFOV_2X2BINNED, NFOV_UNBINNED, WFOV_2X2BINNED, WFOV_UNBINNED, PASSIVE_IR, OFF --depth-delay Set the time offset between color and depth frames in microseconds (default: 0) A negative value means depth frames will arrive before color frames. The delay must be less than 1 frame period. -r, --rate Set the camera frame rate in Frames per Second Default is the maximum rate supported by the camera modes. Available options: 30, 15, 5 --imu Set the IMU recording mode (ON, OFF, default: ON) --external-sync Set the external sync mode (Master, Subordinate, Standalone default: Standalone) --sync-delay Set the external sync delay off the master camera in microseconds (default: 0) This setting is only valid if the camera is in Subordinate mode. -e, --exposure-control Set manual exposure value (-11 to 1) for the RGB camera (default: auto exposure)
Recording Files
Example 1. Record depth NFOV Unbinned (640×576) mode RGB 1080p @ 30 fps (including IMU) content. Press CTRL-C keys to stop recording.
k4arecorder.exe output.mkv
Example 2. Record WFOV Unbinned (1MP) RGB 2160p @ 15 fps (no IMU) content for 10 seconds.
k4arecorder.exe -d WFOV_UNBINNED -c 2160p -r 15 -l 10 --imu OFF output.mkv
Example 3. Record WFOV 2×2 Binned 30 fps content for 5 seconds and save to output.mkv.
k4arecorder.exe -d WFOV_2X2BINNED -c OFF --imu OFF -l 5 output.mkv
Tip: The RGB camera controls (e.g. setting manual white balance) can be configured with the Viewer before recording.
Verifying Recording
The 《K4A Viewer for Femto Mega》output .mkv file can be opened with the Viewer.
To extract tracks or view file info, tools like mkvinfo from the MKVToolNix toolkit can be used.