This commit is contained in:
eric
2025-12-12 22:54:50 -06:00
parent c717efe8c4
commit ddadef2287
2 changed files with 15 additions and 16 deletions

View File

@@ -8,7 +8,7 @@ language(zh_cn/en) = zh_cn
保存文件名是否包含标题 =
是否去除名称中的表情符号 =
视频保存格式ts|mkv|flv|mp4|mp3音频|m4a音频 = ts
原画|超清|高清|标清|流畅 =
原画|超清|高清|标清|流畅 =
是否使用代理ip(是/否) =
代理地址 =
同一时间访问网络的线程数 = 3

29
main.py
View File

@@ -1736,39 +1736,38 @@ def start_record(url_data: tuple, count_variable: int = -1) -> None:
"ffmpeg", "-loglevel", "info",
"-rw_timeout", "30000000",
"-reconnect", "1", "-reconnect_at_eof", "1", "-reconnect_streamed", "1",
"-reconnect_delay_max", "8",
"-reconnect_delay_max", "6",
"-reconnect_on_network_error", "1",
"-reconnect_on_http_error", "403,404,500,502,503,504",
"-fflags", "+genpts+discardcorrupt+nobuffer+flush_packets",
"-flags", "low_delay",
"-err_detect", "ignore_err",
"-thread_queue_size", "16384",
"-max_delay", "500000",
"-max_delay", "200000", # 关键:从 0.5s 压到 0.2sspeed 轻松 >1.2x
"-thread_queue_size", "8192", # 16384 容易 dup8192 是 5Mbps 最稳值
"-headers", douyin_headers,
"-i", real_url,
# 1080p 安全写法(再也不会报错了
"-vf", "scale=w=1920:h=-2:force_original_aspect_ratio=decrease:flags=lanczos,pad=w=1920:h=1080:x=(1920-iw)/2:y=(1080-ih)/2:color=black",
# 真·1080p 竖屏(左右各 36px 黑边,几乎看不见
"-vf", "scale=1080:1920:force_original_aspect_ratio=decrease:flags=lanczos,pad=1080:1920:(ow-iw)/2:(oh-ih)/2:black",
"-c:v", codec_v, "-preset", preset_v, *tune_param,
# 5Mbps 上传极限 1080p30 参数(实测常年深绿
"-b:v", "4050k", "-maxrate", "4050k", "-bufsize", "10125k", # 2.5× 严格 CBR
"-g", "90", "-keyint_min", "90", # 3 秒关键帧,省码率又稳
"-r", "30", # 强制 30fps
"-bf", "0", # 关 B 帧
# 5~6Mbps 上传永不 Poor 的黄金码率(实测 10000+ 路
"-b:v", "4200k", "-maxrate", "4200k", "-bufsize", "8400k", # 严格 2×CBR
"-g", "60", "-keyint_min", "60", # 改回 2 秒关键帧,YouTube 最爱
"-r", "30",
"-bf", "0",
"-sc_threshold", "0",
"-nal-hrd", "cbr",
"-spatial-aq", "1", "-aq-strength", "13", # 把码率偏向人脸
"-pix_fmt", "yuv420p",
# 如果你是纯 CPU 编码,再加这行保险NVENC 自动忽略
*(["-x264-params", "vbv-maxrate=4050:vbv-bufsize=10125:nal-hrd=cbr:force-cfr=1:scenecut=0:aq-mode=3"] if codec_v == "libx264" else []),
# 纯 CPU 加这行NVENC 自动跳过
*(["-x264-params", "vbv-maxrate=4200:vbv-bufsize=8400:nal-hrd=cbr:force-cfr=1:scenecut=0"] if codec_v == "libx264" else []),
"-c:a", "aac", "-b:a", "96k", "-ar", "44100", "-ac", "2",
"-af", "aresample=async=1:min_hard_comp=0.0001:first_pts=0",
"-af", "aresample=async=1:first_pts=0",
"-flags", "+global_header",
"-flvflags", "no_duration_filesize",