Understanding the Results
When you process video using vitallens.js, the results are returned as a structured object.
Unlike the vitallens-python, which handles multiple faces, vitallens.js is designed to process only a single face. You always receive a single result object per event or file.
Result Structure
JSON Schema
The result object follows the VitalLensResult interface. Below is an example of the JSON structure you will receive.
{
"face": {
"coordinates": [[247, 52, 444, 332], ...],
"confidence": [0.6115, 0.9207, 0.9183, ...],
"note": "Face detection coordinates..."
},
"vital_signs": {
"heart_rate": {
"value": 60.21,
"unit": "bpm",
"confidence": 0.9205,
"note": "Global estimate of Heart Rate..."
},
"respiratory_rate": {
"value": 12.08,
"unit": "bpm",
"confidence": 0.9969,
"note": "Global estimate of Respiratory Rate..."
},
"ppg_waveform": {
"data": [0.12, 0.15, 0.18, ...],
"confidence": [0.99, 0.99, ...],
"unit": "unitless"
},
...
},
"fps": 30.0,
"message": "The provided values are estimates..."
}
Data Availability
You might notice that not all keys (like hrv_sdnn) are present in every result. The availability of specific vital signs depends on the processing mode (Stream vs. File) and the duration of the data.
1. When Analyzing a Video Stream
In streaming mode, VitalLens returns estimation results continuously. Each result represents a window of the most recent data.
| Vital Sign | Key | Type | Based on / Contains | Returned if |
|---|---|---|---|---|
| PPG Waveform | ppg_waveform |
Continuous waveform | Depends on waveformMode |
Always if face present |
| Heart Rate | heart_rate |
Global value | Up to last 10 seconds | Face present for at least 5 seconds |
| Respiratory Waveform | respiratory_waveform |
Continuous waveform | Depends on waveformMode |
Face present using vitallens |
| Respiratory Rate | respiratory_rate |
Global value | Up to last 30 seconds | Face present for at least 10 seconds using vitallens |
| HRV (SDNN) | hrv_sdnn |
Global value | Up to last 60 seconds | Face present for at least 20 seconds using vitallens |
| HRV (RMSSD) | hrv_rmssd |
Global value | Up to last 60 seconds | Face present for at least 20 seconds using vitallens |
| HRV (LF/HF) | hrv_lfhf |
Global value | Up to last 60 seconds | Face present for at least 55 seconds using vitallens |
Note: HRV vitals are only available on
vitallensversion 2.0 or greater.
2. When Analyzing a Video File
In file mode, VitalLens returns one aggregate estimation result for the entire file.
| Vital Sign | Key | Type | Based on / Contains | Returned if |
|---|---|---|---|---|
| PPG Waveform | ppg_waveform |
Continuous waveform | Depends on waveformMode |
Always if face present |
| Heart Rate | heart_rate |
Global value | Entire video | Face present for at least 5 seconds |
| Respiratory Waveform | respiratory_waveform |
Continuous waveform | Depends on waveformMode |
Face present using vitallens |
| Respiratory Rate | respiratory_rate |
Global value | Entire video | Face present for at least 10 seconds using vitallens |
| HRV (SDNN) | hrv_sdnn |
Global value | Entire video | Face present for at least 20 seconds using vitallens |
| HRV (RMSSD) | hrv_rmssd |
Global value | Entire video | Face present for at least 20 seconds using vitallens |
| HRV (LF/HF) | hrv_lfhf |
Global value | Entire video | Face present for at least 55 seconds using vitallens |
Note: HRV vitals are only available on
vitallensversion 2.0 or greater.