3D visionHow-to

Change the bag file save location for depth camera streams

Where your depth camera's recorder writes bag files is set by the tool, not the camera. Change the bag file save location on Linux and Windows.

LumaSpec Vision9 min read Share on LinkedIn

On this page 9 sections
  1. 01The save path belongs to the recorder, not the camera
  2. 02What you need
  3. 03Set the folder in the viewer on Windows
  4. 04Set the folder on Linux through the working directory
  5. 05Pass the output path in your own recorder code
  6. 06Worked example: 30 minutes of 1280 × 720 depth and color at 30 fps
  7. 07Checks before a long recording
  8. 08When the default folder is the right answer
  9. 09Questions

Bag files from a depth recording session pile up in the wrong place: the viewer drops them into Documents or your home folder, the OS partition fills, and a long capture dies halfway through. The save location is not a camera property; there is no firmware setting for it. It comes from the recording tool: the folder you launch the tool from, the folder you pick in its save dialog, or the path you pass in your own code. This guide shows how to set that folder on Linux and Windows, and how to size the target disk before you press record.

The save path belongs to the recorder, not the camera

A depth camera streams frames; it has no opinion about where files land. Whatever you record through is a tool around the camera, and it takes the output path from one of three places.

Where the path comes from Who sets it Typical default
The viewer's save dialog You, at each recording Last-used folder, or Documents on Windows and the home folder on Linux
The process working directory The folder the tool was launched from Home folder on Linux; the executable's folder on Windows
The output-path argument in code You, in the record call Whatever path string you pass

Older viewer releases ignored all three and always wrote to a fixed folder. Configurable save paths shipped in mainstream depth-camera SDK releases years ago, so if your viewer's record dialog has no folder picker, bring the SDK current first; that alone often solves it.

What you need

  • A depth camera streaming into the SDK's viewer or into your recorder code; the 3D sensors category covers the types.
  • A recording machine with enough spare SSD capacity at the target folder. The worked example below sizes it.
  • The SDK's viewer or record-to-file example, installed and current.
  • The target folder created and writable by the account the recorder runs as.

For bench and line capture runs, a vision controller mounted next to the camera keeps frames off the network entirely:

Vision controllersHikrobot MV-VC5525-256G70-NN VC5000 Vision Controller, 12th-I5, 32GB+256G SSD, Supported PCIEMV-VC5525-256G70-NN
LAN ports
5+ LAN ports
USB 3 ports
3-4 USB 3 ports
PoE
PoE camera ports
Light outputs
8 built-in channels
$4,479.00 · quotedView and quoteBuild a system with it

The MV-VC5525-256G70-NN pairs a 12th-generation Core i5 processor with 32 GB of memory and a 256 GB SSD, and its PoE camera ports feed a GigE depth camera over a single cable. How much recording that SSD holds is pure arithmetic, and the worked example below does it.

The camera side is any depth camera whose streams you need to replay. For compact depth sensing and volume capture that is the MV-DT01WMU, a ToF sensing camera, recorded to a bag file so the measurement can be tuned offline:

3D sensorsHikrobot MV-DT01WMU ToF sensing cameraMV-DT01WMU
Type
Depth / ToF camera
Price on requestView and quote

Set the folder in the viewer on Windows

  1. Open the SDK's viewer and arm the record control as usual.
  2. When the save dialog appears, browse to the target folder instead of accepting the default. Windows viewers remember the last-used folder, so the next recording follows you there.
  3. Name the file for its content and date, in the run_001_720p.bag style, so playback sessions stay sortable later.
  4. Record a ten-second clip and confirm the file landed in the target folder before you start the real capture.

If the dialog offers no path field at all, update the SDK. If the picker still refuses to stick, use the working-directory method from the Linux section; it works on Windows too.

Set the folder on Linux through the working directory

A viewer launched from the desktop starts with your home folder as its working directory, and a recorder without an explicit path writes there — usually the smallest partition on the machine. Launch the tool from the folder you want instead.

  1. Create the target folder: mkdir -p /mnt/data/recordings.
  2. Make sure your user can write to it, following your site's own convention for data-disk permissions.
  3. Open a terminal and change into that folder: cd /mnt/data/recordings.
  4. Start the viewer from that same terminal. The recorder creates the bag in the working directory, so the file lands beside you instead of in home.
cd /mnt/data/recordings
# start the SDK's viewer from this terminal; the recording lands here

Pass the output path in your own recorder code

When recording is part of the application — triggered captures, dataset collection — the recorder call takes the destination file name directly. Give it an absolute path, and create the folder first, because recorders do not make directories for you:

import os

save_dir = "/mnt/data/recordings"           # illustrative target folder, your choice
os.makedirs(save_dir, exist_ok=True)        # create it before the recorder opens the file
save_path = os.path.join(save_dir, "run_001.bag")
# pass save_path to the SDK's record call as its output-file argument

The test that proves it: after the call, os.path.isdir(save_dir) returns True, and once recording starts, os.path.getsize(save_path) grows from zero. A bare file name with no folder — run_001.bag alone — resolves against the working directory, which is exactly the trap from the Linux section. The streams and pipeline behind this call are the subject of Record depth and color to a bag file, not an AVI.

Worked example: 30 minutes of 1280 × 720 depth and color at 30 fps

