我正在尝试从网络摄像头流式传输和仅RTSP视频流,并在同一台计算机上的VM(Docker容器)中使用Feed。
这是我正在使用的命令行参数:
_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);
当我启动此代码时,我可以从容器内进行连接,但是“播放”事件处理程序永远不会执行。这是日志:
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
任何想法都将不胜感激。
我认为您使用的是错误的127.0.0.1。即使您在同一台计算机上,每个容器也都有自己的127.0.0.1,这与主机的本地主机不同。
我不是很了解您的设置和端口重定向,但说您有两个容器A(生产者)和B容器(消费者),则必须访问rtsp://A:5004/
(可以将容器名称用作我做到了)