Add option for gamma correction to SceneFileWriter

This commit is contained in:
Grant Sanderson 2023-02-08 20:09:33 -08:00
parent ded06c1f88
commit 3e3e4de5e9

View file

@ -49,7 +49,8 @@ class SceneFileWriter(object):
progress_description_len: int = 40,
video_codec: str = "libx264",
pixel_format: str = "yuv420p",
saturation: float = 1.7
saturation: float = 1.7,
gamma: float = 1.2,
):
self.scene: Scene = scene
self.write_to_movie = write_to_movie
@ -69,6 +70,7 @@ class SceneFileWriter(object):
self.video_codec = video_codec
self.pixel_format = pixel_format
self.saturation = saturation
self.gamma = gamma
# State during file writing
self.writing_process: sp.Popen | None = None
@ -264,7 +266,7 @@ class SceneFileWriter(object):
'-pix_fmt', 'rgba',
'-r', str(fps), # frames per second
'-i', '-', # The input comes from a pipe
'-vf', f'eq=saturation={self.saturation},vflip',
'-vf', f'vflip,eq=saturation={self.saturation}:gamma={self.gamma}',
'-an', # Tells FFMPEG not to expect any audio
'-loglevel', 'error',
]