pub struct LiveDashOutput { /* private fields */ }Expand description
Live DASH output: receives frames and writes a manifest.mpd playlist.
Build with LiveDashOutput::new, chain setter methods, then call
build to open the FFmpeg contexts. After build():
push_videoandpush_audioencode and mux frames in real time.StreamOutput::finishflushes all encoders and writes the DASH trailer.
The output directory is created automatically by build() if it does not exist.
Implementations§
Source§impl LiveDashOutput
impl LiveDashOutput
Sourcepub fn video(self, width: u32, height: u32, fps: f64) -> Self
pub fn video(self, width: u32, height: u32, fps: f64) -> Self
Set the video encoding parameters.
This method must be called before build.
Sourcepub fn audio(self, sample_rate: u32, channels: u32) -> Self
pub fn audio(self, sample_rate: u32, channels: u32) -> Self
Enable audio output with the given sample rate and channel count.
If this method is not called, audio is disabled.
Sourcepub fn segment_duration(self, duration: Duration) -> Self
pub fn segment_duration(self, duration: Duration) -> Self
Set the target DASH segment duration.
Default: 4 seconds.
Sourcepub fn video_codec(self, codec: VideoCodec) -> Self
pub fn video_codec(self, codec: VideoCodec) -> Self
Set the video codec.
Default: VideoCodec::H264.
Sourcepub fn audio_codec(self, codec: AudioCodec) -> Self
pub fn audio_codec(self, codec: AudioCodec) -> Self
Set the audio codec.
Default: AudioCodec::Aac.
Sourcepub fn video_bitrate(self, bitrate: u64) -> Self
pub fn video_bitrate(self, bitrate: u64) -> Self
Set the video encoder target bit rate in bits/s.
Default: 2 000 000 (2 Mbit/s).
Sourcepub fn audio_bitrate(self, bitrate: u64) -> Self
pub fn audio_bitrate(self, bitrate: u64) -> Self
Set the audio encoder target bit rate in bits/s.
Default: 128 000 (128 kbit/s).
Sourcepub fn build(self) -> Result<Self, StreamError>
pub fn build(self) -> Result<Self, StreamError>
Open all FFmpeg contexts and write the DASH header.
§Errors
Returns StreamError::InvalidConfig when:
output_diris empty.videowas not called beforebuild.
Returns StreamError::Io when the output directory cannot be created.
Returns StreamError::Ffmpeg when any FFmpeg operation fails.