From 3e65d218176d824251791702bf36c24a081cc116 Mon Sep 17 00:00:00 2001 From: Xintao Date: Tue, 14 Dec 2021 00:12:36 +0800 Subject: [PATCH] fix ffmpeg framerate bug --- docs/anime_video_model.md | 4 ++-- inference_realesrgan_video.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/anime_video_model.md b/docs/anime_video_model.md index 44a9909..e34ad80 100644 --- a/docs/anime_video_model.md +++ b/docs/anime_video_model.md @@ -81,7 +81,7 @@ ffmpeg -i onepiece_demo.mp4 -qscale:v 1 -qmin 1 -qmax 1 -vsync 0 tmp_frames/fram 2. Merge frames ```bash - ffmpeg -i out_frames/frame%08d.jpg -c:v libx264 -r 23.98 -pix_fmt yuv420p output.mp4 + ffmpeg -r 23.98 -i out_frames/frame%08d.jpg -c:v libx264 -r 23.98 -pix_fmt yuv420p output.mp4 ``` ```console @@ -95,7 +95,7 @@ ffmpeg -i onepiece_demo.mp4 -qscale:v 1 -qmin 1 -qmax 1 -vsync 0 tmp_frames/fram If you also want to copy audio from the input videos, run: ```bash - ffmpeg -i out_frames/frame%08d.jpg -i onepiece_demo.mp4 -map 0:v:0 -map 1:a:0 -c:a copy -c:v libx264 -r 23.98 -pix_fmt yuv420p output_w_audio.mp4 + ffmpeg -r 23.98 -i out_frames/frame%08d.jpg -i onepiece_demo.mp4 -map 0:v:0 -map 1:a:0 -c:a copy -c:v libx264 -r 23.98 -pix_fmt yuv420p output_w_audio.mp4 ``` ```console diff --git a/inference_realesrgan_video.py b/inference_realesrgan_video.py index c0786d5..639b848 100644 --- a/inference_realesrgan_video.py +++ b/inference_realesrgan_video.py @@ -186,7 +186,7 @@ def main(): f'ffmpeg -r {args.fps} -i {save_frame_folder}/frame%08d_out.{extension} -i {args.input}' f' -map 0:v:0 -map 1:a:0 -c:a copy -c:v libx264 -r {args.fps} -pix_fmt yuv420p {video_save_path}') else: - os.system(f'ffmpeg -i {save_frame_folder}/frame%08d_out.{extension} ' + os.system(f'ffmpeg -r {args.fps} -i {save_frame_folder}/frame%08d_out.{extension} ' f'-c:v libx264 -r {args.fps} -pix_fmt yuv420p {video_save_path}') # delete tmp file