ExWebRTC. Recorder. Converter
(ex_webrtc_recorder v0.4.0)
View Source
Processes RTP packet files saved by ExWebRTC.Recorder.
Requires the ffmpeg binary with the relevant libraries present in PATH.
At the moment, ExWebRTC.Recorder.Converter works only with VP8 video and Opus audio.
Can optionally download/upload the source/result files from/to S3-compatible storage.
See ExWebRTC.Recorder.S3 and options/0 for more info.
Summary
Types
Options that can be passed to convert!/2.
Context for the video reencoding. See man ffmpeg for more details.
Resolution of reencoded video and generated thumbnails.
Context for the thumbnail generation.
Functions
Converts the saved dumps of tracks in the manifest to WEBM files.
Types
@type option() :: {:output_path, Path.t()} | {:s3_upload_config, keyword()} | {:download_path, Path.t()} | {:s3_download_config, keyword()} | {:thumbnails_ctx, thumbnails_ctx()} | {:only_rids, [ExWebRTC.MediaStreamTrack.rid() | nil]} | {:reorder_buffer_size, pos_integer()} | {:reencode_ctx, reencode_ctx()}
Options that can be passed to convert!/2.
:output_path- Directory where Converter will save its artifacts../converter/outputby default.:s3_upload_config- If passed, processed recordings will be uploaded to S3-compatible storage. SeeExWebRTC.Recorder.S3.upload_config/0for more info.:download_path- Directory where Converter will save files fetched from S3../converter/downloadby default.:s3_download_config- Optional S3 config overrides used when fetching files. SeeExWebRTC.Recorder.S3.override_config/0for more info.:thumbnails_ctx- If passed, Converter will generate thumbnails for the output files. Seethumbnails_ctx/0for more info.:only_rids- By default, when processing a video track with multiple layers (i.e. simulcast), Converter generates multiple output files, one per layer. If passed, Converter will only process the layers with RIDs present in this list. E.g. if you want to receive a single video file from the layer"h", pass["h"]. For single-layer tracks RID is set tonil, so if you want to handle both simulcast and regular tracks, pass["h", nil].:reorder_buffer_size- Size of the buffer used for reordering late packets.100by default. Increasing this value may help with "Decoded late RTP packet" warnings, but keep in mind that larger values slow the conversion process considerably.:reencode_ctx- If passed, Converter will reencode the video using FFmpeg. The keyframe interval of video tracks sent over WebRTC may vary, so this is helpful when you want to generate additional ones, to facilitate accurate seeking in the result file during playback. Keep in mind that reenncoding is slow and resource-intensive. Seereencode_ctx/0for more info.
@type options() :: [option()]
@type reencode_ctx() :: %{ optional(:threads) => pos_integer(), optional(:bitrate) => String.t(), optional(:crf) => 4..63, optional(:gop_size) => pos_integer(), optional(:resolution) => resolution(), optional(:cues_to_front) => boolean() }
Context for the video reencoding. See man ffmpeg for more details.
:threads- How many threads to use. Unlimited by default.:bitrate- Video bitrate the VP8 encoder shall strive for.1.5Mby default.:crf- Output video quality (lower is better).10by default.:gop_size- Keyframe interval.125by default.:resolution- Output video resolution. Inferred from the first video frame by default. Seeresolution/0for more info.:cues_to_front- Whether the muxer should put MKV Cues element at the front of the file, to aid with seeking e.g. when streaming the result file.trueby default.
@type resolution() :: %{ optional(:width) => pos_integer() | -1, optional(:height) => pos_integer() | -1 }
Resolution of reencoded video and generated thumbnails.
Make sure to provide at least one of the dimensions.
Setting the other dimension to -1 will fit the image to the aspect ratio.
@type thumbnails_ctx() :: %{resolution: resolution()}
Context for the thumbnail generation.
:resolution(required) - Thumbnail size. Seeresolution/0for more info.
Functions
@spec convert!(Path.t() | ExWebRTC.Recorder.Manifest.t(), options()) :: ExWebRTC.Recorder.Converter.Manifest.t() | no_return()
Converts the saved dumps of tracks in the manifest to WEBM files.
If passed a path as the first argument, loads the recording manifest from file.