如果RTSP流中断,如何让VLC重试

时间:2019-05-26 21:47:58

标签: c# vlc rtsp

我在这里再次提到我的问题。我有一个监视系统,可将RTSP流传输到我的PC并使用VLC记录,

How to close VLC gracefully using C#

我每半小时关闭VLC并重新启动一次,以便它记录30分钟长的文件。

VLC命令如下所示,

vlc rtsp://*username*:*password*@192.168.1.60:554/ch01/0  --qt-start-minimized --sout=#transcode{ab=128,channels=2,samplerate=44100,scodec=none}:file{dst=D:\CCTV\Concord\2019_05_24\2019-05-24_2111_C1.mp4,no-overwrite}

现在的问题是,有时流会在30分钟结束之前中断,并且VLC将停止记录。这似乎是某种网络问题。

发生这种情况时,VLC将继续运行,但在任务管理器中不显示任何网络活动,并且不记录任何内容。

在这种情况下,如何使VLC退出或重试?否则我该如何检测到这种情况?如果可以检测到,则可以关闭并重新启动VLC。

我在VLC上使用了此日志选项,并运行了一天,

--file-logging --log-verbose=3 --logmode=text --logfile=blah

通常,日志文件中的最终结果是这样的

main debug: adding a new sout input for `hevc` (sout_input: 0384ac70)
stream_out_transcode debug: not transcoding a stream (fcc=`hevc')
main debug: adding a new input
mp4 warning: Missing frame rate for stream 0, assuming 25fps
mp4 debug: adding input
main debug: Buffering 9%
main debug: Buffering 51%
main debug: Buffering 55%
main debug: Buffering 63%
main debug: Buffering 71%
main debug: Buffering 83%
main debug: Buffering 91%
main debug: Buffering 95%
main debug: Stream buffering done (1030 ms in 655 ms)
main debug: Decoder wait done in 0 ms
mp4 warning: i_length <= 0
live555 warning: no data received in 10s, eof ?
main debug: EOF reached
main debug: waiting decoder fifos to empty
live555 error: keep-alive failed: recvfrom() error: An existing connection was forcibly closed by the remote host
main debug: killing decoder fourcc `hevc'
main debug: removing module "hevc"
main debug: removing a sout input (sout_input: 0384ac70)
mp4 debug: tk 1 elst media time 0 duration 108539273 offset 0
mp4 debug: removing input
main warning: no more input streams for this mux
main debug: removing module "live555"
main debug: Program doesn't contain anymore ES
main debug: dead input
main debug: destroying useless sout
main debug: destroying chain... (name=transcode)
main debug: removing module "stream_out_transcode"
main debug: destroying chain done
main debug: destroying chain... (name=file)
main debug: removing module "stream_out_standard"
main debug: removing module "mp4"
mp4 debug: Close

特别注意这一点,

live555 warning: no data received in 10s, eof ?
main debug: EOF reached
main debug: waiting decoder fifos to empty
live555 error: keep-alive failed: recvfrom() error: An existing connection was forcibly closed by the remote host

所有日志都可以在这里看到

https://www.dropbox.com/s/e4b3e8jesrl08n3/2019-05-27_1622_C4.log?dl=0

0 个答案:

没有答案