From 4e4ff31aec43aee5904a83921f022652986ab5c6 Mon Sep 17 00:00:00 2001 From: jerry Date: Sun, 12 Feb 2023 23:46:08 +0800 Subject: [PATCH] fix ffmpeg cmd --- .gitignore | 1 + README.md | 23 ++++++++++++----------- aurora-cli/src/lib.rs | 32 ++++++++++++++++++++++---------- 3 files changed, 35 insertions(+), 21 deletions(-) diff --git a/.gitignore b/.gitignore index 531b0c2..afb72a9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /target +/ffmpeg /rife-ncnn-vulkan example* output* \ No newline at end of file diff --git a/README.md b/README.md index 12e2394..8bf78fa 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,27 @@ # Aurora -Video **Frame Interpolation** using machine learning. +Video **Frame Interpolation** using machine learning -Free and **TRUE** open source. +Free and **TRUE** open source -## Prerequired +## 🚀 How to run -* Download [FFmpeg](https://ffmpeg.org/download.html) and add it to the `PATH` environment variable. -* Download [rife-ncnn-vulkan release](https://github.com/nihui/rife-ncnn-vulkan/releases) according to your system, extract it, rename it to `rife-ncnn-vulkan`, and put it in the root directory of the project. +1. Download [release](https://github.com/jerryshell/aurora/releases) according to your system -## Run +2. Edit `.env` file with your preferred text editor -```bash -VIDEO_GLOB=*.mp4 FRAME_MULTIPLE=2 aurora-cli -``` +3. Run `aurora-cli` or `aurora-cli.exe` + +## 🔧 Fix: vulkan-1.dll is missing from your computer + +[Install Vulkan Runtime](https://vulkan.lunarg.com/sdk/home) -## Fix: macOS cannot verify that this app is free from malware +## 🔧 Fix: macOS cannot verify that this app is free from malware ```bash xattr -dr com.apple.quarantine rife-ncnn-vulkan ``` -## License +## 📄 License [GNU Affero General Public License v3.0](https://choosealicense.com/licenses/agpl-3.0) diff --git a/aurora-cli/src/lib.rs b/aurora-cli/src/lib.rs index ffbf0ec..466f0c7 100644 --- a/aurora-cli/src/lib.rs +++ b/aurora-cli/src/lib.rs @@ -17,9 +17,13 @@ fn extract_audio(video_filename: &str) -> String { println!("video_extract_audio_filename: {video_extract_audio_filename}"); let extract_audio_cmd_str = if cfg!(target_os = "windows") { - format!("ffmpeg.exe -y -i {video_filename} -vn -acodec copy {video_extract_audio_filename}") + format!( + r"ffmpeg\ffmpeg.exe -y -i {video_filename} -vn -acodec copy {video_extract_audio_filename}" + ) } else { - format!("ffmpeg -y -i {video_filename} -vn -acodec copy {video_extract_audio_filename}") + format!( + r"ffmpeg/ffmpeg -y -i {video_filename} -vn -acodec copy {video_extract_audio_filename}" + ) }; println!("extract_audio_cmd_str: {extract_audio_cmd_str}"); @@ -40,9 +44,9 @@ fn video_frames_dir_mkdir(video_filename: &str) -> String { fn decode_frames(video_filename: &str, video_frames_dir_name: &str) { let decode_frames_cmd_str = if cfg!(target_os = "windows") { - format!("ffmpeg.exe -y -i {video_filename} {video_frames_dir_name}/frame_%08d.png") + format!(r"ffmpeg\ffmpeg.exe -y -i {video_filename} {video_frames_dir_name}/frame_%08d.png") } else { - format!("ffmpeg -y -i {video_filename} {video_frames_dir_name}/frame_%08d.png") + format!(r"ffmpeg/ffmpeg -y -i {video_filename} {video_frames_dir_name}/frame_%08d.png") }; println!("decode_frames_cmd_str: {decode_frames_cmd_str}"); @@ -59,9 +63,9 @@ fn get_origin_frame_count(video_frames_dir_name: &str) -> usize { fn get_origin_frame_rate(video_filename: &str) -> f32 { let ffprobe_cmd_str = if cfg!(target_os = "windows") { - format!("ffprobe.exe {video_filename}") + format!(r"ffmpeg\ffprobe.exe {video_filename}") } else { - format!("ffprobe {video_filename}") + format!(r"ffmpeg/ffprobe {video_filename}") }; println!("ffprobe_cmd_str: {ffprobe_cmd_str}"); @@ -104,9 +108,13 @@ fn interpolate_frame( video_interpolate_frames_dir_name: &str, ) { let interpolate_frame_cmd_str = if cfg!(target_os = "windows") { - format!("rife-ncnn-vulkan/rife-ncnn-vulkan.exe -m rife-v4.6 -n {target_frame_count} -i {video_frames_dir_name} -o {video_interpolate_frames_dir_name}") + format!( + r"rife-ncnn-vulkan\rife-ncnn-vulkan.exe -m rife-v4.6 -n {target_frame_count} -i {video_frames_dir_name} -o {video_interpolate_frames_dir_name}" + ) } else { - format!("rife-ncnn-vulkan/rife-ncnn-vulkan -m rife-v4.6 -n {target_frame_count} -i {video_frames_dir_name} -o {video_interpolate_frames_dir_name}") + format!( + r"rife-ncnn-vulkan/rife-ncnn-vulkan -m rife-v4.6 -n {target_frame_count} -i {video_frames_dir_name} -o {video_interpolate_frames_dir_name}" + ) }; println!("interpolate_frame_cmd_str: {interpolate_frame_cmd_str}"); @@ -120,9 +128,13 @@ fn encode_video( video_filename: &str, ) { let encode_video_cmd_str = if cfg!(target_os = "windows") { - format!("ffmpeg.exe -y -framerate {target_frame_rate} -i {video_interpolate_frames_dir_name}/%08d.png -i {video_filename}_audio.m4a -c:a copy -crf 20 -c:v libx264 -pix_fmt yuv420p output_{video_filename}.mp4") + format!( + r"ffmpeg\ffmpeg.exe -y -framerate {target_frame_rate} -i {video_interpolate_frames_dir_name}/%08d.png -i {video_filename}_audio.m4a -c:a copy -crf 20 -c:v libx264 -pix_fmt yuv420p output_{video_filename}.mp4" + ) } else { - format!("ffmpeg -y -framerate {target_frame_rate} -i {video_interpolate_frames_dir_name}/%08d.png -i {video_filename}_audio.m4a -c:a copy -crf 20 -c:v libx264 -pix_fmt yuv420p output_{video_filename}.mp4") + format!( + r"ffmpeg/ffmpeg -y -framerate {target_frame_rate} -i {video_interpolate_frames_dir_name}/%08d.png -i {video_filename}_audio.m4a -c:a copy -crf 20 -c:v libx264 -pix_fmt yuv420p output_{video_filename}.mp4" + ) }; println!("encode_video_cmd_str: {encode_video_cmd_str}");