πŸ“·Camera Recording

Example showing how to stream data from cameras and log into disk

The Bubbaloop platform includes a cameras pipeline functionality which allows to stream and record data from multi camera streams and serialize in disk including the video frames metadata such as the timestamps.

Edit the pipeline file

In order to customize the recording pipeline we need to follow the steps below, eg to adjust our RTSP streams configuration:

1

Update the pipeline in cameras.rsarrow-up-right

Go to cameras.rsarrow-up-right an update the config parameter by specifying the path to the pipeline ron file that you want to use for the recording task.

We provide as an example a couple of pipelines to record from one and multiple cameras. See: cameras_1.ron , cameras_2.ron , etc.

#[copper_runtime(config = "src/cu29/pipelines/cameras_1.ron")]
struct CamerasApp {}
2

Customize the pipeline file

You can definitely customize the ron file e.g to update the camera parameters like the source_uri to point to your RTSP camera; or enable disable the broadcasting.

circle-info

The RTSP url it's expected to be as in the following format

"rtsp://<username>:<password>@<ip>:<port>/<stream>
triangle-exclamation

These are ron files examples to use with single and multicam with broadcasting included

(
    tasks: [
        (
            id: "cam0",
            type: "crate::cu29::tasks::VideoCapture",
            config: {
                "source_type": "rtsp",
                // URL of the RTSP camera
                // rtsp://<username>:<password>@<ip>:<port>/<stream>
                "source_uri": "rtsp://tapo_entrance:123456789@192.168.1.141:554/stream2",
                "channel_id": 0,
            }
        ),
        (
            id: "enc0",
            type: "crate::cu29::tasks::ImageEncoder",
        ),
        (
            id: "logger",
            type: "crate::cu29::tasks::RerunLoggerOne",
            config: {
                // Path to the directory where the recordings will be stored
                "path": "/tmp/",
            }
        ),
        (
            id: "bcast0",
            type: "crate::cu29::tasks::ImageBroadcast",
        ),
    ],
    cnx: [
        (src: "cam0", dst: "enc0", msg: "crate::cu29::msgs::ImageRgb8Msg"),
        (src: "enc0", dst: "logger", msg: "crate::cu29::msgs::EncodedImage"),
        (src: "enc0", dst: "bcast0", msg: "crate::cu29::msgs::EncodedImage"),
    ]
    ,
    logging: (
        slab_size_mib: 1024, // Preallocates 1GiB of memory map file at a time
        section_size_mib: 100, // Preallocates 100MiB of memory map per section for the main logger.
        enable_task_logging: false,
    ),
)

Start the server

Start streaming

Start the camera pipeline and log using rerun.ioarrow-up-right.

Visualize the streaming

You can use the example python-streamingarrow-up-right to visualize the streams in real-time using Rerun.

Start Recording

Send a request to server to start recording from the cameras

Client terminal

Stop recording

To stop the pipeline, use the stop-pipeline command:

Client terminal

Server terminal

Get the recorded data and Visualize

You can copy to your home directory (or via ssh) the recorded files into your computer.

Open the file directly wth rerun to introspect the recording

Last updated