's'
This commit is contained in:
70
main.py
70
main.py
@@ -1736,9 +1736,55 @@ def start_record(url_data: tuple, count_variable: int = -1) -> None:
|
|||||||
"Referer: https://live.douyin.com/\r\n"
|
"Referer: https://live.douyin.com/\r\n"
|
||||||
"Origin: https://live.douyin.com\r\n"
|
"Origin: https://live.douyin.com\r\n"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# 720p
|
||||||
|
# ffmpeg_command = [
|
||||||
|
# "ffmpeg", "-y", "-loglevel", "info", "-nostdin", "-re",
|
||||||
|
# "-stats", "-stats_period", "1",
|
||||||
|
# "-rw_timeout", "30000000",
|
||||||
|
# "-reconnect", "1", "-reconnect_at_eof", "1", "-reconnect_streamed", "1",
|
||||||
|
# "-reconnect_delay_max", "5",
|
||||||
|
# "-fflags", "+genpts+discardcorrupt+nobuffer+flush_packets",
|
||||||
|
# "-flags", "low_delay",
|
||||||
|
# "-err_detect", "ignore_err",
|
||||||
|
# "-max_delay", "80000",
|
||||||
|
# "-thread_queue_size", "2048",
|
||||||
|
|
||||||
|
# "-headers", douyin_headers,
|
||||||
|
# "-i", real_url,
|
||||||
|
# # 720p
|
||||||
|
# "-vf", "fps=30,scale=720:1280:force_original_aspect_ratio=decrease:flags=lanczos,pad=720:1280:(ow-iw)/2:(oh-ih)/2:black",
|
||||||
|
# "-c:v", "libx264",
|
||||||
|
# "-preset", "fast",
|
||||||
|
# # "-tune", "zerolatency",
|
||||||
|
# "-profile:v", "high",
|
||||||
|
# # 720p
|
||||||
|
# # "-minrate", "3200k","-b:v", "3200k", "-maxrate", "3200k", "-bufsize", "6400k", # bufsize = 2× bitrate,保持真 CBR
|
||||||
|
# "-b:v", "2600k","-maxrate", "3000k","-bufsize", "5200k",
|
||||||
|
# "-vsync", "cfr",
|
||||||
|
# "-g", "60", "-keyint_min", "60",
|
||||||
|
# "-r", "30",
|
||||||
|
# "-bf", "0",
|
||||||
|
# "-sc_threshold", "0",
|
||||||
|
# # "-nal-hrd", "cbr", # 改2:强制 CBR
|
||||||
|
# # 720p
|
||||||
|
# # "-x264-params", "nal-hrd=cbr:force-cfr=1:scenecut=0:filler=1", # 改3:简化 params,锁死 CBR
|
||||||
|
# "-x264-params", "force-cfr=1:scenecut=0:open_gop=0:sync-lookahead=0",
|
||||||
|
# "-pix_fmt", "yuv420p",
|
||||||
|
# "-c:a", "aac", "-b:a", "128k", "-ar", "48000", "-ac", "2", # 改4:1080p可音频上 128k(YouTube 推荐)
|
||||||
|
# "-af", "aresample=async=1:first_pts=0",
|
||||||
|
|
||||||
|
# "-flags", "+global_header",
|
||||||
|
# "-flvflags", "no_duration_filesize",
|
||||||
|
# "-f", "flv", youtube_rtmp
|
||||||
|
# ]
|
||||||
|
|
||||||
|
|
||||||
|
# 1080p
|
||||||
ffmpeg_command = [
|
ffmpeg_command = [
|
||||||
"ffmpeg", "-y", "-loglevel", "info", "-nostdin", "-re",
|
"ffmpeg", "-y", "-loglevel", "info", "-nostdin", "-re",
|
||||||
"-stats", "-stats_period", "1", "-fflags", "+genpts",
|
"-stats", "-stats_period", "1",
|
||||||
"-rw_timeout", "30000000",
|
"-rw_timeout", "30000000",
|
||||||
"-reconnect", "1", "-reconnect_at_eof", "1", "-reconnect_streamed", "1",
|
"-reconnect", "1", "-reconnect_at_eof", "1", "-reconnect_streamed", "1",
|
||||||
"-reconnect_delay_max", "5",
|
"-reconnect_delay_max", "5",
|
||||||
@@ -1750,24 +1796,24 @@ def start_record(url_data: tuple, count_variable: int = -1) -> None:
|
|||||||
|
|
||||||
"-headers", douyin_headers,
|
"-headers", douyin_headers,
|
||||||
"-i", real_url,
|
"-i", real_url,
|
||||||
|
# 1080p
|
||||||
# "-vf", "scale=1080:1920:force_original_aspect_ratio=decrease:flags=lanczos,pad=1080:1920:(ow-iw)/2:(oh-ih)/2:black",
|
"-vf","fps=30,scale=1080:1920:force_original_aspect_ratio=decrease:flags=lanczos,pad=1080:1920:(ow-iw)/2:(oh-ih)/2:black",
|
||||||
"-vf", "scale=720:1280:force_original_aspect_ratio=decrease,pad=720:1280:(ow-iw)/2:(oh-ih)/2:black",
|
|
||||||
|
|
||||||
"-c:v", "libx264",
|
"-c:v", "libx264",
|
||||||
"-preset", "superfast",
|
"-preset", "veryfast",
|
||||||
"-tune", "zerolatency",
|
"-tune", "zerolatency",
|
||||||
"-profile:v", "high",
|
"-profile:v", "high",
|
||||||
"-b:v", "4200k", "-maxrate", "4200k", "-bufsize", "8400k", # 改1:2× bufsize,真 CBR
|
# 1080p
|
||||||
"-g", "60", "-keyint_min", "50",
|
"-b:v", "5200k", "-maxrate", "5800k", "-bufsize", "10400k", # 改1:2× bufsize,真 CBR
|
||||||
|
"-vsync", "cfr",
|
||||||
|
"-g", "60", "-keyint_min", "60",
|
||||||
"-r", "30",
|
"-r", "30",
|
||||||
"-bf", "0",
|
"-bf", "0",
|
||||||
"-sc_threshold", "0",
|
"-sc_threshold", "0",
|
||||||
"-nal-hrd", "cbr", # 改2:强制 CBR
|
# "-nal-hrd", "cbr", # 改2:强制 CBR
|
||||||
"-x264-params", "nal-hrd=cbr:force-cfr=1:scenecut=0", # 改3:简化 params,锁死 CBR
|
# 1080p
|
||||||
|
"-x264-params","force-cfr=1:scenecut=0:open_gop=0:sync-lookahead=0",
|
||||||
"-pix_fmt", "yuv420p",
|
"-pix_fmt", "yuv420p",
|
||||||
|
"-c:a", "aac", "-b:a", "128k", "-ar", "44100", "-ac", "2",
|
||||||
"-c:a", "aac", "-b:a", "128k", "-ar", "44100", "-ac", "2", # 改4:音频上 128k(YouTube 推荐)
|
|
||||||
"-af", "aresample=async=1:first_pts=0",
|
"-af", "aresample=async=1:first_pts=0",
|
||||||
|
|
||||||
"-flags", "+global_header",
|
"-flags", "+global_header",
|
||||||
|
|||||||
Reference in New Issue
Block a user