From aeca9dbf98febc1f5e4a99331d4db08a2eb212ec Mon Sep 17 00:00:00 2001 From: "juancarlos.cavero" Date: Sat, 18 Jul 2026 02:57:39 +0200 Subject: [PATCH] =?UTF-8?q?perf(cut):=20stream-copy=20remux=20in=20passthr?= =?UTF-8?q?ough=20finalize=20=E2=80=94=20the=20cut=20is=20already=20freshl?= =?UTF-8?q?y=20encoded,=20re-encoding=20only=20added=20time=20and=20genera?= =?UTF-8?q?tion=20loss?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index e8a6761..1938f32 100644 --- a/main.py +++ b/main.py @@ -622,15 +622,17 @@ Technical Details: {str(last_err)} return downloaded_file, sanitized_title def finalize_clip_passthrough(input_video, final_output_video): - """Keep the clip's native framing (for horizontal/16:9 output): just - re-encode with faststart, no reframing/cropping.""" + """Keep the clip's native framing (for horizontal/16:9 output). + + The input is the freshly encoded cut, so a stream-copy remux is enough to + add +faststart — re-encoding here would only cost time and quality. + """ if os.path.exists(final_output_video): os.remove(final_output_video) print(f"🎬 Passthrough (native framing): {input_video}") cmd = [ 'ffmpeg', '-y', '-i', input_video, - *video_encode_args(QUALITY), - '-c:a', 'aac', '-movflags', '+faststart', + '-c', 'copy', '-movflags', '+faststart', final_output_video, ] subprocess.run(cmd, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=1800)