perf(cut): stream-copy remux in passthrough finalize — the cut is already freshly encoded, re-encoding only added time and generation loss
This commit is contained in:
parent
402e585af7
commit
aeca9dbf98
1 changed files with 6 additions and 4 deletions
10
main.py
10
main.py
|
|
@ -622,15 +622,17 @@ Technical Details: {str(last_err)}
|
||||||
return downloaded_file, sanitized_title
|
return downloaded_file, sanitized_title
|
||||||
|
|
||||||
def finalize_clip_passthrough(input_video, final_output_video):
|
def finalize_clip_passthrough(input_video, final_output_video):
|
||||||
"""Keep the clip's native framing (for horizontal/16:9 output): just
|
"""Keep the clip's native framing (for horizontal/16:9 output).
|
||||||
re-encode with faststart, no reframing/cropping."""
|
|
||||||
|
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):
|
if os.path.exists(final_output_video):
|
||||||
os.remove(final_output_video)
|
os.remove(final_output_video)
|
||||||
print(f"🎬 Passthrough (native framing): {input_video}")
|
print(f"🎬 Passthrough (native framing): {input_video}")
|
||||||
cmd = [
|
cmd = [
|
||||||
'ffmpeg', '-y', '-i', input_video,
|
'ffmpeg', '-y', '-i', input_video,
|
||||||
*video_encode_args(QUALITY),
|
'-c', 'copy', '-movflags', '+faststart',
|
||||||
'-c:a', 'aac', '-movflags', '+faststart',
|
|
||||||
final_output_video,
|
final_output_video,
|
||||||
]
|
]
|
||||||
subprocess.run(cmd, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=1800)
|
subprocess.run(cmd, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=1800)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue