Default Media Recorder

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

Note

Recording of YUV frames is not supported on MacOS when the H264 codec is used in the conference. MacOS only supports dumping of Encoded Frames for H264. This restriction does not apply for VP8.

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 regarding 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 that contains the file name and the video track ID for the video in the file. This metadata 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 cannot. 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 recorder : public dolbyio::comms::audio_sink, public dolbyio::comms::video_sink_encoded

The interface for the Default Media Recorder.

Public Types

enum class 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 class 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.

Note

If the configuration is set to ENCODED_OPTIMIZED, then the video frames are not decoded after they are dumped. In this case if you call the dolbyio::comms::services::remote_video service::set_video_sink method, the frames will never reach the set sink. If you would like to get decoded frames as well as dump encoded frames to a file make sure to set the configuration to ENCODED format.

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

recorder(dolbyio::comms::sdk &sdk, audio_recording_config audio, video_recording_config video)

Constructor taking the audio and video recording configurations.

Parameters:
  • sdk – The reference to the SDK object.

  • audio – Audio recording configuration.

  • video – Video recording configuration.

virtual ~recorder()

The destructor of the recorder.

virtual decoder_config decoder_configuration() const override

The callback that is invoked to check the set decoder configuration. This allows the SDK to check if optimized decoding has been configured, if optimized decoding is set then the decoder will only decode the first frame. This means that applications can only connect an encoded video sink. When using full_decoding an application can connect a video_sink and an video_sink_encoded so it can render video frames and also dump them to file for instance.

Returns:

The desired decoder configuration for the Encoded Video Sink.

Public Static Functions

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

Creates the media recording module.

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

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

  • sdk – The reference to the SDK object.

  • audio – The audio configuration.

  • video – The video configuration.

Throws:
  • dolbyio::comms::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.