diff --git a/douyin_youtube_ffplay.py b/douyin_youtube_ffplay.py index a983669..6af82e8 100644 --- a/douyin_youtube_ffplay.py +++ b/douyin_youtube_ffplay.py @@ -198,55 +198,55 @@ def start_douyin_youtube_ffplay( # "arnndn=m=./arnndn-models/cb.rnnn:mix=0.85," # 人声增强 # 720p-低CPU + 背景音乐处理 + 防ContentID - 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", + # 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, + # "-headers", douyin_headers, + # "-i", real_url, - # 视频处理 720p - "-vf", - "fps=25,scale=720:1280:force_original_aspect_ratio=decrease:flags=bicubic," - "pad=720:1280:(ow-iw)/2:(oh-ih)/2:black", + # # 视频处理 720p + # "-vf", + # "fps=25,scale=720:1280:force_original_aspect_ratio=decrease:flags=bicubic," + # "pad=720:1280:(ow-iw)/2:(oh-ih)/2:black", - "-c:v", "libx264", - "-preset", "veryfast", # 降低CPU - "-profile:v", "high", - "-b:v", "2600k", "-maxrate", "3000k", "-bufsize", "5200k", - "-vsync", "cfr", - "-g", "50", "-keyint_min", "50", # 与fps=25匹配 - "-r", "25", - "-bf", "0", - "-sc_threshold", "0", - "-x264-params", "force-cfr=1:scenecut=0:open_gop=0:sync-lookahead=0", - "-pix_fmt", "yuv420p", + # "-c:v", "libx264", + # "-preset", "veryfast", # 降低CPU + # "-profile:v", "high", + # "-b:v", "2600k", "-maxrate", "3000k", "-bufsize", "5200k", + # "-vsync", "cfr", + # "-g", "50", "-keyint_min", "50", # 与fps=25匹配 + # "-r", "25", + # "-bf", "0", + # "-sc_threshold", "0", + # "-x264-params", "force-cfr=1:scenecut=0:open_gop=0:sync-lookahead=0", + # "-pix_fmt", "yuv420p", - # 音频处理(轻量 + 背景音乐弱化 + 防Content ID) - "-c:a", "aac", "-b:a", "128k", "-ar", "48000", "-ac", "2", - "-af", - "afftdn=nf=-28:tn=1," # 轻 FFT 降噪,背景弱化 - "highpass=f=120,lowpass=f=4800," # 切低频鼓 & 高频镲 - "equalizer=f=250:width_type=o:width=2:g=-8," # 衰减低中频 - "equalizer=f=800:width_type=o:width=1.5:g=-5," # 衰减中频 - "acompressor=threshold=-30dB:ratio=4:attack=10:release=100:makeup=4," # 压动态 - "asetrate=48000*1.02,aresample=48000," # 音高微升 - "afreqshift=shift=15," # 小幅频率偏移 - "volume=1.1," # 音量补偿 - "aresample=async=1:first_pts=0", # 音视频同步 + # # 音频处理(轻量 + 背景音乐弱化 + 防Content ID) + # "-c:a", "aac", "-b:a", "128k", "-ar", "48000", "-ac", "2", + # "-af", + # "afftdn=nf=-28:tn=1," # 轻 FFT 降噪,背景弱化 + # "highpass=f=120,lowpass=f=4800," # 切低频鼓 & 高频镲 + # "equalizer=f=250:width_type=o:width=2:g=-8," # 衰减低中频 + # "equalizer=f=800:width_type=o:width=1.5:g=-5," # 衰减中频 + # "acompressor=threshold=-30dB:ratio=4:attack=10:release=100:makeup=4," # 压动态 + # "asetrate=48000*1.02,aresample=48000," # 音高微升 + # "afreqshift=shift=15," # 小幅频率偏移 + # "volume=1.1," # 音量补偿 + # "aresample=async=1:first_pts=0", # 音视频同步 - # 推流参数 - "-flvflags", "no_duration_filesize", - "-f", "flv", youtube_rtmp - ] + # # 推流参数 + # "-flvflags", "no_duration_filesize", + # "-f", "flv", youtube_rtmp + # ] @@ -254,56 +254,56 @@ def start_douyin_youtube_ffplay( # 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", + 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, + "-headers", douyin_headers, + "-i", real_url, - # # 视频:不动你原策略,只给编码喘口气 - # "-vf", "fps=25,scale=1080:1920:force_original_aspect_ratio=decrease:flags=bicubic," - # "pad=1080:1920:(ow-iw)/2:(oh-ih)/2:black", + # 视频:不动你原策略,只给编码喘口气 + "-vf", "fps=25,scale=1080:1920:force_original_aspect_ratio=decrease:flags=bicubic," + "pad=1080:1920:(ow-iw)/2:(oh-ih)/2:black", - # "-c:v", "libx264", - # "-preset", "superfast", - # "-tune", "zerolatency", - # "-profile:v", "high", - # "-b:v", "5200k", "-maxrate", "5800k", "-bufsize", "10400k", - # "-vsync", "cfr", - # "-g", "50", "-keyint_min", "50", - # "-r", "25", - # "-bf", "0", - # "-sc_threshold", "0", - # "-x264-params", "force-cfr=1:scenecut=0:open_gop=0:sync-lookahead=0", - # "-pix_fmt", "yuv420p", + "-c:v", "libx264", + "-preset", "superfast", + "-tune", "zerolatency", + "-profile:v", "high", + "-b:v", "5200k", "-maxrate", "5800k", "-bufsize", "10400k", + "-vsync", "cfr", + "-g", "50", "-keyint_min", "50", + "-r", "25", + "-bf", "0", + "-sc_threshold", "0", + "-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", "44100", "-ac", "2", - # "-af", - # "arnndn=m=./arnndn-models/cb.rnnn:mix=0.80," - # "afftdn=nf=-18:tn=1," - # "highpass=f=120,lowpass=f=4600," - # "equalizer=f=250:width_type=o:width=2:g=-6," - # "equalizer=f=900:width_type=o:width=1.4:g=-4," - # "asetrate=48000*1.012,aresample=48000," - # "acompressor=threshold=-30dB:ratio=4:attack=10:release=120:makeup=4," - # "volume=1.10," - # "aresample=async=1:first_pts=0", + "-af", + "arnndn=m=./arnndn-models/cb.rnnn:mix=0.80," + "afftdn=nf=-18:tn=1," + "highpass=f=120,lowpass=f=4600," + "equalizer=f=250:width_type=o:width=2:g=-6," + "equalizer=f=900:width_type=o:width=1.4:g=-4," + "asetrate=48000*1.012,aresample=48000," + "acompressor=threshold=-30dB:ratio=4:attack=10:release=120:makeup=4," + "volume=1.10," + "aresample=async=1:first_pts=0", - # "-flvflags", "no_duration_filesize", - # "-f", "flv", youtube_rtmp - # ] + "-flvflags", "no_duration_filesize", + "-f", "flv", youtube_rtmp + ]