rtsp server not connecting

curl 192.168.178.225:554 results in:
curl: (7) Failed to connect to 192.168.178.225 port 554: Connection refused

would this be the expected error?

Can you try running from the hostOS console the following: curl 127.0.0.1:554. How about the same but from the container with the RTSP service listening on 554/tcp?

curl 127.0.0.1:554 results in the process finishing in about 1 minute without any output

the verbose curl -v 127.0.0.1:554 results in the output below. the HostOS seems to have a slightly different output, but nothing appears significant.

Balena HostOS:

root@226563:~# curl -v 127.0.0.1:554
*   Trying 127.0.0.1:554...
* Connected to 127.0.0.1 (127.0.0.1) port 554 (#0)
> GET / HTTP/1.1
> Host: 127.0.0.1:554
> User-Agent: curl/7.69.1
> Accept: */*
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 503 Service Unavailable
< Server: GStreamer RTSP Server
< Connection: close
< Cache-Control: no-store
< Pragma: no-cache
< Date: Wed, 05 May 2021 08:07:27 GMT
< 
* Closing connection 0

just to be sure, i tried the same on the regular Ubuntu version. both container and host have the same response

Balena main container &
Ubuntu HostOS &
Ubuntuu main container:

devkit(jasper):~$curl -v 127.0.0.1:554
* Rebuilt URL to: 127.0.0.1:554/
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 554 (#0)
> GET / HTTP/1.1
> Host: 127.0.0.1:554
> User-Agent: curl/7.58.0
> Accept: */*
> 
< HTTP/1.1 503 Service Unavailable
< Server: GStreamer RTSP Server
< Connection: close
< Cache-Control: no-store
< Pragma: no-cache
< Date: Wed, 05 May 2021 08:07:12 GMT
< 
* Closing connection 0

Can you try sharing the logs from vlc?

I am guessing you are using the VLC desktop app on your laptop/PC - so starting it from the command line, with the verbose flag - and then trying to connect to the server, should give us some more insight. So vlc --verbose 2
2 would give us the most amount of logs.

jasper@jasper:~$ vlc --verbose 2 rtsp://192.168.178.222/live

VLC media player 3.0.8 Vetinari (revision 3.0.8-0-gf350b6b5a7)
[0000560552dca630] main libvlc debug: VLC media player - 3.0.8 Vetinari
[0000560552dca630] main libvlc debug: Copyright © 1996-2019 the VideoLAN team
[0000560552dca630] main libvlc debug: revision 3.0.8-0-gf350b6b5a7
[0000560552dca630] 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' '--runstatedir=/run' '--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-0ubuntu18.04.1' '--enable-a52' '--enable-aa' '--enable-aribsub' '--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-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-d3d11va' '--disable-decklink' '--disable-directx' '--disable-dsm' '--disable-dxva2' '--disable-fdkaac' '--disable-fluidlite' '--disable-freerdp' '--disable-goom' '--disable-gst-decode' '--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-libplacebo' '--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-3gw7Y1/vlc-3.0.8=. -fstack-protector-strong -Wformat -Werror=format-security ' 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -Wl,--as-needed' 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' 'CXXFLAGS=-g -O2 -fdebug-prefix-map=/build/vlc-3gw7Y1/vlc-3.0.8=. -fstack-protector-strong -Wformat -Werror=format-security ' 'OBJCFLAGS=-g -O2 -fdebug-prefix-map=/build/vlc-3gw7Y1/vlc-3.0.8=. -fstack-protector-strong -Wformat -Werror=format-security'
[0000560552dca630] main libvlc debug: searching plug-in modules
[0000560552dca630] main libvlc debug: loading plugins cache file /usr/lib/x86_64-linux-gnu/vlc/plugins/plugins.dat
[0000560552dca630] main libvlc debug: recursively browsing `/usr/lib/x86_64-linux-gnu/vlc/plugins'
[0000560552dca630] main libvlc debug: plug-ins loaded: 519 modules
[0000560552dca630] main libvlc debug: opening config file (/home/jasper/.config/vlc/vlcrc)
[0000560552dca980] main logger debug: looking for logger module matching "any": 4 candidates
[0000560552dca980] main logger debug: using logger module "console"
[0000560552dca630] main libvlc debug: translation test: code is "C"
[0000560552e5fcf0] main keystore debug: looking for keystore module matching "memory": 4 candidates
[0000560552e5fcf0] main keystore debug: using keystore module "memory"
[0000560552dca630] main libvlc debug: CPU has capabilities MMX MMXEXT SSE SSE2 SSE3 SSSE3 SSE4.1 SSE4.2 AVX AVX2 FPU 
[0000560552e67260] main input debug: Creating an input for 'Media Library'
[0000560552e67260] main input debug: Input is a meta file: disabling unneeded options
[0000560552e67260] main input debug: using timeshift granularity of 50 MiB
[0000560552e67260] main input debug: using default timeshift path
[0000560552e67260] main input debug: `file/directory:///home/jasper/.local/share/vlc/ml.xspf' gives access `file' demux `directory' path `/home/jasper/.local/share/vlc/ml.xspf'
[0000560552e61de0] main input source debug: creating demux: access='file' demux='directory' location='/home/jasper/.local/share/vlc/ml.xspf' file='/home/jasper/.local/share/vlc/ml.xspf'
[0000560552e624d0] main demux debug: looking for access_demux module matching "file": 17 candidates
[0000560552e624d0] main demux debug: no access_demux modules matched
[0000560552e85d00] main stream debug: creating access: file:///home/jasper/.local/share/vlc/ml.xspf
[0000560552e85d00] main stream debug:  (path: /home/jasper/.local/share/vlc/ml.xspf)
[0000560552e85d00] main stream debug: looking for access module matching "file": 28 candidates
[0000560552e85d00] main stream debug: using access module "filesystem"
[0000560552e86d50] main stream debug: looking for stream_filter module matching "prefetch,cache_read": 26 candidates
[0000560552e86d50] cache_read stream debug: Using stream method for AStream*
[0000560552e86d50] cache_read stream debug: starting pre-buffering
[0000560552e86d50] cache_read stream debug: received first data after 0 ms
[0000560552e86d50] cache_read stream debug: pre-buffering done 296 bytes in 0s - 8759 KiB/s
[0000560552e86d50] main stream debug: using stream_filter module "cache_read"
[0000560552e87dd0] main stream debug: looking for stream_filter module matching "any": 26 candidates
[0000560552e87dd0] playlist stream debug: using XSPF playlist reader
[0000560552e87dd0] main stream debug: using stream_filter module "playlist"
[0000560552e87dd0] main stream debug: stream filter added to 0x560552e86d50
[0000560552e8b2c0] main stream debug: looking for stream_filter module matching "any": 26 candidates
[0000560552e8b2c0] main stream debug: no stream_filter modules matched
[0000560552e621c0] main stream_directory debug: looking for stream_directory module matching "any": 1 candidates
[0000560552e621c0] main stream_directory debug: no stream_directory modules matched
[0000560552e61de0] main input source debug: attachment of directory-extractor failed for file:///home/jasper/.local/share/vlc/ml.xspf
[0000560552e8b2c0] main stream debug: looking for stream_filter module matching "record": 26 candidates
[0000560552e8b2c0] main stream debug: using stream_filter module "record"
[0000560552e61de0] main input source debug: creating demux: access='file' demux='directory' location='/home/jasper/.local/share/vlc/ml.xspf' file='/home/jasper/.local/share/vlc/ml.xspf'
[0000560552e624d0] main demux debug: looking for demux module matching "directory": 55 candidates
[0000560552e624d0] main demux debug: using demux module "directory"
[0000560552e8ff40] main demux meta debug: looking for meta reader module matching "any": 2 candidates
[0000560552e8ff40] lua demux meta debug: Trying Lua scripts in /home/jasper/.local/share/vlc/lua/meta/reader
[0000560552e8ff40] lua demux meta debug: Trying Lua scripts in /usr/lib/x86_64-linux-gnu/vlc/lua/meta/reader
[0000560552e8ff40] lua demux meta debug: Trying Lua playlist script /usr/lib/x86_64-linux-gnu/vlc/lua/meta/reader/filename.luac
[0000560552e8ff40] lua demux meta debug: Trying Lua scripts in /usr/share/vlc/lua/meta/reader
[0000560552e8ff40] main demux meta debug: no meta reader modules matched
[0000560552e67260] main input debug: `file/directory:///home/jasper/.local/share/vlc/ml.xspf' successfully opened
[0000560552e94ba0] main xml reader debug: looking for xml reader module matching "any": 1 candidates
[0000560552e94ba0] main xml reader debug: using xml reader module "xml"
[0000560552e67260] main input debug: EOF reached
[0000560552e624d0] main demux debug: removing module "directory"
[0000560552e8b2c0] main stream debug: removing module "record"
[0000560552e87dd0] main stream debug: removing module "playlist"
[0000560552e86d50] main stream debug: removing module "cache_read"
[0000560552e85d00] main stream debug: removing module "filesystem"
[0000560552dce5a0] main playlist debug: creating audio output
[0000560552e8ae00] main audio output debug: looking for audio output module matching "any": 6 candidates
[0000560552e8ae00] vlcpulse audio output debug: using library version 11.1.0
[0000560552e8ae00] vlcpulse audio output debug:  (compiled with version 11.1.0, protocol 32)
[0000560552e8ae00] vlcpulse audio output debug: connected locally to unix:/run/user/1000/pulse/native as client #39
[0000560552e8ae00] vlcpulse audio output debug: using protocol 32, server protocol 32
[0000560552e8ae00] pulse audio output debug: adding sink 0: alsa_output.pci-0000_01_00.1.hdmi-stereo-extra3 (Ellesmere [Radeon RX 580] Digital Stereo (HDMI 4))
[0000560552e8ae00] pulse audio output debug: adding sink 1: alsa_output.pci-0000_00_1b.0.analog-stereo (Built-in Audio Analog Stereo)
[0000560552e8ae00] pulse audio output debug: adding sink 2: alsa_output.platform-snd_aloop.0.analog-stereo (Built-in Audio Analog Stereo)
[0000560552e8ae00] pulse audio output debug: adding sink 3: bluez_sink.70_26_05_3C_78_3C.a2dp_sink (WH-1000XM2)
[0000560552e8ae00] main audio output debug: using audio output module "pulse"
[0000560552dce5a0] main playlist debug: keeping audio output
[0000560552e5d830] main interface debug: looking for interface module matching "dbus,none": 19 candidates
[0000560552e5d830] dbus interface debug: listening on dbus as: org.mpris.MediaPlayer2.vlc
[0000560552e5d830] main interface debug: using interface module "dbus"
[0000560552ea6490] main interface debug: looking for interface module matching "hotkeys,none": 19 candidates
[0000560552ea6490] main interface debug: using interface module "hotkeys"
[0000560552ea6e30] main interface debug: looking for interface module matching "globalhotkeys,none": 19 candidates
[0000560552ea6e30] main interface debug: using interface module "xcb_hotkeys"
[0000560552dca630] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
[0000560552ea7d10] main interface debug: looking for interface module matching "any": 19 candidates
[0000560552e5d830] dbus interface debug: Getting All properties
[0000560552e5d830] dbus interface debug: Getting All properties
[0000560552e5d830] dbus interface debug: Getting All properties
[0000560552e5d830] dbus interface debug: Getting All properties
[00007fa4a03d9a00] main generic debug: looking for extension module matching "any": 1 candidates
[00007fa4a03d9a00] lua generic debug: Opening Lua Extension module
[00007fa4a03d9a00] lua generic debug: Trying Lua scripts in /home/jasper/.local/share/vlc/lua/extensions
[00007fa4a03d9a00] lua generic debug: Trying Lua scripts in /usr/lib/x86_64-linux-gnu/vlc/lua/extensions
[00007fa4a03d9a00] lua generic debug: Trying Lua playlist script /usr/lib/x86_64-linux-gnu/vlc/lua/extensions/VLSub.luac
[00007fa4a03d9a00] lua generic debug: Scanning Lua script /usr/lib/x86_64-linux-gnu/vlc/lua/extensions/VLSub.luac
[00007fa4a03d9a00] lua generic debug: Script /usr/lib/x86_64-linux-gnu/vlc/lua/extensions/VLSub.luac has the following capability flags: 0x5
[00007fa4a03d9a00] lua generic debug: Trying Lua scripts in /usr/share/vlc/lua/extensions
[00007fa4a03d9a00] main generic debug: using extension module "lua"
[0000560552ea7d10] main interface debug: using interface module "qt"
[0000560552dce5a0] main playlist debug: processing request item: null, node: Playlist, skip: 0
[0000560552dce5a0] main playlist debug: rebuilding array of current - root Playlist
[0000560552dce5a0] main playlist debug: rebuild done - 1 items, index -1
[0000560552dce5a0] main playlist debug: starting playback of new item
[0000560552dce5a0] main playlist debug: resyncing on rtsp://192.168.178.222/live
[0000560552dce5a0] main playlist debug: rtsp://192.168.178.222/live is at 0
[0000560552dce5a0] main playlist debug: creating new input thread
[00007fa44c000c40] main input debug: Creating an input for 'rtsp://192.168.178.222/live'
[0000560552dce5a0] main playlist debug: requesting art for new input thread
[00007fa44c000c40] main input debug: using timeshift granularity of 50 MiB
[00007fa44c000c40] main input debug: using default timeshift path
[00007fa44c000c40] main input debug: `rtsp://192.168.178.222/live' gives access `rtsp' demux `any' path `192.168.178.222/live'
[00007fa444000fa0] main input source debug: creating demux: access='rtsp' demux='any' location='192.168.178.222/live' file='(null)'
[00007fa444001130] main demux debug: looking for access_demux module matching "rtsp": 17 candidates
[00007fa444001130] live555 demux debug: version 2018.02.18
Created new TCP socket 38 for connection
Connecting to 192.168.178.222, port 554 on socket 38...
[00007fa438000be0] main meta fetcher debug: looking for meta fetcher module matching "any": 1 candidates
[00007fa438000be0] lua meta fetcher debug: Trying Lua scripts in /home/jasper/.local/share/vlc/lua/meta/fetcher
[00007fa438000be0] lua meta fetcher debug: Trying Lua scripts in /usr/lib/x86_64-linux-gnu/vlc/lua/meta/fetcher
[00007fa438000be0] lua meta fetcher debug: Trying Lua scripts in /usr/share/vlc/lua/meta/fetcher
[00007fa438000be0] main meta fetcher debug: no meta fetcher modules matched
[00007fa438000be0] main art finder debug: looking for art finder module matching "any": 2 candidates
[00007fa438000be0] lua art finder debug: Trying Lua scripts in /home/jasper/.local/share/vlc/lua/meta/art
[00007fa438000be0] lua art finder debug: Trying Lua scripts in /usr/lib/x86_64-linux-gnu/vlc/lua/meta/art
[00007fa438000be0] lua art finder debug: Trying Lua playlist script /usr/lib/x86_64-linux-gnu/vlc/lua/meta/art/00_musicbrainz.luac
[00007fa438000be0] lua art finder debug: skipping script (unmatched scope) /usr/lib/x86_64-linux-gnu/vlc/lua/meta/art/00_musicbrainz.luac
[00007fa438000be0] lua art finder debug: Trying Lua playlist script /usr/lib/x86_64-linux-gnu/vlc/lua/meta/art/01_googleimage.luac
[00007fa438000be0] lua art finder debug: skipping script (unmatched scope) /usr/lib/x86_64-linux-gnu/vlc/lua/meta/art/01_googleimage.luac
[00007fa438000be0] lua art finder debug: Trying Lua playlist script /usr/lib/x86_64-linux-gnu/vlc/lua/meta/art/02_frenchtv.luac
[00007fa438000be0] lua art finder debug: skipping script (unmatched scope) /usr/lib/x86_64-linux-gnu/vlc/lua/meta/art/02_frenchtv.luac
[00007fa438000be0] lua art finder debug: Trying Lua playlist script /usr/lib/x86_64-linux-gnu/vlc/lua/meta/art/03_lastfm.luac
[00007fa438000be0] lua art finder debug: skipping script (unmatched scope) /usr/lib/x86_64-linux-gnu/vlc/lua/meta/art/03_lastfm.luac
[00007fa438000be0] lua art finder debug: Trying Lua scripts in /usr/share/vlc/lua/meta/art
[00007fa438000be0] main art finder debug: no art finder modules matched
[00007fa43c000be0] main meta fetcher debug: looking for meta fetcher module matching "any": 1 candidates
[00007fa43c000be0] lua meta fetcher debug: Trying Lua scripts in /home/jasper/.local/share/vlc/lua/meta/fetcher
[00007fa43c000be0] lua meta fetcher debug: Trying Lua scripts in /usr/lib/x86_64-linux-gnu/vlc/lua/meta/fetcher
[00007fa43c000be0] lua meta fetcher debug: Trying Lua scripts in /usr/share/vlc/lua/meta/fetcher
[00007fa43c000be0] main meta fetcher debug: no meta fetcher modules matched
[00007fa43c000be0] main art finder debug: looking for art finder module matching "any": 2 candidates
[00007fa43c000be0] lua art finder debug: Trying Lua scripts in /home/jasper/.local/share/vlc/lua/meta/art
[00007fa43c000be0] lua art finder debug: Trying Lua scripts in /usr/lib/x86_64-linux-gnu/vlc/lua/meta/art
[0000560552ea7d10] qt interface debug: IM: Setting an input
[00007fa43c000be0] lua art finder debug: Trying Lua playlist script /usr/lib/x86_64-linux-gnu/vlc/lua/meta/art/00_musicbrainz.luac
[00007fa43c000be0] lua art finder debug: Trying Lua playlist script /usr/lib/x86_64-linux-gnu/vlc/lua/meta/art/01_googleimage.luac
[00007fa43c000be0] lua art finder debug: Trying Lua playlist script /usr/lib/x86_64-linux-gnu/vlc/lua/meta/art/02_frenchtv.luac
[00007fa43c000be0] lua art finder debug: Trying Lua playlist script /usr/lib/x86_64-linux-gnu/vlc/lua/meta/art/03_lastfm.luac
[00007fa43c000be0] lua art finder debug: Trying Lua scripts in /usr/share/vlc/lua/meta/art
[00007fa43c000be0] main art finder debug: no art finder modules matched
...remote connection opened
Sending request: OPTIONS rtsp://192.168.178.222:554/live RTSP/1.0
CSeq: 2
User-Agent: LibVLC/3.0.8 (LIVE555 Streaming Media v2018.02.18)


Received 201 new bytes of response data.
Received a complete OPTIONS response:
RTSP/1.0 200 OK
CSeq: 2
Public: OPTIONS, DESCRIBE, ANNOUNCE, GET_PARAMETER, PAUSE, PLAY, RECORD, SETUP, SET_PARAMETER, TEARDOWN
Server: GStreamer RTSP server
Date: Mon, 17 May 2021 08:02:51 GMT


Sending request: DESCRIBE rtsp://192.168.178.222:554/live RTSP/1.0
CSeq: 3
User-Agent: LibVLC/3.0.8 (LIVE555 Streaming Media v2018.02.18)
Accept: application/sdp


[00007fa444001130] live555 demux debug: connection timeout
[00007fa444001130] live555 demux error: Failed to connect with rtsp://192.168.178.222:554/live
[00007fa444001130] main demux debug: no access_demux modules matched
[00007fa444004b00] main stream debug: creating access: rtsp://192.168.178.222/live
[00007fa444004b00] main stream debug: looking for access module matching "rtsp": 28 candidates
[00007fa444004b00] satip stream debug: try to open 'rtsp://192.168.178.222/live'
[00007fa444004b00] satip stream debug: connect to host '192.168.178.222'
[00007fa444004b00] main stream debug: net: connecting to 192.168.178.222 port 554
[00007fa444004b00] main stream debug: connection succeeded (socket = 38)
[00007fa444004b00] main stream debug: net: opening 0.0.0.0 datagram port 9484
[00007fa444004b00] main stream debug: net: opening 0.0.0.0 datagram port 9485
[00007fa444004b00] satip stream error: Failed to setup RTSP session
[00007fa444004b00] main stream debug: net: connecting to 192.168.178.222 port 554
[00007fa444004b00] main stream debug: connection succeeded (socket = 38)
[00007fa444004b00] access_realrtsp stream warning: Cseq mismatch, got 1, assumed 0
[00007fa444004b00] access_realrtsp stream debug: rtsp connected
[00007fa444004b00] access_realrtsp stream warning: only real/helix rtsp servers supported for now
[00007fa444004b00] main stream debug: no access modules matched
[0000560552dce5a0] main playlist debug: dead input
[0000560552ea7d10] qt interface debug: IM: Deleting the input
[0000560552dce5a0] main playlist debug: changing item without a request (current 0/1)
[0000560552dce5a0] main playlist debug: nothing to play

It looks like VLC is connecting to the device, but there is a problem with the RTSP stream itself. Unfortunately I don’t see anything that points to a specific issue, but perhaps a member of the community will spot something. What command are you using to launch the RTSP server, and does that provide any output or log messages?
Here is a sample application that may be helpful to inspect: GitHub - balena-io-playground/capture-and-streaming: Demo of new video capture block and streaming block - on a Jetson Nano with a USB webcam attached, it streams (using gstreamer) to VLC on rtsp://192.168.1.162:8554/server (replace with your Jetson’s local IP address)

I will see if i can get the sample application working to verify that the issue lies with the streamer itself.

for reference, my application is based on the python examples of Nvidia (though it is heavily modified)

Thanks for the tip, the sample application works fine and seems to have some similarities with my streamer (though mine is in python). I will look into it

Glad that worked!