s''
This commit is contained in:
104
main.py
104
main.py
@@ -1736,49 +1736,8 @@ def start_record(url_data: tuple, count_variable: int = -1) -> None:
|
||||
"Referer: https://live.douyin.com/\r\n"
|
||||
"Origin: https://live.douyin.com\r\n"
|
||||
)
|
||||
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
|
||||
# 720p
|
||||
# ffmpeg_command = [
|
||||
# "ffmpeg", "-y", "-loglevel", "info", "-nostdin", "-re",
|
||||
# "-stats", "-stats_period", "1",
|
||||
@@ -1793,24 +1752,26 @@ def start_record(url_data: tuple, count_variable: int = -1) -> None:
|
||||
|
||||
# "-headers", douyin_headers,
|
||||
# "-i", real_url,
|
||||
# # 1080p
|
||||
# "-vf","fps=30,scale=1080:1920:force_original_aspect_ratio=decrease:flags=lanczos,pad=1080:1920:(ow-iw)/2:(oh-ih)/2:black",
|
||||
# # 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", "veryfast",
|
||||
# "-tune", "zerolatency",
|
||||
# "-preset", "fast",
|
||||
# # "-tune", "zerolatency",
|
||||
# "-profile:v", "high",
|
||||
# # 1080p
|
||||
# "-b:v", "5200k", "-maxrate", "5800k", "-bufsize", "10400k", # 改1:2× bufsize,真 CBR
|
||||
# # 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
|
||||
# # 1080p
|
||||
# "-x264-params","force-cfr=1:scenecut=0:open_gop=0:sync-lookahead=0",
|
||||
# # 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", "44100", "-ac", "2",
|
||||
# "-c:a", "aac", "-b:a", "128k", "-ar", "48000", "-ac", "2", # 改4:1080p可音频上 128k(YouTube 推荐)
|
||||
# "-af", "aresample=async=1:first_pts=0",
|
||||
|
||||
# "-flags", "+global_header",
|
||||
@@ -1819,6 +1780,47 @@ def start_record(url_data: tuple, count_variable: int = -1) -> None:
|
||||
# ]
|
||||
|
||||
|
||||
# 1080p
|
||||
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,
|
||||
# 1080p
|
||||
"-vf","fps=30,scale=1080:1920:force_original_aspect_ratio=decrease:flags=lanczos,pad=1080:1920:(ow-iw)/2:(oh-ih)/2:black",
|
||||
"-c:v", "libx264",
|
||||
"-preset", "veryfast",
|
||||
"-tune", "zerolatency",
|
||||
"-profile:v", "high",
|
||||
# 1080p
|
||||
"-b:v", "5200k", "-maxrate", "5800k", "-bufsize", "10400k", # 改1:2× bufsize,真 CBR
|
||||
"-vsync", "cfr",
|
||||
"-g", "60", "-keyint_min", "60",
|
||||
"-r", "30",
|
||||
"-bf", "0",
|
||||
"-sc_threshold", "0",
|
||||
# "-nal-hrd", "cbr", # 改2:强制 CBR
|
||||
# 1080p
|
||||
"-x264-params","force-cfr=1:scenecut=0:open_gop=0:sync-lookahead=0",
|
||||
"-pix_fmt", "yuv420p",
|
||||
"-c:a", "aac", "-b:a", "128k", "-ar", "44100", "-ac", "2",
|
||||
"-af", "aresample=async=1:first_pts=0",
|
||||
|
||||
"-flags", "+global_header",
|
||||
"-flvflags", "no_duration_filesize",
|
||||
"-f", "flv", youtube_rtmp
|
||||
]
|
||||
|
||||
|
||||
# srs内网配置
|
||||
# ffmpeg_command = [
|
||||
# "ffmpeg",
|
||||
|
||||
Reference in New Issue
Block a user