Less verbose ffmpeg outputs
This commit is contained in:
parent
82cafcdc8b
commit
030d6a698b
@ -47,6 +47,7 @@ options:
|
|||||||
maximum amount of RAM in GB to be used
|
maximum amount of RAM in GB to be used
|
||||||
--max-cores CORES_COUNT
|
--max-cores CORES_COUNT
|
||||||
number of cores to be use for CPU mode
|
number of cores to be use for CPU mode
|
||||||
|
--all-faces swap all faces in frame
|
||||||
```
|
```
|
||||||
|
|
||||||
Looking for a CLI mode? Using the -f/--face argument will make the program in cli mode.
|
Looking for a CLI mode? Using the -f/--face argument will make the program in cli mode.
|
||||||
|
@ -102,7 +102,7 @@ def start_processing():
|
|||||||
if args['gpu'] or n < 2:
|
if args['gpu'] or n < 2:
|
||||||
process_video(args['source_img'], args["frame_paths"])
|
process_video(args['source_img'], args["frame_paths"])
|
||||||
return
|
return
|
||||||
# multi thread if video frames to cpu cores ratio is 2
|
# multithread if total frames to cpu cores ratio is greater than 2
|
||||||
if n > 2:
|
if n > 2:
|
||||||
processes = []
|
processes = []
|
||||||
for i in range(0, len(frame_paths), n):
|
for i in range(0, len(frame_paths), n):
|
||||||
|
@ -31,24 +31,24 @@ def detect_fps(input_path):
|
|||||||
|
|
||||||
def set_fps(input_path, output_path, fps):
|
def set_fps(input_path, output_path, fps):
|
||||||
input_path, output_path = path(input_path), path(output_path)
|
input_path, output_path = path(input_path), path(output_path)
|
||||||
os.system(f'ffmpeg -i "{input_path}" -filter:v fps=fps={fps} "{output_path}"')
|
os.system(f'ffmpeg -i "{input_path}" -filter:v fps=fps={fps} "{output_path}" -loglevel error')
|
||||||
|
|
||||||
|
|
||||||
def create_video(video_name, fps, output_dir):
|
def create_video(video_name, fps, output_dir):
|
||||||
output_dir = path(output_dir)
|
output_dir = path(output_dir)
|
||||||
os.system(f'ffmpeg -framerate "{fps}" -i "{output_dir}{sep}%04d.png" -c:v libx264 -crf 7 -pix_fmt yuv420p -y "{output_dir}{sep}output.mp4"')
|
os.system(f'ffmpeg -framerate "{fps}" -i "{output_dir}{sep}%04d.png" -c:v libx264 -crf 7 -pix_fmt yuv420p -y "{output_dir}{sep}output.mp4" -loglevel error')
|
||||||
|
|
||||||
|
|
||||||
def extract_frames(input_path, output_dir):
|
def extract_frames(input_path, output_dir):
|
||||||
input_path, output_dir = path(input_path), path(output_dir)
|
input_path, output_dir = path(input_path), path(output_dir)
|
||||||
os.system(f'ffmpeg -i "{input_path}" "{output_dir}{sep}%04d.png"')
|
os.system(f'ffmpeg -i "{input_path}" "{output_dir}{sep}%04d.png" -loglevel error')
|
||||||
|
|
||||||
|
|
||||||
def add_audio(output_dir, target_path, video, keep_frames, output_file):
|
def add_audio(output_dir, target_path, video, keep_frames, output_file):
|
||||||
video_name = os.path.splitext(video)[0]
|
video_name = os.path.splitext(video)[0]
|
||||||
save_to = output_file if output_file else output_dir + "/swapped-" + video_name + ".mp4"
|
save_to = output_file if output_file else output_dir + "/swapped-" + video_name + ".mp4"
|
||||||
save_to_ff, output_dir_ff = path(save_to), path(output_dir)
|
save_to_ff, output_dir_ff = path(save_to), path(output_dir)
|
||||||
os.system(f'ffmpeg -i "{output_dir_ff}{sep}output.mp4" -i "{output_dir_ff}{sep}{video}" -c:v copy -map 0:v:0 -map 1:a:0 -y "{save_to_ff}"')
|
os.system(f'ffmpeg -i "{output_dir_ff}{sep}output.mp4" -i "{output_dir_ff}{sep}{video}" -c:v copy -map 0:v:0 -map 1:a:0 -y "{save_to_ff}" -loglevel error')
|
||||||
if not os.path.isfile(save_to):
|
if not os.path.isfile(save_to):
|
||||||
shutil.move(output_dir + "/output.mp4", save_to)
|
shutil.move(output_dir + "/output.mp4", save_to)
|
||||||
if not keep_frames:
|
if not keep_frames:
|
||||||
|
Loading…
Reference in New Issue
Block a user