Поток RTSP не правильный - PullRequest
       118

Поток RTSP не правильный

0 голосов
/ 23 октября 2019

Я пытаюсь передавать потоковое видео RTSP только с моей веб-камеры и использовать канал внутри виртуальной машины (контейнера 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

Любые мысли будут с благодарностью.

Ответы [ 2 ]

0 голосов
/ 05 ноября 2019

Это на самом деле оказалось довольно сложным. В конце концов исправление было на стороне сервера (где я создавал поток). Мне нужно было использовать следующую цепочку:

: 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).

0 голосов
/ 24 октября 2019

После прочтения ваших журналов кажется, что вы можете подключиться к протоколу RTSP, но протокол RTP не работает.

Я бы попробовал две вещи:

  • streamс rtp{dst=172.19.0.1
  • Воспроизведение потока с --rtsp-tcp (если это работает, это проблема с UDP и вашей конфигурацией виртуальной машины)
...