mirror of
https://github.com/3b1b/manim.git
synced 2025-07-30 05:24:22 +08:00
Make ffmpeg_bin specification a piece of file_writer_config
This commit is contained in:
@ -66,8 +66,6 @@ DEGREES: float = TAU / 360
|
|||||||
# when juxtaposed with expressions like 30 * DEGREES
|
# when juxtaposed with expressions like 30 * DEGREES
|
||||||
RADIANS: float = 1
|
RADIANS: float = 1
|
||||||
|
|
||||||
FFMPEG_BIN: str = GLOBAL_CONFIG["ffmpeg_bin"]
|
|
||||||
|
|
||||||
JOINT_TYPE_MAP: dict = {
|
JOINT_TYPE_MAP: dict = {
|
||||||
"no_joint": 0,
|
"no_joint": 0,
|
||||||
"auto": 1,
|
"auto": 1,
|
||||||
|
@ -49,6 +49,9 @@ file_writer:
|
|||||||
# easier when working with the broken up scene, which
|
# easier when working with the broken up scene, which
|
||||||
# effectively has cuts at all the places you might want.
|
# effectively has cuts at all the places you might want.
|
||||||
break_into_partial_movies: False
|
break_into_partial_movies: False
|
||||||
|
# What command to use for ffmpeg
|
||||||
|
ffmpeg_bin: "ffmpeg"
|
||||||
|
# Parameters to pass into ffmpeg
|
||||||
video_codec: "libx264"
|
video_codec: "libx264"
|
||||||
pixel_format: "yuv420p"
|
pixel_format: "yuv420p"
|
||||||
saturation: 1.0
|
saturation: 1.0
|
||||||
@ -144,7 +147,5 @@ colors:
|
|||||||
light_pink: "#DC75CD"
|
light_pink: "#DC75CD"
|
||||||
green_screen: "#00FF00"
|
green_screen: "#00FF00"
|
||||||
orange: "#FF862F"
|
orange: "#FF862F"
|
||||||
# What command to use for ffmpeg
|
|
||||||
ffmpeg_bin: "ffmpeg"
|
|
||||||
universal_import_line: "from manimlib import *"
|
universal_import_line: "from manimlib import *"
|
||||||
ignore_manimlib_modules_on_reload: True
|
ignore_manimlib_modules_on_reload: True
|
||||||
|
@ -11,7 +11,6 @@ from pydub import AudioSegment
|
|||||||
from tqdm.auto import tqdm as ProgressDisplay
|
from tqdm.auto import tqdm as ProgressDisplay
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from manimlib.constants import FFMPEG_BIN
|
|
||||||
from manimlib.logger import log
|
from manimlib.logger import log
|
||||||
from manimlib.mobject.mobject import Mobject
|
from manimlib.mobject.mobject import Mobject
|
||||||
from manimlib.utils.file_ops import add_extension_if_not_present
|
from manimlib.utils.file_ops import add_extension_if_not_present
|
||||||
@ -49,6 +48,8 @@ class SceneFileWriter(object):
|
|||||||
quiet: bool = False,
|
quiet: bool = False,
|
||||||
total_frames: int = 0,
|
total_frames: int = 0,
|
||||||
progress_description_len: int = 40,
|
progress_description_len: int = 40,
|
||||||
|
# Name of the binary used for ffmpeg
|
||||||
|
ffmpeg_bin: str = "ffmpeg",
|
||||||
video_codec: str = "libx264",
|
video_codec: str = "libx264",
|
||||||
pixel_format: str = "yuv420p",
|
pixel_format: str = "yuv420p",
|
||||||
saturation: float = 1.0,
|
saturation: float = 1.0,
|
||||||
@ -70,6 +71,7 @@ class SceneFileWriter(object):
|
|||||||
self.quiet = quiet
|
self.quiet = quiet
|
||||||
self.total_frames = total_frames
|
self.total_frames = total_frames
|
||||||
self.progress_description_len = progress_description_len
|
self.progress_description_len = progress_description_len
|
||||||
|
self.ffmpeg_bin = ffmpeg_bin
|
||||||
self.video_codec = video_codec
|
self.video_codec = video_codec
|
||||||
self.pixel_format = pixel_format
|
self.pixel_format = pixel_format
|
||||||
self.saturation = saturation
|
self.saturation = saturation
|
||||||
@ -236,7 +238,7 @@ class SceneFileWriter(object):
|
|||||||
vf_arg += f',eq=saturation={self.saturation}:gamma={self.gamma}'
|
vf_arg += f',eq=saturation={self.saturation}:gamma={self.gamma}'
|
||||||
|
|
||||||
command = [
|
command = [
|
||||||
FFMPEG_BIN,
|
self.ffmpeg_bin,
|
||||||
'-y', # overwrite output file if it exists
|
'-y', # overwrite output file if it exists
|
||||||
'-f', 'rawvideo',
|
'-f', 'rawvideo',
|
||||||
'-s', f'{width}x{height}', # size of one frame
|
'-s', f'{width}x{height}', # size of one frame
|
||||||
@ -358,7 +360,7 @@ class SceneFileWriter(object):
|
|||||||
|
|
||||||
movie_file_path = self.get_movie_file_path()
|
movie_file_path = self.get_movie_file_path()
|
||||||
commands = [
|
commands = [
|
||||||
FFMPEG_BIN,
|
self.ffmpeg_bin,
|
||||||
'-y', # overwrite output file if it exists
|
'-y', # overwrite output file if it exists
|
||||||
'-f', 'concat',
|
'-f', 'concat',
|
||||||
'-safe', '0',
|
'-safe', '0',
|
||||||
@ -385,7 +387,7 @@ class SceneFileWriter(object):
|
|||||||
)
|
)
|
||||||
temp_file_path = stem + "_temp" + ext
|
temp_file_path = stem + "_temp" + ext
|
||||||
commands = [
|
commands = [
|
||||||
FFMPEG_BIN,
|
self.ffmpeg_bin,
|
||||||
"-i", movie_file_path,
|
"-i", movie_file_path,
|
||||||
"-i", sound_file_path,
|
"-i", sound_file_path,
|
||||||
'-y', # overwrite output file if it exists
|
'-y', # overwrite output file if it exists
|
||||||
|
Reference in New Issue
Block a user