Add film grain parameter to video encoding with configurable amount
This commit is contained in:
+3
-1
@@ -30,7 +30,8 @@ def main(
|
||||
nosubtitles: bool = typer.Option(False, "-ns", "--nosubtitles", help="Remove subtitles"),
|
||||
preset: int = typer.Option(2, "-p", "--preset", help="Encoding preset"),
|
||||
crf: int = typer.Option(30, "-c", "--crf", help="CRF value"),
|
||||
original_media_type: str = typer.Option("DVD", "-o", "--original-media-type", help="Set the ORIGINAL_MEDIA_TYPE metadata")
|
||||
original_media_type: str = typer.Option("DVD", "-o", "--original-media-type", help="Set the ORIGINAL_MEDIA_TYPE metadata"),
|
||||
film_grain: int = typer.Option(20, "-fg", "--film-grain", help="Film grain amount (default: 20)")
|
||||
):
|
||||
video_details = VideoFile(
|
||||
imdb=imdb, video_path=filename, allow_subtitle=not nosubtitles
|
||||
@@ -53,6 +54,7 @@ def main(
|
||||
stream.preset = preset
|
||||
stream.crf = crf
|
||||
stream.original_media_type = original_media_type
|
||||
stream.film_grain = film_grain
|
||||
export_data = " ".join(data.cmd())
|
||||
export_path = Path(filename).parent / "encode.sh"
|
||||
write_shell_script(export_data, export_path)
|
||||
|
||||
@@ -28,6 +28,7 @@ class VideoStream(BaseModel):
|
||||
preset: int = Field(2)
|
||||
crf: int = Field(30)
|
||||
original_media_type: str = Field(None)
|
||||
film_grain: int = Field(20)
|
||||
|
||||
@cached_property
|
||||
def fps(self) -> float:
|
||||
@@ -45,7 +46,7 @@ class VideoStream(BaseModel):
|
||||
"-preset",
|
||||
str(self.preset),
|
||||
"-svtav1-params",
|
||||
"tune=0:film-grain=20:scd=1",
|
||||
f"tune=0:film-grain={self.film_grain}:scd=1",
|
||||
"-vf",
|
||||
"'scale=iw*sar:ih,setsar=1,scale=-2:ih:lanczos'",
|
||||
"-g",
|
||||
|
||||
Reference in New Issue
Block a user