RTSP streaming from IP-Camera to VLC required a /etc/hosts file edit. Is there a better approach?

I would like to know if there was a superior approach to configuring LEAP-15.1 for viewing on VLC application an RTSP stream with GNU/Linux from an IP-Camera.

Currently I can successfully stream RTSP from my IP-camera to VLC, but to do so, I had to edit my /etc/hosts file, but I do not know if that was the best / most-elegant solution.

Before I edited my /etc/hosts file, when ever I streamed with (using this bash shell command) :


vlc rtsp://user:password@192.168.0.120:8554/unicast

I obtained an error with this text inside: " This computer has an invalid IP address: 0.0.0.0 "

Note in the above, ‘192.168.0.120’ is the camera IP address on my home WLAN, and ‘8554’ is the correct port. ‘User’ is my camera login name, and ‘password’ is my camera password.

In order to stop obtaining an error with this inside " This computer has an invalid IP address: 0.0.0.0 " I ended up editing the /etc/host file, replacing:


127.0.0.1    localhost

with


127.0.0.1       localhost.localdomain localhost
192.168.0.200   mypc.localdomain mypc

where “mypc” is my laptops hostname and ‘192.168.0.200’ was my home WLAN IP address.

I don’t like that permanent edit to the /etc/hosts, as I fear it will cause me WLAN problems if I use my laptop on a different WLAN.

Again:


vlc rtsp://user:password@192.168.0.120:8554/unicast

currently works, but unfortunately I could only get it working by that /etc/hosts file edit (which I don’t particularly like).

Any better solutions?

Hi
Why not connect to the main stream?


vlc rtsp://user:password@192.168.0.120/Streaming/Channels/101

What happens if you put the rtsp link in a browser?

FWIW I don’t think the entry would hurt in some other network.

IIRC if you tick that slightly infamous checkbox in YaST > Network Settings > Hostname tab about automatically creating /etc/hosts entries, you shouldn’t have had to make those entries manually… and should be automatically modified by DHCP so that if you change networks, the entries should be modified automatically.

Also, in that same tab you will have to set your Hostname, and I assume you should enter the entire FQDN (including your workgroup or domain name, not just the hostname).

Haven’t had to deal with this for many openSUSE versions, but used to work a charm.

TSU

If you type that ‘rtsp’ line in the browser, you get this:
https://thumbs2.imagebam.com/dc/23/5d/3964311345706992.jpg](ImageBam)
But that is not necessary to access the camera via a browser.

In the browser I simply type the IP-Address of the camera, after which I am prompted for username and password. The small Xiaofang GNU/Linux on the microSD card which the camera boots to, has daemons(?)/services to provide SSH access (which I deliberately disabled), RTSP streaming, and also http access.

Note I can also access the video remotely with no problem with both ZoneMinder.

I was simply curious to learn why VLC was not working and what could be done to get it working. Its definitely not an app that I must get working - very far from that. … Curiosity is my main driver here.

I could try that, after I get the main issue working. The ‘unicast’ stream I used, is one that other user’s claim works for them with vlc.

Note without the /etc/hosts fix, I obtain this error, if I use that rtsp line in a bash shell


Unable to determine our source address: This computer has an invalid IP address: 0.0.0.0

I have yet to try that rtsp line (for vlc) approach, with the appropriate network ‘fix’ / ‘workaround’ applied. Once I sort the above “invalid IP address” error with a more elegant solution I will try it.

Again - this is more a matter of curiousity for me (to get vlc working) as my main app is zoneminder which is working - and also a browser which gives me access to the camera controls by typing the IP address of the camera.

I tried that (I think) but it does not change the /etc/hosts file.

This is the YaST menu I get:https://thumbs2.imagebam.com/ec/70/1c/9950b81345708967.jpg](ImageBam)

Note thou, I am using Network manager so possibly that affects the ability to configure such with YaST (this is warning I get when entering Network Settings):
https://thumbs2.imagebam.com/bd/53/5b/ec592c1345708968.jpg](ImageBam)

Rather than doing a hand edit to /etc/hosts (like I did with my laptop to see if I can get vlc rtsp working - where I had some limited success (as vlc also has other rtsp issues)) I am tempted to try using YaST to edit ‘hostnames’ but I have not done such yet, as I am unsure as to what should be entered:
https://thumbs2.imagebam.com/85/74/e3/2255081345708970.jpg](ImageBam)

I have it working now in vlc by opening a port in my firewall (UDP - 15947) with a reference for that here: Enable RTSP in iptables

That article claims this is needed for vlc due to ugly code in “live555”, the vlc code used to provide the RTSP feature.

I have no insight yet if opening that port makes my PC more vulnerable for external access (where one needs to get through my router firewall first, prior to going after my PC firewall).

After opening the firewall port (see above and below) 15947, that doesn’t work, one gets the error:


[00007f8998001140] live555 demux error: Failed to connect with rtsp://192.168.0.120:8554/Streaming/Channels/101
[00007f8998004750] satip stream error: Failed to setup RTSP session

but after opening the firewall port 15947


vlc rtsp://user:password@192.168.0.120/unicast

now works. :slight_smile:

The camera is a very cheap Xiaomi Camera 1S produced in China (a clone of Wyze Cam v2). The xiaofang hack is very good in that it provides this camera with a GNU/Linux OS that can be modified (as the OS is on the microSD card) - and hence the camera now has RTSP, SSH, HTTP and other functionality with that small GNU/Linux, where with the manufacturer firmware the camera was limited.

Possibly the "Streaming/Channels/101 did not work as the GNU/Linux OS on the microSD was not coded to accept that (my speculation)?

Hi
It should do, it’s a standard syntax, find an onvif manager (I use winX and ODM download | SourceForge.net) to see the stream(s) in use. It also depends on the login security settings…

Unfortunately ONVIF is not supported in the 2 very VERY cheap cameras I recently purchased.

I am very new to surveillance cameras, so to teach myself some basics, I ordered two separate models of cameras, and pretty much they are the cheapest I could find that had decent reviews:

  • Sonoff GK-200MP2-B - A pan & zoom camera that supports RTSP but not ONVIF
  • Xiaomi XiaoFang Camera 1S - A very basic camera that supports neither RTSP nor ONVIF. However as noted there are various hacks for the Xiaomi and I chose the Xiamoi-Dfang hacks. The development of the hack is still ongoing, and while they have an ONVIF driver they are working on, as near as I can tell its not functional yet

The learning curve has been very steep. Just installing Zoneminder (where I finally succeeded) was a major effort (as it needs Apache and mySQL - where I knew almost nothing about either app prior). I’m now in the process of tuning up ZoneMinder. I actually messed up the authentication the first time I tried to set it up in ZoneMinder and totally locked myself out of ZoneMinder. After some scrambling I managed to disable the zoneminder authentication by editing a file in /etc/conf.d which allowed me back in to ZoneMinder via the GUI. I then undid my damage, followed by removing the ‘lifesaving’ /etc/conf.d edit. …

I’m back to learning ZoneMinder - hopefully I don’t mess up this time around.

With most places still closed - now is an ideal time to embark on such projects. :slight_smile:

Hi
I’ve played with zonemider a little bit :wink: My IP NVR is from Alibi Security. I guess I should look again at zoneminder…

Some further info on the hack to the Xiaomi xiaofang camera 1S, which gives that camera RTSP (but not near as I can figure ONVIF) …

I did examine the various directories on the microSD card from which the xiaofang custom GNU/Linux in this ‘hack’ boots the camera.

There is an onvif-srvd.sh script in a /controlscripts directory which calls the executable/daemon onvif_srvd (located in /bin)

In the /controlscripts directory, there is also a telnet_server, rtsp-264, rtsp-mjpeg, ftp_server and others. In the /bin one can see (in addition to onvif_srvd) executables such as openRTSP, openRTSP.bin, openSSL, telegram, plus many other binaries.

In the /config there is a “rtspserver.conf.dist” file , but no obvious config file for ONVIF. In the /config is the “wpa-supplicant.conf.dist” file that I needed to edit (providing SSID/password of my WLAN) in order to have the xiaofang camera log on to my home WLAN. That edit worked fine as the camera is on my WLAN and I can access it with RTSP (and also SSH before I disabled the SSH).

In the /config/autostart are files to start “auto-night-detection” and “rtsp-h264”. Again, no mention of ONVIF.

This being a small foot print custom version of GNU/Linux, it is very different from openSUSE GNU/Linux. It has a “run.s” script that I believe runs at boot. I custom edited this to block “ssh” access to the camera (which worked - SSH is now blocked), and also edited that script file to give the camera a ‘swap’ file on the microSD card so to extend the camera’s limited memory. I believe that worked.

I plan to keep watching the github website for the xiaong hack to see if eventually ONVIF support is added - as I think it is something that is in progress, but not yet functional.

*EDIT: I note now from the github site on the ONVIF commit that this ONVIF implementation is still being debugged.
*
I wish my other camera (the Sonoff GK-200MP2-B ) had a GNU/Linux microSD card hack available so I could apply hacker improvements to its features.