我正在输出音频和视频监控的日志文件,用于显示静音检测和黑屏检测的 UDP 流。我有这两个的有效代码,但我似乎无法获得grep仅过滤视频或音频日志的相关数据。以下是我目前所得到的。
音频代码
ffmpeg -i "udp://@232.1.1.5:30120" -af silencedetect=n=-20dB:d=0.1 -f null - 2>&1 | grep silencedetect >> audio_silence_udp.txt
音频日志 audio_silence_udp.txt 示例输出
frame= 73 fps=0.0 q=-0.0 size=N/A time=00:00:03.67 bitrate=N/A speed=6.87x
frame= 167 fps=159 q=-0.0 size=N/A time=00:00:06.80 bitrate=N/A speed=6.48x
frame= 182 fps=117 q=-0.0 size=N/A time=00:00:07.30 bitrate=N/A speed= 4.7x
frame= 197 fps= 96 q=-0.0 size=N/A time=00:00:07.80 bitrate=N/A speed= 3.8x
frame= 212 fps= 83 q=-0.0 size=N/A time=00:00:08.30 bitrate=N/A speed=3.25x
frame= 227 fps= 74 q=-0.0 size=N/A time=00:00:08.80 bitrate=N/A speed=2.88x
frame= 242 fps= 68 q=-0.0 size=N/A time=00:00:09.30 bitrate=N/A speed=2.62x
frame= 258 fps= 64 q=-0.0 size=N/A time=00:00:09.84 bitrate=N/A speed=2.42x
frame= 273 fps= 60 q=-0.0 size=N/A time=00:00:10.34 bitrate=N/A speed=2.26x
frame= 288 fps= 57 q=-0.0 size=N/A time=00:00:10.84 bitrate=N/A speed=2.13x
frame= 303 fps= 54 q=-0.0 size=N/A time=00:00:11.34 bitrate=N/A speed=2.03x
frame= 318 fps= 52 q=-0.0 size=N/A time=00:00:11.84 bitrate=N/A speed=1.94x
[silencedetect @ 0x55d604a79fa0] silence_start: 11.1646
[silencedetect @ 0x55d604a79fa0] silence_end: 11.2966 | silence_duration: 0.132
[silencedetect @ 0x55d604a79fa0] silence_start: 11.6126
frame= 333 fps= 51 q=-0.0 size=N/A time=00:00:12.34 bitrate=N/A speed=1.87x
[silencedetect @ 0x55d604a79fa0] silence_end: 11.7766 | silence_duration: 0.164
[silencedetect @ 0x55d604a79fa0] silence_start: 11.9966
[silencedetect @ 0x55d604a79fa0] silence_end: 12.1926 | silence_duration: 0.196
frame= 348 fps= 49 q=-0.0 size=N/A time=00:00:12.84 bitrate=N/A speed=1.81x
[silencedetect @ 0x55d604a79fa0] silence_start: 12.4447
[silencedetect @ 0x55d604a79fa0] silence_end: 12.6087 | silence_duration: 0.164
音频日志应该
[silencedetect @ 0x55d604a79fa0] silence_start: 11.1646
[silencedetect @ 0x55d604a79fa0] silence_end: 11.2966 | silence_duration: 0.132
[silencedetect @ 0x55d604a79fa0] silence_start: 11.6126
[silencedetect @ 0x55d604a79fa0] silence_end: 11.7766 | silence_duration: 0.164
[silencedetect @ 0x55d604a79fa0] silence_start: 11.9966
[silencedetect @ 0x55d604a79fa0] silence_end: 12.1926 | silence_duration: 0.196
[silencedetect @ 0x55d604a79fa0] silence_start: 12.4447
[silencedetect @ 0x55d604a79fa0] silence_end: 12.6087 | silence_duration: 0.164
视频代码
ffmpeg -i "udp://@232.1.1.5:30120" -vf "blackdetect=d=.2:pix_th=0.00" -an -f null - 2>&1 | grep blackdetect >> video_black.txt
视频记录
frame= 3660 fps= 31 q=-0.0 size=N/A time=00:02:02.32 bitrate=N/A speed=1.04x
frame= 3675 fps= 31 q=-0.0 size=N/A time=00:02:02.82 bitrate=N/A speed=1.04x
frame= 3691 fps= 31 q=-0.0 size=N/A time=00:02:03.35 bitrate=N/A speed=1.04x
frame= 3707 fps= 31 q=-0.0 size=N/A time=00:02:03.89 bitrate=N/A speed=1.04x
frame= 3722 fps= 31 q=-0.0 size=N/A time=00:02:04.39 bitrate=N/A speed=1.04x
frame= 3738 fps= 31 q=-0.0 size=N/A time=00:02:04.92 bitrate=N/A speed=1.04x
frame= 3753 fps= 31 q=-0.0 size=N/A time=00:02:05.42 bitrate=N/A speed=1.04x
frame= 3768 fps= 31 q=-0.0 size=N/A time=00:02:05.92 bitrate=N/A speed=1.04x
[blackdetect @ 0x5632d20b58e0] black_start:124.598 black_end:125.966 black_duration:1.36811
frame= 3782 fps= 31 q=-0.0 size=N/A time=00:02:06.39 bitrate=N/A speed=1.04x
frame= 3799 fps= 31 q=-0.0 size=N/A time=00:02:06.96 bitrate=N/A speed=1.04x
frame= 3815 fps= 31 q=-0.0 size=N/A time=00:02:07.49 bitrate=N/A speed=1.04x
frame= 3830 fps= 31 q=-0.0 size=N/A time=00:02:07.99 bitrate=N/A speed=1.04x
frame= 3845 fps= 31 q=-0.0 size=N/A time=00:02:08.49 bitrate=N/A speed=1.04x
视频日志应该
[blackdetect @ 0x5632d20b58e0] black_start:124.598 black_end:125.966 black_duration:1.36811