pub struct ExportPreset {
pub name: String,
pub video: Option<VideoEncoderConfig>,
pub audio: AudioEncoderConfig,
}Expand description
A named export preset combining video and audio encoder configuration.
Create a predefined preset with ExportPreset::youtube_1080p() etc., or
build a custom one as a struct literal. Call validate()
before encoding to catch platform-constraint violations early.
video: None indicates an audio-only preset (e.g. podcast_mono).
§Examples
use ff_encode::{ExportPreset, VideoEncoder};
let preset = ExportPreset::youtube_1080p();
preset.validate()?;
let mut encoder = preset
.apply_video(VideoEncoder::create("output.mp4"))
.build()?;Fields§
§name: StringHuman-readable name (e.g. "youtube_1080p").
video: Option<VideoEncoderConfig>Video encoder configuration. None = audio-only preset.
audio: AudioEncoderConfigAudio encoder configuration.
Implementations§
Source§impl ExportPreset
impl ExportPreset
Sourcepub fn youtube_1080p() -> Self
pub fn youtube_1080p() -> Self
YouTube 1080p preset: H.264, CRF 18, 1920×1080, 30 fps, AAC 192 kbps.
Sourcepub fn youtube_4k() -> Self
pub fn youtube_4k() -> Self
YouTube 4K preset: H.265, CRF 20, 3840×2160, 30 fps, AAC 256 kbps.
Sourcepub fn instagram_square() -> Self
pub fn instagram_square() -> Self
Instagram Square preset: H.264, CRF 23, 1080×1080, 30 fps, AAC 128 kbps.
Sourcepub fn instagram_reels() -> Self
pub fn instagram_reels() -> Self
Instagram Reels preset: H.264, CRF 23, 1080×1920, 30 fps, AAC 128 kbps.
Sourcepub fn bluray_1080p() -> Self
pub fn bluray_1080p() -> Self
Blu-ray 1080p preset: H.264, CRF 18, 1920×1080, 24 fps, AC-3 384 kbps.
Sourcepub fn podcast_mono() -> Self
pub fn podcast_mono() -> Self
Podcast mono preset (audio-only): AAC 128 kbps, mono, 48 kHz.
Sourcepub fn lossless_rgb() -> Self
pub fn lossless_rgb() -> Self
Lossless archive preset: FFV1 video (source resolution), FLAC audio.
Sourcepub fn web_h264() -> Self
pub fn web_h264() -> Self
Web H.264 preset (VP9): VP9, CRF 33, 1280×720, 30 fps, Opus 128 kbps.
Sourcepub fn validate(&self) -> Result<(), EncodeError>
pub fn validate(&self) -> Result<(), EncodeError>
Validates this preset against platform-specific constraints.
Call this before passing the preset to apply_video
or apply_audio to surface constraint violations
before encoding begins.
§Errors
Returns EncodeError::PresetConstraintViolation when a platform rule
is violated (e.g. fps > 60 on a YouTube preset, or wrong aspect ratio
on an Instagram preset).
Sourcepub fn apply_video(&self, builder: VideoEncoderBuilder) -> VideoEncoderBuilder
pub fn apply_video(&self, builder: VideoEncoderBuilder) -> VideoEncoderBuilder
Applies the video configuration to a VideoEncoderBuilder.
Sets the codec and bitrate mode unconditionally. Resolution and frame
rate are only applied when all three (width, height, fps) are
Some. Pixel format and per-codec options are applied when present.
Returns builder unchanged when video is None
(audio-only preset).
Sourcepub fn apply_audio(&self, builder: VideoEncoderBuilder) -> VideoEncoderBuilder
pub fn apply_audio(&self, builder: VideoEncoderBuilder) -> VideoEncoderBuilder
Applies the audio configuration to a VideoEncoderBuilder.
Sets sample rate, channel count, codec, and bitrate.
Trait Implementations§
Source§impl Clone for ExportPreset
impl Clone for ExportPreset
Source§fn clone(&self) -> ExportPreset
fn clone(&self) -> ExportPreset
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more