RTSP 流不正确
RTSP stream is not correct
我正在尝试流式传输,而 RTSP 视频仅从我的网络摄像头流式传输,并在同一台机器上使用 VM(Docker 容器)内的提要。
这是我正在使用的命令行参数:
_vlcInstance = new LibVLCSharp.Shared.LibVLC("--dshow-vdev=Microsoft LifeCam Cinema(TM)", "--no-audio", "--verbose=2", "--no-spu");
_player = new MediaPlayer(_vlcInstance);
_media.AddOption(":sout=#transcode{vcodec=h264,scale=Auto,acodec=none,scodec=none}:rtp{dst=127.0.0.1,port=5004,mux=ts,sap,name=cam,sdp=rtsp://127.0.0.1:5004/cam} :no-sout-all :sout-keep");
_player.Play(_media);
当我启动这段代码时,我可以从容器内部进行连接,但是 "Playing" 事件处理程序永远不会执行。这是日志:
facerecognition | [00007fb3fc05c9e0] main libvlc debug: VLC media player - 3.0.8 Vetinari
facerecognition | [00007fb3fc05c9e0] main libvlc debug: Copyright © 1996-2019 the VideoLAN team
facerecognition | [00007fb3fc05c9e0] main libvlc debug: revision 3.0.8-0-gf350b6b5a7
facerecognition | [00007fb3fc05c9e0] main libvlc debug: configured with ./configure '--build=x86_64-linux-gnu' '--prefix=/usr' '--includedir=${prefix}/include' '--mandir=${prefix}/share/man' '--infodir=${prefix}/share/info' '--sysconfdir=/etc' '--localstatedir=/var' '--disable-silent-rules' '--libdir=${prefix}/lib/x86_64-linux-gnu' '--libexecdir=${prefix}/lib/x86_64-linux-gnu' '--disable-maintainer-mode' '--disable-dependency-tracking' '--config-cache' '--disable-update-check' '--enable-fast-install' '--docdir=/usr/share/doc/vlc' '--with-binary-version=3.0.8-0+deb9u1' '--enable-a52' '--enable-aa' '--enable-bluray' '--enable-avahi' '--enable-caca' '--enable-chromaprint' '--enable-chromecast' '--enable-dbus' '--enable-dca' '--enable-dvbpsi' '--enable-dvdnav' '--enable-faad' '--enable-flac' '--enable-fluidsynth' '--enable-freerdp' '--enable-freetype' '--enable-fribidi' '--enable-gles2' '--enable-gnutls' '--enable-harfbuzz' '--enable-jack' '--enable-kate' '--enable-libass' '--enable-libmpeg2' '--enable-libxml2' '--enable-lirc' '--enable-live555' '--enable-mad' '--enable-matroska' '--enable-mod' '--enable-mpc' '--enable-mpg123' '--enable-mtp'
'--enable-ncurses' '--enable-notify' '--enable-ogg' '--enable-opus' '--enable-pulse' '--enable-qt' '--enable-realrtsp' '--enable-samplerate' '--enable-sdl-image' '--enable-sftp' '--enable-shine' '--enable-shout' '--enable-skins2' '--enable-sndio' '--enable-soxr' '--enable-speex' '--enable-svg' '--enable-svgdec' '--enable-taglib' '--enable-theora' '--enable-twolame' '--enable-upnp' '--enable-vdpau' '--enable-vnc' '--enable-vorbis' '--enable-x264' '--enable-x265' '--enable-zvbi' '--with-kde-solid=/usr/share/solid/actions/' '--disable-aribsub' '--disable-d3d11va' '--disable-decklink' '--disable-directx' '--disable-dsm' '--disable-dxva2' '--disable-fdkaac' '--disable-fluidlite' '--disable-goom' '--disable-gst-decode' '--disable-libplacebo' '--disable-libtar' '--disable-macosx' '--disable-macosx-avfoundation' '--disable-macosx-qtkit' '--disable-mfx' '--disable-opencv' '--disable-projectm' '--disable-schroedinger' '--disable-sparkle' '--disable-srt' '--disable-telx' '--disable-vpx' '--disable-vsxu' '--disable-wasapi' '--enable-alsa' '--enable-dc1394' '--enable-dv1394' '--enable-linsys' '--enable-nfs' '--enable-omxil' '--enable-udev' '--enable-v4l2' '--enable-wayland' '--enable-libva' '--enable-vcd' '--enable-smbclient' '--disable-oss' '--enable-crystalhd' '--enable-mmx' '--enable-sse' '--disable-neon' '--disable-altivec' 'build_alias=x86_64-linux-gnu' 'CFLAGS=-g -O2 -fdebug-prefix-map=/build/vlc-HzCgLh/vlc-3.0.8=. -fstack-protector-strong -Wformat -Werror=format-security ' 'LDFLAGS=-Wl,-z,relro -Wl,-z,now -Wl,--as-needed' 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' 'CXXFLAGS=-g -O2 -fdebug-prefix-map=/build/vlc-HzCgLh/vlc-3.0.8=. -fstack-protector-strong -Wformat -Werror=format-security ' 'OBJCFLAGS=-g -O2 -fdebug-prefix-map=/build/vlc-HzCgLh/vlc-3.0.8=. -fstack-protector-strong -Wformat -Werror=format-security'
facerecognition | [00007fb3fc05c9e0] main libvlc debug: searching plug-in modules
facerecognition | [00007fb3fc05c9e0] main libvlc debug: loading plugins cache file /usr/lib/x86_64-linux-gnu/vlc/plugins/plugins.dat
facerecognition | [00007fb3fc05c9e0] main libvlc debug: recursively browsing `/usr/lib/x86_64-linux-gnu/vlc/plugins'
facerecognition | [00007fb3fc05c9e0] main libvlc debug: plug-ins loaded: 509 modules
facerecognition | [00007fb3fc05cc70] main logger debug: looking for logger module matching "any": 4 candidates
facerecognition | [00007fb3fc05cc70] main logger debug: using logger module "console"
facerecognition | [00007fb3fc05c9e0] main libvlc debug: translation test: code is "C"
facerecognition | [00007fb3fc11cdb0] main input debug: using default timeshift path
facerecognition | [00007fb3fc11cdb0] main input debug: `rtsp://172.19.0.1:5004/cam' gives access `rtsp' demux `any' path `172.19.0.1:5004/cam'
facerecognition | [00007fb3e4000d30] main input source debug: creating demux: access='rtsp' demux='any' location='172.19.0.1:5004/cam' file='(null)'
facerecognition | [00007fb3e4000ec0] main demux debug: looking for access_demux module matching "rtsp": 17 candidates
facerecognition | Completed setting up LibVLC environment.
facerecognition | [00007fb3e4000ec0] live555 demux debug: version 2016.11.28
facerecognition | Opening connection to 172.19.0.1, port 5004...
facerecognition | ...remote connection opened
facerecognition | Sending request: OPTIONS rtsp://172.19.0.1:5004/cam RTSP/1.0
facerecognition | CSeq: 2
facerecognition | User-Agent: LibVLC/3.0.8 (LIVE555 Streaming Media v2016.11.28)
facerecognition |
facerecognition |
facerecognition | Got the face client.
facerecognition | Setting module twin property handler
edgeHubDev | <6> 2019-10-23 20:03:50.530 +00:00 [INF] - Opened link ModuleMessages for david-laptop/facerecognition
facerecognition | [00007fb3e4000ec0] live555 demux debug: connection timeout
facerecognition | [00007fb3e4000ec0] live555 demux error: Failed to connect with rtsp://172.19.0.1:5004/cam
facerecognition | [00007fb3e4000ec0] main demux debug: no access_demux modules matched
facerecognition | [00007fb3e40036f0] main stream debug: creating access: rtsp://172.19.0.1:5004/cam
facerecognition | [00007fb3e40036f0] main stream debug: looking for access module matching "rtsp": 27 candidates
facerecognition | [00007fb3e40036f0] satip stream debug: try to open 'rtsp://172.19.0.1:5004/cam'
facerecognition | [00007fb3e40036f0] satip stream debug: connect to host '172.19.0.1'
facerecognition | [00007fb3e40036f0] main stream debug: net: connecting to 172.19.0.1 port 5004
facerecognition | [00007fb3e40036f0] main stream debug: connection succeeded (socket = 108)
facerecognition | [00007fb3e40036f0] main stream debug: net: opening 0.0.0.0 datagram port 9298
facerecognition | [00007fb3e40036f0] main stream debug: net: opening 0.0.0.0 datagram port 9299
如有任何想法,我们将不胜感激。
看了你的日志,好像可以连接到RTSP协议,但是RTP协议失败了。
我会尝试两件事:
- 流
rtp{dst=172.19.0.1
- 使用
--rtsp-tcp
播放流(如果可行,则 UDP 和您的 VM 配置有问题)
这实际上是一个复杂的故障排除。最终修复在服务器端(我创建流的地方)。我需要使用以下链:
:sout=#transcode{vcodec=h264,venc=any,vb=1000,acodec=none}:rtp{dst=192.168.1.100,port=8554,sdp= rtsp://:8554/cam.sdp}
(IP应该是机器实际的局域网IP,不是127.0.0.1)。
我正在尝试流式传输,而 RTSP 视频仅从我的网络摄像头流式传输,并在同一台机器上使用 VM(Docker 容器)内的提要。
这是我正在使用的命令行参数:
_vlcInstance = new LibVLCSharp.Shared.LibVLC("--dshow-vdev=Microsoft LifeCam Cinema(TM)", "--no-audio", "--verbose=2", "--no-spu");
_player = new MediaPlayer(_vlcInstance);
_media.AddOption(":sout=#transcode{vcodec=h264,scale=Auto,acodec=none,scodec=none}:rtp{dst=127.0.0.1,port=5004,mux=ts,sap,name=cam,sdp=rtsp://127.0.0.1:5004/cam} :no-sout-all :sout-keep");
_player.Play(_media);
当我启动这段代码时,我可以从容器内部进行连接,但是 "Playing" 事件处理程序永远不会执行。这是日志:
facerecognition | [00007fb3fc05c9e0] main libvlc debug: VLC media player - 3.0.8 Vetinari
facerecognition | [00007fb3fc05c9e0] main libvlc debug: Copyright © 1996-2019 the VideoLAN team
facerecognition | [00007fb3fc05c9e0] main libvlc debug: revision 3.0.8-0-gf350b6b5a7
facerecognition | [00007fb3fc05c9e0] main libvlc debug: configured with ./configure '--build=x86_64-linux-gnu' '--prefix=/usr' '--includedir=${prefix}/include' '--mandir=${prefix}/share/man' '--infodir=${prefix}/share/info' '--sysconfdir=/etc' '--localstatedir=/var' '--disable-silent-rules' '--libdir=${prefix}/lib/x86_64-linux-gnu' '--libexecdir=${prefix}/lib/x86_64-linux-gnu' '--disable-maintainer-mode' '--disable-dependency-tracking' '--config-cache' '--disable-update-check' '--enable-fast-install' '--docdir=/usr/share/doc/vlc' '--with-binary-version=3.0.8-0+deb9u1' '--enable-a52' '--enable-aa' '--enable-bluray' '--enable-avahi' '--enable-caca' '--enable-chromaprint' '--enable-chromecast' '--enable-dbus' '--enable-dca' '--enable-dvbpsi' '--enable-dvdnav' '--enable-faad' '--enable-flac' '--enable-fluidsynth' '--enable-freerdp' '--enable-freetype' '--enable-fribidi' '--enable-gles2' '--enable-gnutls' '--enable-harfbuzz' '--enable-jack' '--enable-kate' '--enable-libass' '--enable-libmpeg2' '--enable-libxml2' '--enable-lirc' '--enable-live555' '--enable-mad' '--enable-matroska' '--enable-mod' '--enable-mpc' '--enable-mpg123' '--enable-mtp'
'--enable-ncurses' '--enable-notify' '--enable-ogg' '--enable-opus' '--enable-pulse' '--enable-qt' '--enable-realrtsp' '--enable-samplerate' '--enable-sdl-image' '--enable-sftp' '--enable-shine' '--enable-shout' '--enable-skins2' '--enable-sndio' '--enable-soxr' '--enable-speex' '--enable-svg' '--enable-svgdec' '--enable-taglib' '--enable-theora' '--enable-twolame' '--enable-upnp' '--enable-vdpau' '--enable-vnc' '--enable-vorbis' '--enable-x264' '--enable-x265' '--enable-zvbi' '--with-kde-solid=/usr/share/solid/actions/' '--disable-aribsub' '--disable-d3d11va' '--disable-decklink' '--disable-directx' '--disable-dsm' '--disable-dxva2' '--disable-fdkaac' '--disable-fluidlite' '--disable-goom' '--disable-gst-decode' '--disable-libplacebo' '--disable-libtar' '--disable-macosx' '--disable-macosx-avfoundation' '--disable-macosx-qtkit' '--disable-mfx' '--disable-opencv' '--disable-projectm' '--disable-schroedinger' '--disable-sparkle' '--disable-srt' '--disable-telx' '--disable-vpx' '--disable-vsxu' '--disable-wasapi' '--enable-alsa' '--enable-dc1394' '--enable-dv1394' '--enable-linsys' '--enable-nfs' '--enable-omxil' '--enable-udev' '--enable-v4l2' '--enable-wayland' '--enable-libva' '--enable-vcd' '--enable-smbclient' '--disable-oss' '--enable-crystalhd' '--enable-mmx' '--enable-sse' '--disable-neon' '--disable-altivec' 'build_alias=x86_64-linux-gnu' 'CFLAGS=-g -O2 -fdebug-prefix-map=/build/vlc-HzCgLh/vlc-3.0.8=. -fstack-protector-strong -Wformat -Werror=format-security ' 'LDFLAGS=-Wl,-z,relro -Wl,-z,now -Wl,--as-needed' 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' 'CXXFLAGS=-g -O2 -fdebug-prefix-map=/build/vlc-HzCgLh/vlc-3.0.8=. -fstack-protector-strong -Wformat -Werror=format-security ' 'OBJCFLAGS=-g -O2 -fdebug-prefix-map=/build/vlc-HzCgLh/vlc-3.0.8=. -fstack-protector-strong -Wformat -Werror=format-security'
facerecognition | [00007fb3fc05c9e0] main libvlc debug: searching plug-in modules
facerecognition | [00007fb3fc05c9e0] main libvlc debug: loading plugins cache file /usr/lib/x86_64-linux-gnu/vlc/plugins/plugins.dat
facerecognition | [00007fb3fc05c9e0] main libvlc debug: recursively browsing `/usr/lib/x86_64-linux-gnu/vlc/plugins'
facerecognition | [00007fb3fc05c9e0] main libvlc debug: plug-ins loaded: 509 modules
facerecognition | [00007fb3fc05cc70] main logger debug: looking for logger module matching "any": 4 candidates
facerecognition | [00007fb3fc05cc70] main logger debug: using logger module "console"
facerecognition | [00007fb3fc05c9e0] main libvlc debug: translation test: code is "C"
facerecognition | [00007fb3fc11cdb0] main input debug: using default timeshift path
facerecognition | [00007fb3fc11cdb0] main input debug: `rtsp://172.19.0.1:5004/cam' gives access `rtsp' demux `any' path `172.19.0.1:5004/cam'
facerecognition | [00007fb3e4000d30] main input source debug: creating demux: access='rtsp' demux='any' location='172.19.0.1:5004/cam' file='(null)'
facerecognition | [00007fb3e4000ec0] main demux debug: looking for access_demux module matching "rtsp": 17 candidates
facerecognition | Completed setting up LibVLC environment.
facerecognition | [00007fb3e4000ec0] live555 demux debug: version 2016.11.28
facerecognition | Opening connection to 172.19.0.1, port 5004...
facerecognition | ...remote connection opened
facerecognition | Sending request: OPTIONS rtsp://172.19.0.1:5004/cam RTSP/1.0
facerecognition | CSeq: 2
facerecognition | User-Agent: LibVLC/3.0.8 (LIVE555 Streaming Media v2016.11.28)
facerecognition |
facerecognition |
facerecognition | Got the face client.
facerecognition | Setting module twin property handler
edgeHubDev | <6> 2019-10-23 20:03:50.530 +00:00 [INF] - Opened link ModuleMessages for david-laptop/facerecognition
facerecognition | [00007fb3e4000ec0] live555 demux debug: connection timeout
facerecognition | [00007fb3e4000ec0] live555 demux error: Failed to connect with rtsp://172.19.0.1:5004/cam
facerecognition | [00007fb3e4000ec0] main demux debug: no access_demux modules matched
facerecognition | [00007fb3e40036f0] main stream debug: creating access: rtsp://172.19.0.1:5004/cam
facerecognition | [00007fb3e40036f0] main stream debug: looking for access module matching "rtsp": 27 candidates
facerecognition | [00007fb3e40036f0] satip stream debug: try to open 'rtsp://172.19.0.1:5004/cam'
facerecognition | [00007fb3e40036f0] satip stream debug: connect to host '172.19.0.1'
facerecognition | [00007fb3e40036f0] main stream debug: net: connecting to 172.19.0.1 port 5004
facerecognition | [00007fb3e40036f0] main stream debug: connection succeeded (socket = 108)
facerecognition | [00007fb3e40036f0] main stream debug: net: opening 0.0.0.0 datagram port 9298
facerecognition | [00007fb3e40036f0] main stream debug: net: opening 0.0.0.0 datagram port 9299
如有任何想法,我们将不胜感激。
看了你的日志,好像可以连接到RTSP协议,但是RTP协议失败了。
我会尝试两件事:
- 流
rtp{dst=172.19.0.1
- 使用
--rtsp-tcp
播放流(如果可行,则 UDP 和您的 VM 配置有问题)
这实际上是一个复杂的故障排除。最终修复在服务器端(我创建流的地方)。我需要使用以下链:
:sout=#transcode{vcodec=h264,venc=any,vb=1000,acodec=none}:rtp{dst=192.168.1.100,port=8554,sdp= rtsp://:8554/cam.sdp}
(IP应该是机器实际的局域网IP,不是127.0.0.1)。