Blender image sequences now generate a preview mp4 on completion

This commit is contained in:
Brett Williams
2023-05-27 16:01:54 -05:00
parent 55591c10e1
commit eaacbf4ec0
5 changed files with 28 additions and 5 deletions

View File

@@ -1,5 +1,6 @@
import subprocess
import ffmpeg # todo: remove all references to ffmpeg library and instead use direct subprocesses
from ..render_engines.ffmpeg_engine import FFMPEG
def file_info(path):
@@ -10,9 +11,9 @@ def file_info(path):
return None
def image_sequence_to_video(source_glob_pattern, output_path, framerate="24", encoder="libx264"):
subprocess.run(['ffmpeg', "-y", "-framerate", framerate, "-pattern_type", "glob", "-i", f"{source_glob_pattern}",
"-c:v", encoder, output_path])
def image_sequence_to_video(source_glob_pattern, output_path, framerate="24", encoder="libx264", pix_fmt="yuv420p"):
subprocess.run([FFMPEG.renderer_path(), "-framerate", str(framerate), "-i", f"{source_glob_pattern}",
"-c:v", encoder, "-pix_fmt", pix_fmt, output_path], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
def save_first_frame(source_path, dest_path, max_width=1280, run_async=False):