Use x265 for downloads

This commit is contained in:
2026-04-18 19:20:40 +02:00
parent 3ad22d86b1
commit ce5aa5da24

View File

@@ -21,7 +21,7 @@ def _encode_video(
hentai_title: str, hentai_title: str,
input_aspect: str = "16:9" input_aspect: str = "16:9"
): ):
print(f"Encoding {preset['h']}p AV1") print(f"Encoding {preset['h']}p x265")
cmd = [ cmd = [
"ffmpeg", "-v", "quiet", "-stats", "ffmpeg", "-v", "quiet", "-stats",
@@ -34,14 +34,14 @@ def _encode_video(
"-map", "1:d?", # Other Data from source video (optional) "-map", "1:d?", # Other Data from source video (optional)
"-disposition:v:0", "default", # Mark video as default in mkv container "-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", "-c:v", "libx265",
"-crf", preset['crf'], "-crf", preset['crf'],
"-preset", "4", "-preset", "slow",
"-pix_fmt", "yuv420p10le", "-pix_fmt", "yuv420p10le",
"-vf", f"scale=min({preset['w']}\\,iw):-2,setsar=1:1", "-vf", f"scale=min({preset['w']}\\,iw):-2,setsar=1:1",
"-aspect", input_aspect, "-aspect", input_aspect,
"-c:a", "libopus", "-c:a", "libopus",
"-b:a", "160k", "-b:a", "128k",
"-c:s", "copy", "-c:s", "copy",
output_video output_video
] ]
@@ -62,13 +62,13 @@ def encode_downloads(
input_aspect: str = "16:9" input_aspect: str = "16:9"
): ):
presets = [ presets = [
{"w": "1920", "h": "1080", "crf": "24", "name": "[1080p-AV1]", "input_video": upscaled_video}, {"w": "1920", "h": "1080", "crf": "22", "name": "[1080p-x265]", "input_video": upscaled_video},
{"w": "1920", "h": "1080", "crf": "24", "name": "[1080p-AV1][48fps]", "input_video": interpolated_video}, {"w": "1920", "h": "1080", "crf": "22", "name": "[1080p-x265][48fps]", "input_video": interpolated_video},
{"w": "3840", "h": "2160", "crf": "26", "name": "[2160p-AV1]", "input_video": upscaled_video}, {"w": "3840", "h": "2160", "crf": "24", "name": "[2160p-x265]", "input_video": upscaled_video},
] ]
if interpolated_uhd_video is not None: if interpolated_uhd_video is not None:
presets.append({"w": "3840", "h": "2160", "crf": "26", "name": "[2160p-AV1][48fps]", "input_video": interpolated_uhd_video}) presets.append({"w": "3840", "h": "2160", "crf": "24", "name": "[2160p-x265][48fps]", "input_video": interpolated_uhd_video})
for preset in presets: for preset in presets:
file_name = f"{hentai_title} {preset['name']}[hstream.moe].mkv" file_name = f"{hentai_title} {preset['name']}[hstream.moe].mkv"
@@ -76,7 +76,7 @@ def encode_downloads(
mux_out = os.path.join('2-Out', folder_name, 'Muxed', file_name) mux_out = os.path.join('2-Out', folder_name, 'Muxed', file_name)
if os.path.exists(mux_out): if os.path.exists(mux_out):
print(f'Skipped {preset['h']}p AV1 Encode') print(f'Skipped {preset['h']}p x265 Encode')
continue continue
_encode_video(preset, source_video, tmp_out, hentai_title, input_aspect) _encode_video(preset, source_video, tmp_out, hentai_title, input_aspect)