Make ffmpeg_bin specification a piece of file_writer_config

This commit is contained in:
Grant Sanderson 2024-12-10 19:29:55 -06:00
parent d5c36de3c5
commit f9a44c9975
3 changed files with 9 additions and 8 deletions

View file

@ -66,8 +66,6 @@ DEGREES: float = TAU / 360
# when juxtaposed with expressions like 30 * DEGREES
RADIANS: float = 1
FFMPEG_BIN: str = GLOBAL_CONFIG["ffmpeg_bin"]
JOINT_TYPE_MAP: dict = {
"no_joint": 0,
"auto": 1,

View file

@ -49,6 +49,9 @@ file_writer:
# easier when working with the broken up scene, which
# effectively has cuts at all the places you might want.
break_into_partial_movies: False
# What command to use for ffmpeg
ffmpeg_bin: "ffmpeg"
# Parameters to pass into ffmpeg
video_codec: "libx264"
pixel_format: "yuv420p"
saturation: 1.0
@ -144,7 +147,5 @@ colors:
light_pink: "#DC75CD"
green_screen: "#00FF00"
orange: "#FF862F"
# What command to use for ffmpeg
ffmpeg_bin: "ffmpeg"
universal_import_line: "from manimlib import *"
ignore_manimlib_modules_on_reload: True

View file

@ -11,7 +11,6 @@ from pydub import AudioSegment
from tqdm.auto import tqdm as ProgressDisplay
from pathlib import Path
from manimlib.constants import FFMPEG_BIN
from manimlib.logger import log
from manimlib.mobject.mobject import Mobject
from manimlib.utils.file_ops import add_extension_if_not_present
@ -49,6 +48,8 @@ class SceneFileWriter(object):
quiet: bool = False,
total_frames: int = 0,
progress_description_len: int = 40,
# Name of the binary used for ffmpeg
ffmpeg_bin: str = "ffmpeg",
video_codec: str = "libx264",
pixel_format: str = "yuv420p",
saturation: float = 1.0,
@ -70,6 +71,7 @@ class SceneFileWriter(object):
self.quiet = quiet
self.total_frames = total_frames
self.progress_description_len = progress_description_len
self.ffmpeg_bin = ffmpeg_bin
self.video_codec = video_codec
self.pixel_format = pixel_format
self.saturation = saturation
@ -236,7 +238,7 @@ class SceneFileWriter(object):
vf_arg += f',eq=saturation={self.saturation}:gamma={self.gamma}'
command = [
FFMPEG_BIN,
self.ffmpeg_bin,
'-y', # overwrite output file if it exists
'-f', 'rawvideo',
'-s', f'{width}x{height}', # size of one frame
@ -358,7 +360,7 @@ class SceneFileWriter(object):
movie_file_path = self.get_movie_file_path()
commands = [
FFMPEG_BIN,
self.ffmpeg_bin,
'-y', # overwrite output file if it exists
'-f', 'concat',
'-safe', '0',
@ -385,7 +387,7 @@ class SceneFileWriter(object):
)
temp_file_path = stem + "_temp" + ext
commands = [
FFMPEG_BIN,
self.ffmpeg_bin,
"-i", movie_file_path,
"-i", sound_file_path,
'-y', # overwrite output file if it exists