's'
This commit is contained in:
@@ -192,7 +192,7 @@ def run_demucs_pipeline(
|
||||
conn = [None] # 用 list 以便在闭包中修改
|
||||
|
||||
def accept_conn():
|
||||
server.settimeout(120)
|
||||
server.settimeout(30)
|
||||
try:
|
||||
c, _ = server.accept()
|
||||
conn[0] = c
|
||||
@@ -206,6 +206,7 @@ def run_demucs_pipeline(
|
||||
|
||||
accept_thread = threading.Thread(target=accept_conn, daemon=True)
|
||||
accept_thread.start()
|
||||
time.sleep(0.2) # 确保 server 已 listen
|
||||
|
||||
# FFmpeg 拉流(视频)
|
||||
ffmpeg_v_cmd = [
|
||||
@@ -232,14 +233,15 @@ def run_demucs_pipeline(
|
||||
"-ar", str(DEMUCS_SAMPLE_RATE), "pipe:1",
|
||||
]
|
||||
|
||||
# FFmpeg 推流(视频 stdin + 音频 tcp)
|
||||
# FFmpeg 推流:音频 tcp 放第一(FFmpeg 按顺序打开输入,pipe:0 会阻塞直到有数据,
|
||||
# 若 pipe 在前则永远连不上 tcp,导致 accept 超时)
|
||||
vf = "fps=30,scale=720:1280:force_original_aspect_ratio=decrease:flags=lanczos,pad=720:1280:(ow-iw)/2:(oh-ih)/2:black"
|
||||
ffmpeg_out_cmd = [
|
||||
"ffmpeg", "-y", "-loglevel", "info", "-nostdin",
|
||||
"-f", "nut", "-i", "pipe:0",
|
||||
"-f", "s16le", "-ac", str(DEMUCS_CHANNELS), "-ar", str(DEMUCS_SAMPLE_RATE),
|
||||
"-i", tcp_audio_url,
|
||||
"-map", "0:v", "-map", "1:a",
|
||||
"-f", "nut", "-i", "pipe:0",
|
||||
"-map", "1:v", "-map", "0:a",
|
||||
"-vf", vf,
|
||||
"-c:v", nvenc_params.get("codec_v", "libx264"),
|
||||
"-preset", nvenc_params.get("preset_v", "fast"),
|
||||
|
||||
Reference in New Issue
Block a user