This commit is contained in:
ochibani 2025-01-18 21:56:54 +02:00
parent 58f516c40a
commit e353283f49
No known key found for this signature in database
GPG Key ID: 2C6B61CE0C704ED4
2 changed files with 24 additions and 23 deletions

View File

@ -296,28 +296,23 @@ impl Ffmpeg {
return Err(Error::msg("Unable to validate tmp video file."));
}
}
if is_input_audio_record(&self.temp_input_audio_filename) ||
is_output_audio_record(&self.temp_output_audio_filename) {
let mut ffmpeg_command = FfmpegCommand::new();
ffmpeg_command.input(&self.temp_video_filename);
ffmpeg_command.format("ogg");
if is_input_audio_record(&self.temp_input_audio_filename) {
ffmpeg_command.input(&self.temp_input_audio_filename);
}
if is_output_audio_record(&self.temp_output_audio_filename) {
ffmpeg_command.input(&self.temp_output_audio_filename);
}
ffmpeg_command.args([
"-c:a",
"aac",
&self.saved_filename.clone()
]);
ffmpeg_command.overwrite()
.spawn()?
.wait()?;
} else {
std::fs::copy(&self.temp_video_filename, &self.saved_filename)?;
}
let mut ffmpeg_command = FfmpegCommand::new();
ffmpeg_command.input(&self.temp_video_filename);
ffmpeg_command.format("ogg");
if is_input_audio_record(&self.temp_input_audio_filename) {
ffmpeg_command.input(&self.temp_input_audio_filename);
}
if is_output_audio_record(&self.temp_output_audio_filename) {
ffmpeg_command.input(&self.temp_output_audio_filename);
}
ffmpeg_command.args([
"-c:a",
"aac",
&self.filename,
]);
ffmpeg_command.overwrite()
.spawn()?
.wait()?;
} else {
// Validate video file integrity
let start_time = Instant::now();
@ -590,7 +585,7 @@ impl Ffmpeg {
// Stop video recording
pub fn stop_video(&mut self) -> Result<()> {
// Kill the process to stop recording
// Quit the process to stop recording
if self.video_process.is_some() {
self.video_process
.clone()

View File

@ -37,9 +37,12 @@ pub struct Ffmpeg {
pub record_delay: u16,
pub record_frames: u16,
pub video_record_bitrate: u16,
pub audio_input_switch: bool,
pub audio_output_switch: bool,
pub follow_mouse: bool,
pub record_mouse: bool,
pub show_area: bool,
pub video_switch: bool,
}
#[cfg(feature = "gtk")]
@ -62,9 +65,12 @@ pub struct Ffmpeg {
pub record_delay: SpinButton,
pub record_frames: SpinButton,
pub video_record_bitrate: SpinButton,
pub audio_input_switch: CheckButton,
pub audio_output_switch: CheckButton,
pub follow_mouse: CheckButton,
pub record_mouse: CheckButton,
pub show_area: CheckButton,
pub video_switch: CheckButton,
}
#[cfg(feature = "cmd")]