Add Linux/Windows support

This commit is contained in:
2026-03-19 18:16:12 +01:00
parent 479ac49796
commit 14bb4ac95f
4 changed files with 95 additions and 52 deletions

View File

@@ -21,7 +21,7 @@ def _encode_video(
hentai_title: str,
input_aspect: str = "16:9"
):
print(f'Encoding {preset['h']}p AV1')
print(f"Encoding {preset['h']}p AV1")
cmd = [
"ffmpeg",
@@ -33,12 +33,12 @@ def _encode_video(
"-map", "1:t?", # Attachments from source video (optional)
"-map", "1:d?", # Other Data from source video (optional)
"-disposition:v:0", "default", # Mark video as default in mkv container
"-metadata", f'Title=\"{hentai_title} [hstream.moe]\"',
"-metadata", f"Title={hentai_title} [hstream.moe]",
"-c:v", "libsvtav1",
"-crf", preset['crf'],
"-preset", "4",
"-pix_fmt", "yuv420p10le", # 10bit
"-vf", f"scale=\'min({preset['w']},iw)\':-2,setsar=1:1",
"-pix_fmt", "yuv420p10le",
"-vf", f"scale=min({preset['w']}\\,iw):-2,setsar=1:1",
"-aspect", input_aspect,
"-c:a", "libopus",
"-b:a", "160k",
@@ -46,10 +46,8 @@ def _encode_video(
output_video
]
print(cmd)
try:
subprocess.run(cmd, shell=True, check=True)
subprocess.run(cmd, check=True)
except subprocess.CalledProcessError as e:
print(f"\nffmpeg failed with error code {e.returncode}", file=sys.stderr)
sys.exit(e.returncode)