Creating a recording session using a python script
You can create a recording session programmatically by inserting items directly into the database.
It requires knowing the graphql endpoint and the graphql admin secret.
The endpoint consists of the webfrontend URL with the /v1/graphql
suffix
The graphql admin secret can be found in your ds/.env
file on the server installation.
Defining the configuration file for the session
Create a new file e.g. named recording_session_definition.yml
and place the below YAML content into it.
Make sure to modify the endpoint, secret, start and endDates (note the alternative formats to chose from and INCLUDE a timeoffset to UTC, e.g. -4 for EDT.) and other items as you need.
Note: the
encoder
field will beHEVC
for 2D / RGB video. Generally it can be one ofClassic, HEVC, IDR, Lossless, DC
Note: the
type
oralign_to
field can be one of:color, depth, infra1, infra2
- which of these it is is only relevant for 3D video
Note: the
{
"graphql": {
"endpoint": "https://aivero.dev/v1/graphql",
"secret": "TAKE_SECRET_FROM_DOT_ENV"
},
"recordingName": "coolRecording",
"startDatewithTz": "2025-06-26T11:18:00pm-4",
"endDatewithTz": "2025-06-26T23:19:00-04:00",
"cameras": [
{
"model": "V4L2CAMERA",
"serial": "BB0D0D60634916AD",
"streams": [
{
"type": "color",
"align_to": "color",
"encoder": "HEVC",
"width": 1280,
"height": 720,
"near_cut": 300,
"far_cut": 1000,
"bitrate": 1000000,
"frame_rate": 30
}
]
},
{
"model": "V4L2CAMERA",
"serial": "1936800A7206F708",
"streams": [
{
"type": "color",
"align_to": "color",
"encoder": "HEVC",
"width": 1280,
"height": 720,
"near_cut": 300,
"far_cut": 1000,
"bitrate": 1000000,
"frame_rate": 30
}
]
}
]
}
Running the python script
To simplify requirements handling we dockerised the python script. To run it you need to
- Navigate to the directory containing your
recording_session_definition.yml
- Run this docker command:
docker run --rm -ti --volume ./:/addSession/session registry.gitlab.com/aivero/open-source/see/add-recording-session:latest python add_recording_session.py -s session/recording_session_definition.yml
- Check your webinstance to see the scheduled recording session
(optionally) inspect the Python script
The python script is located at: aivero-python-interface/src/samples/add_recording_session.py
The dockerfile used to build it is at: aivero-python-interface/src/samples/add_recording_session.Dockerfile
Build it with
docker buildx build -t registry.gitlab.com/aivero/open-source/see/add-recording-session:latest ./aivero-python-interface/src/samples/ -f ./aivero-python-interface/src/samples/add_recording_session.Dockerfile