Inputs, and where each comes from:

  • 1280 × 720 pixels per frame, both streams — a common recording profile; read yours from the stream profile you actually record.
  • 2 bytes per pixel for depth (16-bit) — the format the bag-file guides on this site record; see 16-bit depth and 8-bit infrared streams on one depth camera.
  • 3 bytes per pixel for 8-bit RGB color.
  • 30 frames per second — the profile's rate.
  • 30 minutes of capture — a typical offline-analysis session.
  • No compression — the recorder writes raw frames, so treat the result as the ceiling; compressed formats land below it.

The rule in words: a recording's size is the sum over all streams of pixels times bytes per pixel times frames per second, multiplied by the seconds you record.

write rate (B/s) = Σ over streams (width px × bytes per px × fps) recording size (B) = write rate (B/s) × seconds

The arithmetic:

  • Depth: 1280 × 720 = 921,600 px per frame; 921,600 × 2 B = 1,843,200 B per frame; × 30 fps = 55,296,000 B/s.
  • Color: 921,600 × 3 B = 2,764,800 B per frame; × 30 fps = 82,944,000 B/s.
  • Both streams: 55,296,000 + 82,944,000 = 138,240,000 B/s, about 138 MB/s sustained.
  • Per minute: 138,240,000 × 60 = 8,294,400,000 B, about 8.3 GB per minute.
  • Thirty minutes: 8,294,400,000 × 30 = 248,832,000,000 B, call it 249 GB.
  • Headroom on the folder: 249 × 1.2 ≈ 300 GB of free space to have at the target.

The decision: put the recordings folder on a local SSD with at least 300 GB free for this run. A SATA drive sustains roughly 500 MB/s (the SATA III interface allows about 600 MB/s) and an NVMe drive several GB/s, so both clear 138 MB/s with margin. A gigabit network share tops out near 125 MB/s even in theory — below the write rate — so never record straight to a NAS: record locally, copy the finished file afterward. Spinning-disk folders manage roughly 100-200 MB/s sequential, which is marginal at 138 MB/s; a stalled write shows up later as missing frames in the recorded bag.

The same arithmetic scales by stream. Depth only at this profile is 55,296,000 B/s ≈ 55 MB/s ≈ 3.3 GB per minute — a gigabit share can absorb that. Four cameras recording side by side need 4 × 138 = 552 MB/s, beyond one SATA drive, so give each camera its own disk or record sequentially.

Checks before a long recording

  • Ten-second test at the real profile. Measured rate is file size divided by seconds; a ten-second clip of the example lands near 1.4 GB (138 MB/s × 10 s = 1,382 MB). Multiply out to the full run.
  • Free space at the folder at least the recording size × 1.2.
  • Folder on a local SSD, not a network share — the 125 MB/s gigabit ceiling decides it.
  • Write access confirmed for the account the recorder runs as; services and containers often run as someone else.
  • Playback smoke test. Open the file and scrub through it; reading every frame back offline is the only proof the disk kept up.
  • Link under load. If the camera sits on USB, recording stresses the link harder than viewing does — a cable that streams fine can drop frames only when you record.

When the default folder is the right answer

If the OS drive is the largest SSD in the machine and your sessions are short — a two-minute capture at the example profile is 8.3 × 2 ≈ 17 GB — leaving the default keeps every recording in one predictable place. The decision inputs are free space and sustained write rate, not the folder's path. Bag files are self-contained: the frames and stream metadata travel inside the file, so you can record locally at full speed and copy to the archive afterward, and playback works the same from the new location, as the RGB and depth alignment method from a recorded file shows. The 3D capture and playback topic page collects the rest of that workflow.

Size your own session with the numbers above, then pick the hardware: the camera finder filters depth cameras by type and recording needs, and the contact page takes a capture plan with more cameras than disks.

Questions

Does the depth camera have a setting for the bag file save location?

No. The camera and its firmware only stream frames; the output path is a property of the recording tool or of the recorder call in your code. If a viewer menu appears to set a save folder, it is filling in the recorder's output-path argument on your behalf. That is why the fix lives in the save dialog, the working directory or the path string you pass, never in the camera.

How much disk space does a bag recording need per minute?

At 1280 × 720 and 30 fps with 16-bit depth plus 8-bit color, count on about 8.3 GB per minute uncompressed, a 138 MB/s write rate. Depth alone at the same profile is roughly 3.3 GB per minute. Multiply by your run length, add about 20 percent headroom, and keep that much free at the target folder. Compression pulls the number down; treat the raw figure as the ceiling.

Can I record bag files straight to a NAS or network share?

Not for multi-stream profiles. A gigabit link tops out near 125 MB/s, while 720p depth plus color at 30 fps writes about 138 MB/s, so the share falls behind and frames drop. Record to a local SSD and copy the finished file to the archive afterward. A single low-rate stream may fit under the gigabit ceiling, but measure it with a ten-second test first.

Why do my recordings land in my home folder on Linux?

Programs launched from the desktop start with the home folder as their working directory, and a recorder without an explicit output path writes there. Open a terminal, change into the recordings folder and start the viewer from it, or set the working directory in the desktop launcher. Passing an absolute path in your own recorder code overrides the working directory completely.

Does moving a bag file to another drive break playback?

No. The frames and the stream metadata travel inside the file, so you can copy or move a bag freely and play it back from the new path. Name recordings with their content and capture date before archiving, because the file name is the only label the bag itself carries.