Skip to content

Commit

Permalink
Add option for gamma correction to SceneFileWriter
Browse files Browse the repository at this point in the history
  • Loading branch information
3b1b committed Feb 9, 2023
1 parent ded06c1 commit 3e3e4de
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions manimlib/scene/scene_file_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ def __init__(
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
Expand All @@ -69,6 +70,7 @@ def __init__(
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
Expand Down Expand Up @@ -264,7 +266,7 @@ def open_movie_pipe(self, file_path: str) -> None:
'-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',
]
Expand Down

0 comments on commit 3e3e4de

Please sign in to comment.