21 lines
975 B
Rust
21 lines
975 B
Rust
use crate::configuration::ConfigFFmpeg;
|
|
use crate::ffmpeg::FFmpegCommandOptions;
|
|
|
|
impl ConfigFFmpeg {
|
|
pub fn build_command_options<S: Into<String>>(&self, input_path: S, output_path: S) -> FFmpegCommandOptions {
|
|
FFmpegCommandOptions {
|
|
input: input_path.into(),
|
|
output: output_path.into(),
|
|
|
|
video_codec: self.output.video.codec.clone(),
|
|
video_bitrate: if self.output.video.bitrate > 0 { Some(self.output.video.bitrate) } else { None },
|
|
video_crf: if self.output.video.crf > 0 { Some(self.output.video.crf) } else { None },
|
|
|
|
audio_codec: self.output.audio.codec.clone(),
|
|
audio_bitrate: if self.output.audio.bitrate > 0 { Some(self.output.audio.bitrate) } else { None },
|
|
|
|
threads: if self.process.threads > 0 { Some(self.process.threads) } else { None },
|
|
niceness: if self.process.niceness > 0 { Some(self.process.niceness) } else { None },
|
|
}
|
|
}
|
|
} |