Default Media Recorder

Note

The Default Media Recorder is intended for Server applications.

The default recorder handles the incoming media streams and stores the streams in proper containers. The following table lists containers used for respective codecs:

Codec

Container

H264

MPEG-TS

VP8

Matroska

YUV

Matroska

PCM

Matroska

AAC

Matroska

The recorded files are placed in a directory specified when the default recorder is created. The files are stored with the respective container extension:

  • vid_X.mkv

  • vid_X.mpegts

  • audio_X.mkv

Where X corresponds to a incrementing integer ID for the video/audio file. Information which file represents which streamer is available in the metadata.txt file in the same folder. When a new file is created, the video_first_data event occurs which contains the file name and the video track ID for the video in the file. This meta data file contains the processed scpp events and media pipeline events. The types of events logged and the structure of the corresponding lines for the events in the metadata.txt file are as follows:

Log Event

Output File Line

Audio Track Added

<timestamp> +audio <peer_id> <stream_id> <track_id>

Audio Track First Data

<timestamp> track_first_data <track_id> <file_name>

Audio Track Removed

<timestamp> -audio <track_id>

Conference Ended

<timestamp> conference_ended

Participant Added

<timestamp> +peer <peer_id> <peer_name>

Participant Removed

<timestamp> -peer <peer_id>

Video Track Added

<timestamp> +video <peer_id> <stream_id> <track_id> <is_screenshare>

Video Track Removed

<timestamp> -video <stream_id>

Video Track First Data

<timestamp> track_first_data <track_id> <file_name>

WebRTC may change the format in which RAW audio is presented to the audio track sinks. This may have severe impact on the raw (PCM) and transcoded (AAC) capture; when this situation occurs, a new file is created. The encoded video resolution change can be seamlessly muxed into the stream, but the raw (YUV) video resolution change can not. Therefore, selecting the YUV output causes the video frame size reconfigurations to open new files. In the case of encoded video capture, we could generate the file name for the stream at the time the stream is first discovered (the +video event), but for consistency the file name is also generated on the track first data event.

Default Recorder Interface

#include <dolbyio/comms/multimedia_streaming/recorder.h>

The Recorder interface is used for configuring the default recorder. The methods in the recorder interface are used to create and configure the recording module. This creates and configures the recording module that is provided as a part of the C++ SDK. The enums of the interface are used for setting the Video/Audio storage formats of the media. If you want to build your own recorder module, do not use this API.

class dolbyio::comms::plugin::recorder : public dolbyio::comms::media_sink_interface

The interface for the Default Media Recorder.

Public Types

enum audio_recording_config

The available formats for capturing audio.

Values:

enumerator NONE

Disables audio capturing.

enumerator PCM

Enables capturing audio and storing the audio in the PCM format.

enumerator AAC

Enables capturing audio and storing the audio in the AAC format.

enum video_recording_config

The available configurations for capturing and storing video. The captured video frames are stored in corresponding containers. The encoded video is not transcoded during or after the recording, so the corresponding container depends on what is negotiated in the SDP. Video encoded via the H264 codec is stored in the MPEG-TS container and video encoded via VP8 is stored in Matroska.

Values:

enumerator NONE

Disables video capturing.

enumerator YUV

Enables capturing of raw video frames that are stored in the Matroska container.

enumerator ENCODED

Enables capturing of the video frames that are encoded via the VP8 or H264 codec.

enumerator ENCODED_OPTIMIZED

Enables capturing of the video frames that are encoded via the VP8 or H264 codec. Only the first frame of the incoming video track will be decoded.

Public Functions

virtual ~recorder()

The destructor of the recorder.

virtual void set_recording_config(audio_recording_config audio, video_recording_config video) = 0

Sets a configuration for capturing audio and video.

recorder->set_capture_config(audio_recording_config::PCM,
                             video_recording_config::ENCODED_OPTIMIZED);

Parameters:
  • audio – The audio format.

  • video – The video format.

Public Static Functions

static std::unique_ptr<recorder> create(const std::string &out_dir, dolbyio::comms::sdk &sdk)

Creates the media recording module.

// When an output directory and the sdk instance are created
auto recorder = dolbyio::comms::plugin::recorder::create(outdir, sdk);

Parameters:
  • out_dir – The location for storing the captured audio and video.

  • sdk – The reference to the SDK object.

Throws:
  • dolbyio::comms::io_exception – Occurs when a metadata file cannot be created.

  • dolbyio::comms::exception – Occurs when an event handler cannot be connected.

  • std::exception – Occurs in the case of a file system issue.

Returns:

The pointer to the recorder module object.