Recording API#
The recording API of Oasis supports two methods.
- Combined Recording API: A method that saves multiple video channels into a single recording file
- Individual Recording API: A method that saves each video channel into an individual recording file
Specifying the Recording File Path#
Normal recording starts by calling startRecording for combined recording or startMultiChannelRecording for individual recording.
The callback function MediaObserver::queryNewFilePath for combined recording or MediaObserver2::queryNewFilePaths for individual recording is called.
The automatically generated file path is delivered as an argument to the callback function.
In the case of combined recording, the format of the automatically generated file path consists of a combination of parameter key values, date, and time as follows:
<normal-folder-path>/<file-prefix>YYYY-MM-DD-hh-mm-ss.<file-extension>
In the case of individual recording for each video channel, it is as follows:
<normal-folder-path>/<file-prefix>YYYY-MM-DD-hh-mm-ss-CH<N>.<file-extension>
<N> is the channel number, such as 1, 2, 3, etc.
The application can change the recording file path delivered as a parameter of this function.
Event and motion recording deliver the recording file path directly as an API argument.
Each recording file path is an absolute path.
It is recommended to use the folder path value delivered when creating the recording object as the folder where the recording file is located, though specifying another folder is also possible.
- normal-folder-path
- event-folder-path
- motion-folder-path
Parameter Configuration#
The combined recording method and individual recording method deliver a key-value map as a parameter when creating each recording object as follows.
MediaObserver::queryNewFilePath.MediaObserver::queryNewFilePath.oasis::fs::offsConfigLocalFormatInfo.enable-persistent-cache key value is "1". The actual event recording specifies the path in event recording APIs such as startEventRecording.enable-persistent-cache key value is "1". The actual motion recording specifies the path in motion recording APIs such as startMotionRecording.max-files is 1 or greater.MediaObserver::onInfoEx is called. If "0", MediaObserver::onInfo is called.event-folder-path key value in the case of event recording, or the folder path of the motion-folder-path key value in the case of motion recording, as a temporary media data cache. Disk lifespan may be shortened. It is useful for systems that have constraints making it difficult to temporarily store media data in memory with the media-cache-size key value specified during Oasis initialization. If "1", the folder where event recording and motion recording files are located must be identical to event-folder-path or motion-folder-path. If the folder location is different, data before the occurrence of the event or motion will not be saved.raw, aac, mp3. raw saves PCM data without encoding it.left, center, right.top, center, bottom.The key-value map allocated for each video track (channel) is as follows. channel<N>- is prepended to the key name. <N> starts from 1 and increases by 1.
2160p, 1440p, 1080p, 720p, 480p, 360p.out-height.out-width.h264, h265.kRecordingErrorMediaDataTimeout event depending on configuration. If the value is "0", it does not trigger the event.Below is the table of bitrates (bps) applied per resolution when bitrate is not specified and only resolution is specified.
| Resolution | Width | Height | Bitrate |
|---|---|---|---|
| 2160p | 3840 | 2160 | 16000000 |
| 1440p | 2560 | 1440 | 16000000 |
| 1080p | 1920 | 1080 | 8000000 |
| 720p | 1280 | 720 | 4000000 |
| 480p | 640 | 480 | 2000000 |
| 360p | 640 | 360 | 1000000 |
Below is the bitrate (bps) table when bitrate is not specified, and only out-width and out-height are specified.
| Minimum Height | Bitrate |
|---|---|
| 1440 | 8000000 |
| 1080 | 6000000 |
| 720 | 4000000 |
| 480 | 2000000 |
| Less than 480 | 1000000 |
Note
When resolution, out-width, and out-height coexist, out-width and out-height are applied.
OSD can be configured for each video channel.
When the video encoding format is H264, the following key-value map applies.
baseline, main, high.level1, level11, level12, level13, level2, level21, level22, level3, level31, level32, level4, level41, level42, level5, level51, level52.When the video encoding format is H265, the following key-value map applies.
main, main10, still.level1, level2, level21, level3, level31, level41, level5, level51, level52, level6, level61, level62.vbr, cbr, abr, fixqp.cbr, vbr, abr.cbr, vbr, abr.vbr, abr.abr.abr.vbr, abr.vbr, abr.fixqp mode.fixqp mode.dual, smart, normal.smart mode.Recording Scenario Example#
Below is a scenario applicable to a dashcam.
-
Format with Oasis File System (OFFS) using mkfs.offs into the following folder structure. The mode of each folder during formatting is "0".
- DRIVING
- PARKING
- DRIVE_EVENT
- PARK_EVENT
-
Mount OFFS to
/mnt/sd. -
When creating a combined or individual recording object, specify
normal-folder-pathas the folder path/mnt/sd/DRIVING. Call thecreateRecorderorcreateMultiChannelRecorderAPI. -
Start combined or individual recording. Call the
startRecordingorstartMultiChannelRecordingAPI. -
When an event occurs, generate an absolute file path within the
/mnt/sd/DRIVE_EVENTfolder and call event recording. Call thestartEventRecordingorstartMultiChannelEventRecordingAPI. -
Stop recording to switch to parking mode. Call the
stopRecordingorstopMultiChannelRecordingAPI. -
Change
normal-folder-pathto the/mnt/sd/PARKINGfolder. -
Change
file-duration-secsand each video channel'schannel<N>-file-framerateandchannel<N>-venc-framerateamong the recording parameters to the timelapse configuration values. -
Apply the changed parameters. Call the
changeRecorderParametersorchangeMultiChannelRecorderParametersAPI. -
Restart recording. Call the
startRecordingorstartMultiChannelRecordingAPI. -
If an event occurs during timelapse recording, generate an absolute file path within the
/mnt/sd/PARK_EVENTfolder and call event recording. Call thestartEventRecordingorstartMultiChannelEventRecordingAPI.