mirror of
https://github.com/xlmnxp/blue-recorder.git
synced 2024-11-23 17:13:11 +03:00
remove temporary video file when recording video only
This commit is contained in:
parent
75df858dbe
commit
6c049e4280
@ -256,17 +256,6 @@ impl Ffmpeg {
|
|||||||
|
|
||||||
if is_video_record {
|
if is_video_record {
|
||||||
if !is_wayland() {
|
if !is_wayland() {
|
||||||
let mut move_command = Command::new("mv");
|
|
||||||
move_command.args([
|
|
||||||
self.saved_filename.as_ref().unwrap().as_str(),
|
|
||||||
if is_audio_record {
|
|
||||||
video_filename.as_str()
|
|
||||||
} else {
|
|
||||||
self.saved_filename.as_ref().unwrap()
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
move_command.output().unwrap();
|
|
||||||
} else {
|
|
||||||
// convert webm to specified format
|
// convert webm to specified format
|
||||||
Command::new("ffmpeg")
|
Command::new("ffmpeg")
|
||||||
.args([
|
.args([
|
||||||
@ -285,8 +274,19 @@ impl Ffmpeg {
|
|||||||
])
|
])
|
||||||
.output()
|
.output()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
} else {
|
||||||
|
let mut move_command = Command::new("mv");
|
||||||
|
move_command.args([
|
||||||
|
self.saved_filename.as_ref().unwrap().as_str(),
|
||||||
|
if is_audio_record {
|
||||||
|
video_filename.as_str()
|
||||||
|
} else {
|
||||||
|
self.saved_filename.as_ref().unwrap()
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
move_command.output().unwrap();
|
||||||
}
|
}
|
||||||
// if audio record, then merge video with audio
|
// if audio record, then merge video and audio
|
||||||
if is_audio_record {
|
if is_audio_record {
|
||||||
Command::new("ffmpeg")
|
Command::new("ffmpeg")
|
||||||
.args([
|
.args([
|
||||||
@ -303,14 +303,13 @@ impl Ffmpeg {
|
|||||||
self.saved_filename.as_ref().unwrap(),
|
self.saved_filename.as_ref().unwrap(),
|
||||||
"-y",
|
"-y",
|
||||||
])
|
])
|
||||||
.spawn()
|
.output()
|
||||||
.expect("failed to merge video with audio")
|
.expect("failed to merge video and audio");
|
||||||
.wait()
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
std::fs::remove_file(video_filename).unwrap();
|
|
||||||
std::fs::remove_file(audio_filename).unwrap();
|
std::fs::remove_file(audio_filename).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::fs::remove_file(video_filename).unwrap();
|
||||||
}
|
}
|
||||||
// if only audio is recording then convert it to chosen format
|
// if only audio is recording then convert it to chosen format
|
||||||
else if is_audio_record {
|
else if is_audio_record {
|
||||||
|
Loading…
Reference in New Issue
Block a user