mirror of
https://github.com/3b1b/manim.git
synced 2025-08-05 16:49:03 +00:00
Fix transparent background videos
This commit is contained in:
parent
01c51dbc6d
commit
557cb66c52
2 changed files with 7 additions and 2 deletions
|
@ -420,11 +420,12 @@ def get_file_writer_config(args: Namespace, custom_config: dict) -> dict:
|
||||||
result["video_codec"] = args.vcodec
|
result["video_codec"] = args.vcodec
|
||||||
elif args.transparent:
|
elif args.transparent:
|
||||||
result["video_codec"] = 'prores_ks'
|
result["video_codec"] = 'prores_ks'
|
||||||
|
result["pixel_format"] = ''
|
||||||
elif args.gif:
|
elif args.gif:
|
||||||
result["video_codec"] = ''
|
result["video_codec"] = ''
|
||||||
|
|
||||||
if args.pix_fmt:
|
if args.pix_fmt:
|
||||||
result["pix_fmt"] = args.pix_fmt
|
result["pixel_format"] = args.pix_fmt
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
|
@ -258,6 +258,10 @@ class SceneFileWriter(object):
|
||||||
fps = self.scene.camera.fps
|
fps = self.scene.camera.fps
|
||||||
width, height = self.scene.camera.get_pixel_shape()
|
width, height = self.scene.camera.get_pixel_shape()
|
||||||
|
|
||||||
|
vf_arg = 'vflip'
|
||||||
|
if self.pixel_format.startswith("yuv"):
|
||||||
|
vf_arg += f',eq=saturation={self.saturation}:gamma={self.gamma}'
|
||||||
|
|
||||||
command = [
|
command = [
|
||||||
FFMPEG_BIN,
|
FFMPEG_BIN,
|
||||||
'-y', # overwrite output file if it exists
|
'-y', # overwrite output file if it exists
|
||||||
|
@ -266,7 +270,7 @@ class SceneFileWriter(object):
|
||||||
'-pix_fmt', 'rgba',
|
'-pix_fmt', 'rgba',
|
||||||
'-r', str(fps), # frames per second
|
'-r', str(fps), # frames per second
|
||||||
'-i', '-', # The input comes from a pipe
|
'-i', '-', # The input comes from a pipe
|
||||||
'-vf', f'vflip,eq=saturation={self.saturation}:gamma={self.gamma}',
|
'-vf', vf_arg,
|
||||||
'-an', # Tells FFMPEG not to expect any audio
|
'-an', # Tells FFMPEG not to expect any audio
|
||||||
'-loglevel', 'error',
|
'-loglevel', 'error',
|
||||||
]
|
]
|
||||||
|
|
Loading…
Add table
Reference in a new issue