-
Notifications
You must be signed in to change notification settings - Fork 0
Media Manager
The goal of the Media Manager is to provide multimedia clips for the different events. These clips are short videos with or without audio (and still images as clip). They are characteristic of the event and they are captured automatically using the high-level context reasoning capabilities of the edge node. The Media Manager comprises two almost independent parts:
- The continuous recorder that temporarily stores everything captured from a camera and microphone pair in small blocks.
- The clip generator that waits for some high-level event to occur and then selects the relevant blocks and stitches them together in a video stream.
The camera video stream is converted to MPEG2 TS using ffmpeg (or any tool that can produce MPEG2 TS). MPEG2 TS is very common, as it is the format used in digital TV (DVB) and allows for easy cutting and joining of video segments. The generated MPEG2 is at full resolution and has little compression, trying to maintain the capture quality as much as possible. The MPEG2 TS is split into blocks of 188 KB each, corresponding to about 1/4 sec video with the current quality settings. Every block is stored in a database with its corresponding timestamp.
The continuous recorder, as its name implies, is always working, one per camera.
Given a time range, the clip generator can take the corresponding blocks from the database and create a new MPEG2 TS file containing only the required time range. One of the advantages of using MPEG TS is that we can concatenate the blocks directly, without re-encoding the video.
This MPEG2 can be broadcasted directly or can be converted to a number of formats of interest for several pre-defined devices or resolutions. These video clips are permanently stored and are referenced using a URL (one per format or resolution).
The time range input for the clip generator is obtained by always listening to the high-level context feed(s); when something important happens, a trigger is issued with the necessary range. The clip generator updates the event feed(s) with fields containing the different URLs (image, videos of different formats and/or resolutions). Then the search engine can access the URLs and forward them to the applications.
Two types of storage are needed for the Media Manager to work: Temporary storage for the blocks and permanent storage for the clips.
The temporary storage has limited space which is reused when new blocks arrive and allows for retrieval of data ranges between specified timestamps. For this task MongoDB is used, as it is a database that fulfills these requirements with adequate performance.
For permanent storage, the created clips can be stored on a hard disk array and an HTTP/FTP server can be used for distribution.