名前のない4つのIPカメラがあり、rtspストリームをキャプチャするのに問題があります。ランダム出力ファイルも生成されません。 ffmpeg経由でストリームをキャプチャしています。 Ubuntu Server 18.04ではスナップffmpegを、Debian 7では一般的なffmpegを試してみました。同じ問題。
(/snap/bin/ffmpeg -y -use_wallclock_as_timestamps 1 -hide_banner -loglevel trace -i rtsp://192.168.0.16$1:554/11 -c:v copy -an -flags +global_header $VIDEO_FILE 2> $LOG_FOLDER/cam$1 ) &
試験を終えた- ログレベルのデバッグただし、正常なRTSP接続のみが表示され、それ以上は表示されません。そして- ログレベルの追跡成功したプロセスと失敗したプロセスの違いを見つけました。
Error: unable to open display
Splitting the commandline.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Reading option '-use_wallclock_as_timestamps' ... matched as AVOption 'use_wallclock_as_timestamps' with argument '1'.
Reading option '-hide_banner' ... matched as option 'hide_banner' (do not show program banner) with argument '1'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'trace'.
Reading option '-i' ... matched as input url with argument 'rtsp://192.168.0.161:554/11'.
Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option '-an' ... matched as option 'an' (disable audio) with argument '1'.
Reading option '-flags' ... matched as AVOption 'flags' with argument '+global_header'.
Reading option '/home/melo/samba/video/19-03-07/cam1/16-06-11.mp4' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option y (overwrite output files) with argument 1.
Applying option hide_banner (do not show program banner) with argument 1.
Applying option loglevel (set logging level) with argument trace.
Successfully parsed a group of options.
Parsing a group of options: input url rtsp://192.168.0.161:554/11.
Successfully parsed a group of options.
Opening an input file: rtsp://192.168.0.161:554/11.
Probing rtsp score:100 size:0
[tcp @ 0x1b5cc40] No default whitelist set
[tcp @ 0x1b5cc40] Original list of addresses:
[tcp @ 0x1b5cc40] Address 192.168.0.161 port 554
[tcp @ 0x1b5cc40] Interleaved list of addresses:
[tcp @ 0x1b5cc40] Address 192.168.0.161 port 554
[tcp @ 0x1b5cc40] Starting connection attempt to 192.168.0.161 port 554
[tcp @ 0x1b5cc40] Successfully connected to 192.168.0.161 port 554
[rtsp @ 0x1b5abc0] Sending:
OPTIONS rtsp://192.168.0.161:554/11 RTSP/1.0
CSeq: 1
User-Agent: Lavf58.20.100
--
[rtsp @ 0x1b5abc0] ret=1 c=52 [R]
[rtsp @ 0x1b5abc0] ret=1 c=54 [T]
[rtsp @ 0x1b5abc0] ret=1 c=53 [S]
[rtsp @ 0x1b5abc0] ret=1 c=50 [P]
[rtsp @ 0x1b5abc0] ret=1 c=2f [/]
[rtsp @ 0x1b5abc0] ret=1 c=31 [1]
[rtsp @ 0x1b5abc0] ret=1 c=2e [.]
[rtsp @ 0x1b5abc0] ret=1 c=30 [0]
[rtsp @ 0x1b5abc0] ret=1 c=20 [ ]
[rtsp @ 0x1b5abc0] ret=1 c=32 [2]
[rtsp @ 0x1b5abc0] ret=1 c=30 [0]
Last message repeated 1 times
[rtsp @ 0x1b5abc0] ret=1 c=20 [ ]
[rtsp @ 0x1b5abc0] ret=1 c=4f [O]
[rtsp @ 0x1b5abc0] ret=1 c=4b [K]
[rtsp @ 0x1b5abc0] ret=1 c=0d [
]
[rtsp @ 0x1b5abc0] ret=1 c=0a [
]
[rtsp @ 0x1b5abc0] line='RTSP/1.0 200 OK'
[rtsp @ 0x1b5abc0] ret=1 c=43 [C]
[rtsp @ 0x1b5abc0] ret=1 c=53 [S]
[rtsp @ 0x1b5abc0] ret=1 c=65 [e]
[rtsp @ 0x1b5abc0] ret=1 c=71 [q]
[rtsp @ 0x1b5abc0] ret=1 c=3a [:]
[rtsp @ 0x1b5abc0] ret=1 c=20 [ ]
[rtsp @ 0x1b5abc0] ret=1 c=31 [1]
[rtsp @ 0x1b5abc0] ret=1 c=0d [
]
[rtsp @ 0x1b5abc0] ret=1 c=0a [
]
良いコーディングと成功への道はすべてが明確です。
Error: unable to open display
Splitting the commandline.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Reading option '-use_wallclock_as_timestamps' ... matched as AVOption 'use_wallclock_as_timestamps' with argument '1'.
Reading option '-hide_banner' ... matched as option 'hide_banner' (do not show program banner) with argument '1'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'trace'.
Reading option '-i' ... matched as input url with argument 'rtsp://192.168.0.163:554/11'.
Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option '-an' ... matched as option 'an' (disable audio) with argument '1'.
Reading option '-flags' ... matched as AVOption 'flags' with argument '+global_header'.
Reading option '/home/melo/samba/video/19-03-07/cam3/16-06-11.mp4' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option y (overwrite output files) with argument 1.
Applying option hide_banner (do not show program banner) with argument 1.
Applying option loglevel (set logging level) with argument trace.
Successfully parsed a group of options.
Parsing a group of options: input url rtsp://192.168.0.163:554/11.
Successfully parsed a group of options.
Opening an input file: rtsp://192.168.0.163:554/11.
Probing rtsp score:100 size:0
[tcp @ 0x18eec40] No default whitelist set
[tcp @ 0x18eec40] Original list of addresses:
[tcp @ 0x18eec40] Address 192.168.0.163 port 554
[tcp @ 0x18eec40] Interleaved list of addresses:
[tcp @ 0x18eec40] Address 192.168.0.163 port 554
[tcp @ 0x18eec40] Starting connection attempt to 192.168.0.163 port 554
[tcp @ 0x18eec40] Successfully connected to 192.168.0.163 port 554
[rtsp @ 0x18ecbc0] Sending:
OPTIONS rtsp://192.168.0.163:554/11 RTSP/1.0
CSeq: 1
User-Agent: Lavf58.20.100
--
[rtsp @ 0x18ecbc0] ret=1 c=00 [[rtsp @ 0x18ecbc0] ret=1 c=06 [?]
[rtsp @ 0x18ecbc0] ret=1 c=08 []
[rtsp @ 0x18ecbc0] ret=1 c=00 [[rtsp @ 0x18ecbc0] ret=1 c=06 [?]
[rtsp @ 0x18ecbc0] ret=1 c=04 [?]
[rtsp @ 0x18ecbc0] ret=1 c=00 [[rtsp @ 0x18ecbc0] ret=1 c=01 [?]
[rtsp @ 0x18ecbc0] ret=1 c=48 [H]
[rtsp @ 0x18ecbc0] ret=1 c=02 [?]
[rtsp @ 0x18ecbc0] ret=1 c=2a [*]
[rtsp @ 0x18ecbc0] ret=1 c=e0 [à]
[rtsp @ 0x18ecbc0] ret=1 c=bc [Œ]
[rtsp @ 0x18ecbc0] ret=1 c=84 []
[rtsp @ 0x18ecbc0] ret=1 c=c0 [À]
[rtsp @ 0x18ecbc0] ret=1 c=a8 [š]
[rtsp @ 0x18ecbc0] ret=1 c=00 [[rtsp @ 0x18ecbc0] ret=1 c=a3 [£]
[rtsp @ 0x18ecbc0] ret=1 c=ff [ÿ]
Last message repeated 9 times
[rtsp @ 0x18ecbc0] ret=1 c=00 [[rtsp @ 0x18ecbc0] ret=1 c=06 [?]
[rtsp @ 0x18ecbc0] ret=1 c=08 []
[rtsp @ 0x18ecbc0] ret=1 c=00 [[rtsp @ 0x18ecbc0] ret=1 c=06 [?]
[rtsp @ 0x18ecbc0] ret=1 c=04 [?]
[rtsp @ 0x18ecbc0] ret=1 c=00 [[rtsp @ 0x18ecbc0] ret=1 c=01 [?]
[rtsp @ 0x18ecbc0] ret=1 c=48 [H]
[rtsp @ 0x18ecbc0] ret=1 c=02 [?]
[rtsp @ 0x18ecbc0] ret=1 c=2a [*]
[rtsp @ 0x18ecbc0] ret=1 c=e0 [à]
[rtsp @ 0x18ecbc0] ret=1 c=bc [Œ]
[rtsp @ 0x18ecbc0] ret=1 c=84 []
[rtsp @ 0x18ecbc0] ret=1 c=c0 [À]
[rtsp @ 0x18ecbc0] ret=1 c=a8 [š]
[rtsp @ 0x18ecbc0] ret=1 c=00 [[rtsp @ 0x18ecbc0] ret=1 c=a3 [£]
[rtsp @ 0x18ecbc0] ret=1 c=ff [ÿ]
Last message repeated 9 times
[rtsp @ 0x18ecbc0] ret=1 c=00 [[rtsp @ 0x18ecbc0] ret=1 c=06 [?]
[rtsp @ 0x18ecbc0] ret=1 c=08 []
[rtsp @ 0x18ecbc0] ret=1 c=00 [[rtsp @ 0x18ecbc0] ret=1 c=06 [?]
[rtsp @ 0x18ecbc0] ret=1 c=04 [?]
[rtsp @ 0x18ecbc0] ret=1 c=00 [[rtsp @ 0x18ecbc0] ret=1 c=01 [?]
[rtsp @ 0x18ecbc0] ret=1 c=48 [H]
[rtsp @ 0x18ecbc0] ret=1 c=02 [?]
[rtsp @ 0x18ecbc0] ret=1 c=2a [*]
[rtsp @ 0x18ecbc0] ret=1 c=e0 [à]
[rtsp @ 0x18ecbc0] ret=1 c=bc [Œ]
[rtsp @ 0x18ecbc0] ret=1 c=84 []
[rtsp @ 0x18ecbc0] ret=1 c=c0 [À]
[rtsp @ 0x18ecbc0] ret=1 c=a8 [š]
[rtsp @ 0x18ecbc0] ret=1 c=00 [[rtsp @ 0x18ecbc0] ret=1 c=a3 [£]
[rtsp @ 0x18ecbc0] ret=1 c=ff [ÿ]
Last message repeated 9 times
[rtsp @ 0x18ecbc0] ret=1 c=00 [[rtsp @ 0x18ecbc0] ret=1 c=06 [?]
[rtsp @ 0x18ecbc0] ret=1 c=08 []
[rtsp @ 0x18ecbc0] ret=1 c=00 [[rtsp @ 0x18ecbc0] ret=1 c=06 [?]
[rtsp @ 0x18ecbc0] ret=1 c=04 [?]
[rtsp @ 0x18ecbc0] ret=1 c=00 [[rtsp @ 0x18ecbc0] ret=1 c=01 [?]
[rtsp @ 0x18ecbc0] ret=1 c=48 [H]
[rtsp @ 0x18ecbc0] ret=1 c=02 [?]
[rtsp @ 0x18ecbc0] ret=1 c=2a [*]
[rtsp @ 0x18ecbc0] ret=1 c=e0 [à]
[rtsp @ 0x18ecbc0] ret=1 c=bc [Œ]
[rtsp @ 0x18ecbc0] ret=1 c=84 []
[rtsp @ 0x18ecbc0] ret=1 c=c0 [À]
[rtsp @ 0x18ecbc0] ret=1 c=a8 [š]
[rtsp @ 0x18ecbc0] ret=1 c=00 [[rtsp @ 0x18ecbc0] ret=1 c=a3 [£]
[rtsp @ 0x18ecbc0] ret=1 c=ff [ÿ]
Last message repeated 9 times
[rtsp @ 0x18ecbc0] ret=1 c=00 [[rtsp @ 0x18ecbc0] ret=1 c=06 [?]
[rtsp @ 0x18ecbc0] ret=1 c=08 []
[rtsp @ 0x18ecbc0] ret=1 c=00 [[rtsp @ 0x18ecbc0] ret=1 c=06 [?]
[rtsp @ 0x18ecbc0] ret=1 c=04 [?]
[rtsp @ 0x18ecbc0] ret=1 c=00 [[rtsp @ 0x18ecbc0] ret=1 c=01 [?]
[rtsp @ 0x18ecbc0] ret=1 c=48 [H]
[rtsp @ 0x18ecbc0] ret=1 c=02 [?]
[rtsp @ 0x18ecbc0] ret=1 c=2a [*]
[rtsp @ 0x18ecbc0] ret=1 c=e0 [à]
[rtsp @ 0x18ecbc0] ret=1 c=bc [Œ]
[rtsp @ 0x18ecbc0] ret=1 c=84 []
[rtsp @ 0x18ecbc0] ret=1 c=c0 [À]
[rtsp @ 0x18ecbc0] ret=1 c=a8 [š]
[rtsp @ 0x18ecbc0] ret=1 c=00 [[rtsp @ 0x18ecbc0] ret=1 c=a3 [£]
[rtsp @ 0x18ecbc0] ret=1 c=ff [ÿ]
Last message repeated 9 times
[rtsp @ 0x18ecbc0] ret=1 c=00 [[rtsp @ 0x18ecbc0] ret=1 c=06 [?]
[rtsp @ 0x18ecbc0] ret=1 c=08 []
[rtsp @ 0x18ecbc0] ret=1 c=00 [[rtsp @ 0x18ecbc0] ret=1 c=06 [?]
[rtsp @ 0x18ecbc0] ret=1 c=04 [?]
[rtsp @ 0x18ecbc0] ret=1 c=00 [[rtsp @ 0x18ecbc0] ret=1 c=01 [?]
[rtsp @ 0x18ecbc0] ret=1 c=48 [H]
[rtsp @ 0x18ecbc0] ret=1 c=02 [?]
[rtsp @ 0x18ecbc0] ret=1 c=2a [*]
[rtsp @ 0x18ecbc0] ret=1 c=e0 [à]
[rtsp @ 0x18ecbc0] ret=1 c=bc [Œ]
[rtsp @ 0x18ecbc0] ret=1 c=84 []
[rtsp @ 0x18ecbc0] ret=1 c=c0 [À]
[rtsp @ 0x18ecbc0] ret=1 c=a8 [š]
[rtsp @ 0x18ecbc0] ret=1 c=00 [[rtsp @ 0x18ecbc0] ret=1 c=a3 [£]
[rtsp @ 0x18ecbc0] ret=1 c=ff [ÿ]
Last message repeated 9 times
たわごとみたいです。
ログファイルが不完全だが十分だと思います。これは、任意のカメラでランダムに表示されます。
どうすれば修正できますか?
答え1
私は解決策を自分で見つけました。私が経験している問題は、パケットが真偽かどうかです。強制TCP接続フラグを追加してみました(-rtsp_transport TCP)動作します。大丈夫です。