1

I am trying to stream and RTSP video only stream from my webcam and consume the feed inside a VM (Docker container) on the same machine.

Here are the commands line args I'm using:

_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);

When I start this code, I can connect from within the container, but the "Playing" event handler never executes. Here are the logs:

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

Any thoughts would be greatly appreciated.

runninggeek
  • 147
  • 2
  • 11
  • Check the network interface/ip address where you are streaming and receiving. I see 2 different address in the logs. – mail2subhajit Oct 23 '19 at 20:57
  • That's definitely possible, but from what I can tell, this is correct. The code creating the stream uses 127.0.0.1 to push it to the localhost, but the 172..19.0.1 IP is the "host" IP from the Docker container's perspective (based on the docker network). I can see in the logs the it's connecting. So, I think it's right, but obviously, I'm not sure. I just don't know what else I would change it to. – runninggeek Oct 23 '19 at 21:42
  • Check the ipconfig/ifconfig on VM machine and Host machine. Communication need to happen with ethernet address, not with your loopback address. – mail2subhajit Oct 24 '19 at 21:15

2 Answers2

2

This actually turned out to be an involved bit of troubleshooting. Eventually the fix was on the server side (where I was creating the stream). I needed to use the following chain:

:sout=#transcode{vcodec=h264,venc=any,vb=1000,acodec=none}:rtp{dst=192.168.1.100,port=8554,sdp=rtsp://:8554/cam.sdp}

(The IP should be the actual LAN IP of the machine. Not 127.0.0.1).

runninggeek
  • 147
  • 2
  • 11
0

After reading your logs, it seems that you are able to connect to the RTSP protocol, but the RTP protocol fails.

I'd try two things:

  • stream with rtp{dst=172.19.0.1
  • Play the stream with --rtsp-tcp (if that works, it's an issue with UDP and your VM configuration)
cube45
  • 3,429
  • 2
  • 24
  • 35
  • I changed the client IP to be the IP of the localhost and it connects. I then tried it with UDP and TCP. UDP log - https://pastebin.com/BDxJzLt8 TCP log - https://pastebin.com/QsyxeD0x I am not sure why it does not detect anything. – runninggeek Oct 24 '19 at 13:38
  • so yeah, I guess `rtp{dst=127.0.0.1` is wrong because you send your data only to localhost. From what I've read in the source code, you should be able to remove the dst and port parameters, since you have a sdp that would create a socket "on-demand" – cube45 Oct 24 '19 at 14:39