Ip Camera

Description

Records video in small segments (in case of a cut) and store it locally. They are first stored in a temporary folder. Once the record (of e.g 10 seconds) is done, it is moved to another directory.

Compared to other plugins, the collect function only moves the files from the temporary location, it does not start the recording. It takes some time to establish connection, so we avoid doing this every time. Recording is started at initialization by an ffmpeg process and saved in HLS format.

Parameters

ParameterDescriptionTypeDefault
inputInput urlstrN/A (Mandatory)
videoEnable video recordingbooltrue
audioEnable audio recordingboolfalse
bitrate_videoVideo bitratestr([0-9]+[kmKM])"2M"
bitrate_audioAudio bitratestr([0-9]+[kmKM])"192k"
segmentRecords by small segment, managed by ffmpegbooltrue
segment_timeDuration of a segmentint (>0)10
ffmpeg_log_levelFfmpeg log levelstr (See doc)"info"
ffmpeg_bannerShow ffmpeg banner in consolebooltrue
save_pathPath used to save files with ffmpeg, UTC date is usedstr"ffmpeg_%Y-%m-%dT%H:%M:%S"

The global save_local_base_path default crashes this Measurement

onConfigure() expands %Y/%M/%D/%H in the directory it creates (dc_util::expand_time(storage_dir_)), but collect() later iterates storage_dir_ unexpanded, as a literal path — and the default global save_local_base_path ($HOME/ros2/data/%Y/%M/%D/%H, see Measurements) contains exactly those placeholders. The first collect() call throws an uncaught std::filesystem::filesystem_error ("cannot open directory: No such file or directory") and takes down the whole measurement_server process, along with every other Measurement it runs. This is a known issue, still unfixed. Set a save_local_base_path with no % placeholders (e.g. /var/lib/dc) to avoid it; save_path itself is unaffected, since only its parent directory is extracted into storage_dir_.

Schema

{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "title": "Ip Camera",
    "description": "Local and remote path where the remote camera video is recorded",
    "properties": {
        "local_path": {
            "description": "Local video path",
            "type": "string"
        },
        "remote_path": {
            "description": "Remote video path",
            "type": "string"
        }
    },
    "type": "object"
}

Configuration

...
ip_camera:
  plugin: "dc_measurements/IpCamera"
  topic_output: "/dc/measurement/ip_camera"
  input: "rtsp://192.168.0.10:554/stream1"
  segment_time: 10
  save_path: "ip_camera/%Y-%m-%dT%H-%M-%S"

Example output

Captured from a real run, input pointed at a real-time MPEG-TS/TCP test stream (save_local_base_path overridden per the warning above):

{
  "data_src": "ip_camera",
  "flattened": false,
  "local_path": "/root/dc_capture_out/ip_camera/ffmpeg_2026-09-06T00:02:30.ts",
  "name": "ip_camera",
  "nested": false,
  "remote_path": "/ip_camera/ffmpeg_2026-09-06T00:02:30.ts",
  "run_id": "169",
  "timestamp": "ffmpeg_2026-09-06T00:02:30"
}