Fix transparent background videos

This commit is contained in:
Grant Sanderson
2023-02-15 09:38:35 -08:00
parent 01c51dbc6d
commit 557cb66c52
2 changed files with 7 additions and 2 deletions

View File

@ -420,11 +420,12 @@ def get_file_writer_config(args: Namespace, custom_config: dict) -> dict:
result["video_codec"] = args.vcodec
elif args.transparent:
result["video_codec"] = 'prores_ks'
result["pixel_format"] = ''
elif args.gif:
result["video_codec"] = ''
if args.pix_fmt:
result["pix_fmt"] = args.pix_fmt
result["pixel_format"] = args.pix_fmt
return result

View File

@ -258,6 +258,10 @@ class SceneFileWriter(object):
fps = self.scene.camera.fps
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 = [
FFMPEG_BIN,
'-y', # overwrite output file if it exists
@ -266,7 +270,7 @@ class SceneFileWriter(object):
'-pix_fmt', 'rgba',
'-r', str(fps), # frames per second
'-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
'-loglevel', 'error',
]