Update main.rs
Browse files
main.rs
CHANGED
|
@@ -570,7 +570,7 @@ async fn process_video_task(
|
|
| 570 |
|
| 571 |
// Build FFmpeg command - FIXED
|
| 572 |
let mut bg_args: Vec<&str> = Vec::new();
|
| 573 |
-
let mut temp_strings = Vec::new(); // Store temporary strings to keep them alive
|
| 574 |
|
| 575 |
if video_dur > audio_dur {
|
| 576 |
let max_start = video_dur - audio_dur;
|
|
@@ -578,25 +578,26 @@ async fn process_video_task(
|
|
| 578 |
let ss_arg = format!("{:.3}", start);
|
| 579 |
let t_arg = format!("{:.3}", audio_dur);
|
| 580 |
|
| 581 |
-
temp_strings.push(ss_arg);
|
| 582 |
-
temp_strings.push(t_arg);
|
| 583 |
-
|
| 584 |
bg_args.push("-ss");
|
| 585 |
-
bg_args.push(
|
| 586 |
bg_args.push("-t");
|
| 587 |
-
bg_args.push(
|
| 588 |
bg_args.push("-i");
|
| 589 |
bg_args.push(bg_path.to_str().unwrap());
|
|
|
|
|
|
|
|
|
|
|
|
|
| 590 |
} else {
|
| 591 |
let loop_n = ((audio_dur / video_dur) as i32) + 2;
|
| 592 |
let loop_arg = loop_n.to_string();
|
| 593 |
|
| 594 |
-
temp_strings.push(loop_arg);
|
| 595 |
-
|
| 596 |
bg_args.push("-stream_loop");
|
| 597 |
-
bg_args.push(
|
| 598 |
bg_args.push("-i");
|
| 599 |
bg_args.push(bg_path.to_str().unwrap());
|
|
|
|
|
|
|
| 600 |
}
|
| 601 |
|
| 602 |
let subs_str = subs_path.to_str().unwrap().replace("\\", "/").replace(":", "\\:");
|
|
@@ -638,11 +639,11 @@ async fn process_video_task(
|
|
| 638 |
|
| 639 |
// Add duration argument
|
| 640 |
let t_arg = format!("{:.3}", audio_dur);
|
| 641 |
-
temp_strings.push(t_arg);
|
| 642 |
cmd_args.extend_from_slice(&[
|
| 643 |
-
"-t",
|
| 644 |
output_path.to_str().unwrap(),
|
| 645 |
]);
|
|
|
|
| 646 |
|
| 647 |
let mut updates = HashMap::new();
|
| 648 |
updates.insert("progress", serde_json::json!(40));
|
|
|
|
| 570 |
|
| 571 |
// Build FFmpeg command - FIXED
|
| 572 |
let mut bg_args: Vec<&str> = Vec::new();
|
| 573 |
+
let mut temp_strings: Vec<String> = Vec::new(); // Store temporary strings to keep them alive
|
| 574 |
|
| 575 |
if video_dur > audio_dur {
|
| 576 |
let max_start = video_dur - audio_dur;
|
|
|
|
| 578 |
let ss_arg = format!("{:.3}", start);
|
| 579 |
let t_arg = format!("{:.3}", audio_dur);
|
| 580 |
|
|
|
|
|
|
|
|
|
|
| 581 |
bg_args.push("-ss");
|
| 582 |
+
bg_args.push(&ss_arg);
|
| 583 |
bg_args.push("-t");
|
| 584 |
+
bg_args.push(&t_arg);
|
| 585 |
bg_args.push("-i");
|
| 586 |
bg_args.push(bg_path.to_str().unwrap());
|
| 587 |
+
|
| 588 |
+
// Store strings after using them as &str
|
| 589 |
+
temp_strings.push(ss_arg);
|
| 590 |
+
temp_strings.push(t_arg);
|
| 591 |
} else {
|
| 592 |
let loop_n = ((audio_dur / video_dur) as i32) + 2;
|
| 593 |
let loop_arg = loop_n.to_string();
|
| 594 |
|
|
|
|
|
|
|
| 595 |
bg_args.push("-stream_loop");
|
| 596 |
+
bg_args.push(&loop_arg);
|
| 597 |
bg_args.push("-i");
|
| 598 |
bg_args.push(bg_path.to_str().unwrap());
|
| 599 |
+
|
| 600 |
+
temp_strings.push(loop_arg);
|
| 601 |
}
|
| 602 |
|
| 603 |
let subs_str = subs_path.to_str().unwrap().replace("\\", "/").replace(":", "\\:");
|
|
|
|
| 639 |
|
| 640 |
// Add duration argument
|
| 641 |
let t_arg = format!("{:.3}", audio_dur);
|
|
|
|
| 642 |
cmd_args.extend_from_slice(&[
|
| 643 |
+
"-t", &t_arg,
|
| 644 |
output_path.to_str().unwrap(),
|
| 645 |
]);
|
| 646 |
+
temp_strings.push(t_arg);
|
| 647 |
|
| 648 |
let mut updates = HashMap::new();
|
| 649 |
updates.insert("progress", serde_json::json!(40));
|