ZoneMinder / zoneminder

ZoneMinder is a free, open source Closed-circuit television software application developed for Linux which supports IP, USB and Analog cameras.
http://www.zoneminder.com/
GNU General Public License v2.0
5.04k stars 1.22k forks source link

Zoneminder and Janus - not able to view live view #3430

Open tb205gti opened 2 years ago

tb205gti commented 2 years ago

Describe Your Environment

Zoneminder: 1.37.11~20220211181045 installed via apt Ubuntu 18.04 LTS Safari, and Chrome 98.0.4758.82

Describe the bug Installed Janus and all the dependencies, janus verified working. Enabled Janus for two cameras - I can see the streams in janus streaming demo just fine. But in zoneminder - not so much. I click on the camera name to see the live-view, and I get a black box with a playbutton. Once I click the playbutton, I get an error in the developer console.. click event, then shortly after:

js_MonitorStream-dark-1644621044.js:422 Socket /run/zm/zms-439311s.sock does not exist. This file is created by zms, and since it does not exist, either zms did not run, or zms exited early. Please check your zms logs and ensure that CGI is enabled in apache and check that the PATH_ZMS is set correctly. Make sure that ZM is actually recording. If you are trying to view a live stream and the capture process (zmc) is not running then zms will exit. Please go to http://zoneminder.readthedocs.io/en/latest/faq.html#why-can-t-i-see-streamed-images-when-i-can-see-stills-in-the-zone-window-etc for more information.

Expected behaviour is that the stream starts just fine.

I do not have debug logs - unsure where to get them, doesn't seem to be any good logs :/

baudneo commented 2 years ago

Can you enable logs in Janus, if you installed Janus from the package repo the config should be in /etc/janus. I installed it onto ubuntu 20.04 and needed to do several things to make it work properly. janus.jcfg has options to enable logging to file and setting the debug level. I set my janus log to /var/log/janus.log and debug level 4 seemed to work best for me, you may need to sudo touch /var/log/janus.log , YMMV.

The possible cure is to remove libnice and build a different version from source, then grab libsrtp2.2 and then build janus from source repo using those libs.

https://github.com/meetecho/janus-gateway - the README has all the caveats I just mentioned and the commands to get and build them.

jp-bennett commented 2 years ago

Ubuntu 18.04 LTS

Very little testing has happened with older Ubuntu versions. I've done development and testing just in 21.10. @baudneo's suggestion to build from source is likely the way to go, if upgrading to a newer Ubunto release isn't an option.

tb205gti commented 2 years ago

Janus is working, I can see the view from my camera in the janus demo (streaming) for the cameras I have enabled in Zoneminder - but it is not working in Zoneminder. I had to manaully build libnice, since the apt provided version did not work.

So Janus is working - but it is not working in Zoneminder.

baudneo commented 2 years ago

What do the Janus logs say and what does the browser developer console say when loading the live view page? We need some context and logs to decipher the errors and resolve the issue.

For example, if you have https enabled and are trying to stream janus on HTTP you will get a mixed mode error, or if you have JANUS_PATH set to wrong port/endpoint or it could be wrong password setup for streaming. It could also be the lack of an ice server if you have not defined to ignore that error. Logs from Janus and the developer console in your browser will help narrow it down.

Can you post a gist of your janus.jcfg, janus.plugin.streaming.jcfg and janus.transport.http.jcfg . Also, let me know what your have JANUS_PATH set to and please confirm that the password (JANUS_SECRET) for janus is the same as in janus.plugin.streaming.jcfg .

baudneo commented 2 years ago

Have you set up the Janus password and path in Options->System ?

tb205gti commented 2 years ago

Yes, all janus logs are fine - I can see that I get correct responses. But I get teh zoneminder error posted above.

I'm currently on a limited access - so best I can do for now is the dev console output: https://i.imgur.com/7UzaF0H.png

This is when clicking the live view in Zineminder.

tb205gti commented 2 years ago

janus_path in ZM is: http://192.168.0.16:8087/janus (I run influx on 8088, so I changed the port to 8087)

janus.jcfg:


        configs_folder = "/opt/janus/etc/janus"                 # Configuration files folder
        plugins_folder = "/opt/janus/lib/janus/plugins"                 # Plugins folder
        transports_folder = "/opt/janus/lib/janus/transports"   # Transports folder
        events_folder = "/opt/janus/lib/janus/events"                   # Event handlers folder
        loggers_folder = "/opt/janus/lib/janus/loggers"                 # External loggers folder
        log_to_file = "/var/log/janus.log"              # Whether to use a log file or not
        debug_level = 7                                                 # Debug/logging level, valid values are 0-7
        interface = "192.168.0.16"                      # Interface to use (will be used in SDP)
        protected_folders = [
                "/bin",
                "/boot",
                "/dev",
                "/etc",
                "/initrd",
                "/lib",
                "/lib32",
                "/lib64",
                "/proc",
                "/sbin",
                "/sys",
                "/usr",
                "/var",
                "/opt/janus/bin",
                "/opt/janus/etc",
                "/opt/janus/include",
                "/opt/janus/lib",
                "/opt/janus/lib32",
                "/opt/janus/lib64",
                "/opt/janus/sbin"
        ]
}
certificates: {
}

media: {

}

nat: {
        nice_debug = true
        ignore_mdns = true

}

plugins: {
}

transports: {
        disable = "libjanus_rabbitmq.so"
}

loggers: {
}

events: {
}```
tb205gti commented 2 years ago

janus.plugin.streaming.jcfg:


        admin_key = "ADMIN_DISABLED"               # If set, mountpoints can be created via API
        secret="JanusDebug"
}```
tb205gti commented 2 years ago

janu.transport.http.jcfg:


        json = "indented"        
        base_path = "/janus"     
        http = true              
        port = 8087              
        ip = "192.168.0.16"      
        https = false            
}

admin: {
        admin_base_path = "/admin"
        admin_http = false      
        admin_port = 7088       
        admin_ip = "192.168.0.16"
        admin_https = false      
}

cors: {
}

certificates: {
}```
baudneo commented 2 years ago

I can't say for sure as the janus logs are missing but in the screenshot, I do not see janus sending any ack's or success's. When you built Janus did you make sure to download libsrtp2.2 and build janus along with the different libnice libs?

Try adding the following right under ignore_mdns ignore_unreachable_ice_server = true (as long as its in the same section as ignore_mdns it should be fine.

Here is a screenshot of my dev console when streaming works.

JANUS

Skim your janus logs and see what janus is saying when the web browser creates a session, compare sessionIDs and all that to confirm. If you don't see any errors raise the debug level and search for some clues.

tb205gti commented 2 years ago

Tried adding the option - makes no difference, still no video.

I made a new fresh janus.log. started janus, gave it a few seconds to settle, then tried the live view.

https://gist.github.com/tb205gti/6d4af2ab91ab4454130ee9f9598cd569

tb205gti commented 2 years ago

Video works fine in janus demo: https://i.imgur.com/LqMEZ5O.png

baudneo commented 2 years ago

I see in your logs that it is saying

Got a Janus API request from janus.transport.http (0x7fc4640024a0)
Transport task pool, serving request
[2392545081996902] There's a message for JANUS Streaming plugin
Request info on a specific mountpoint
No such mountpoint/stream 1
Creating plugin result...

The important line is No such mountpoint/stream 1, I also see a 401 Unauthorized when the TP-Link camera is first queried but the next request returns 200/OK.

Transport task pool, serving request
[2392545081996902] There's a message for JANUS Streaming plugin
Audio NOT enabled, Video enabled
Missing name, will generate a random one...
DESCRIBE answer:RTSP/1.0 401 Unauthorized
CSeq: 1
Date: Thu, Feb 17 2022 08:56:29 GMT
WWW-Authenticate: Basic realm="TP-Link IP-Camera"
WWW-Authenticate: Digest realm="TP-Link IP-Camera", nonce="9b8e6b353f0fbf2f5d73df395d751f4a"

RTSP/1.0 200 OK
CSeq: 2
Date: Thu, Feb 17 2022 08:56:29 GMT
Content-Base: rtsp://192.168.0.70:554/stream1/
Content-Type: application/sdp
Content-Length: 561

Did you build Janus with libsrtp2.2 like the README shows in the janus repo? I had a problem sort of like this but not exactly using the included libsrtp2.3 on ubuntu 20.04.

tb205gti commented 2 years ago

Yes, manually used libsrtp2.2. When using the demo I also get a 401 followed by a 200

baudneo commented 2 years ago

Weird I am assuming it is something to do with ZM than but I cant say for sure. @jp-bennett may need to chime in as they are the one that added the janus code to ZM. They may be able to help further.

rabsym commented 2 years ago

@tb205gti , have you been able to solve this issue? Looks like I'm having the same thing here...

Socket /run/zm/zms-202470s.sock does not exist. This file is created by zms, and since it does not exist, either zms did not run, or zms exited early. Please check your zms logs and ensure that CGI is enabled in apache and check that the PATH_ZMS is set correctly. Make sure that ZM is actually recording. If you are trying to view a live stream and the capture process (zmc) is not running then zms will exit. Please go to http://zoneminder.readthedocs.io/en/latest/faq.html#why-can-t-i-see-streamed-images-when-i-can-see-stills-in-the-zone-window-etc for more information.

This is Janus.log where looks like stream added but unable to get it working with ZM, anyone any hint?

  Starting Meetecho Janus (WebRTC Server) v0.11.8
---------------------------------------------------

Checking command line arguments...
Debug/log level is 4
Debug/log timestamps are enabled
Debug/log colors are disabled
[Mon Feb 21 21:17:47 2022] Adding 'vmnet' to the ICE ignore list...
[Mon Feb 21 21:17:47 2022] [WARN] Couldn't find any address! using 127.0.0.1 as the local IP... (which is NOT going to work out of your machine)
[Mon Feb 21 21:17:47 2022] Using 127.0.0.1 as local IP...
[Mon Feb 21 21:17:47 2022] Token based authentication disabled
[Mon Feb 21 21:17:47 2022] Initializing recorder code
[Mon Feb 21 21:17:47 2022] RTP port range: 20000 -- 40000
[Mon Feb 21 21:17:47 2022] Initializing ICE stuff (Full mode, ICE-TCP candidates disabled, half-trickle, IPv6 support disabled)
[Mon Feb 21 21:17:47 2022] ICE port range: 20000-40000
[Mon Feb 21 21:17:47 2022] [WARN] mDNS resolution disabled, .local candidates will be ignored
[Mon Feb 21 21:17:47 2022] TURN REST API backend: (disabled)
[Mon Feb 21 21:17:47 2022] Crypto: OpenSSL >= 1.1.0
[Mon Feb 21 21:17:47 2022] No cert/key specified, autogenerating some...
[Mon Feb 21 21:17:47 2022] Fingerprint of our certificate: C6:1E:CC:C5:7C:81:A1:84:EC:D1:20:B6:72:AE:18:01:6E:91:98:0B:A7:0C:24:A1:9B:68:37:A0:7C:0F:04:B7
[Mon Feb 21 21:17:47 2022] Sessions watchdog started
[Mon Feb 21 21:17:47 2022] Event handlers support disabled
[Mon Feb 21 21:17:47 2022] Plugins folder: /usr/lib/x86_64-linux-gnu/janus/plugins
[Mon Feb 21 21:17:47 2022] Joining Janus requests handler thread
[Mon Feb 21 21:17:47 2022] Loading plugin 'libjanus_lua.so'...
[Mon Feb 21 21:17:47 2022] [echotest.lua] Loading...
[Mon Feb 21 21:17:47 2022] [echotest.lua] Loaded
[Mon Feb 21 21:17:47 2022] [echotest.lua] Initializing...
[Mon Feb 21 21:17:47 2022] [echotest.lua] Initialized
[Mon Feb 21 21:17:47 2022] Janus Lua plugin initialized!
[Mon Feb 21 21:17:47 2022] Loading plugin 'libjanus_streaming.so'...
[Mon Feb 21 21:17:47 2022] JANUS Streaming plugin initialized!
[Mon Feb 21 21:17:47 2022] [WARN] Plugin 'libjanus_nosip.so' has been disabled, skipping...
[Mon Feb 21 21:17:47 2022] [WARN] Plugin 'libjanus_recordplay.so' has been disabled, skipping...
[Mon Feb 21 21:17:47 2022] Loading plugin 'libjanus_duktape.so'...
[Mon Feb 21 21:17:47 2022] [echotest.js]  Loading script...
[Mon Feb 21 21:17:47 2022] [echotest.js]  Modules folder: /usr/share/janus/duktape
[Mon Feb 21 21:17:47 2022] [echotest.js]  Loading module: janus-sdp
[Mon Feb 21 21:17:47 2022] [echotest.js]  Module loaded
[Mon Feb 21 21:17:47 2022] [echotest.js]  Script loaded
[Mon Feb 21 21:17:47 2022] [echotest.js]  Initializing...
[Mon Feb 21 21:17:47 2022] [echotest.js]  Initialized
[Mon Feb 21 21:17:47 2022] Janus JavaScript plugin (Duktape) initialized!
[Mon Feb 21 21:17:47 2022] [WARN] Plugin 'libjanus_echotest.so' has been disabled, skipping...
[Mon Feb 21 21:17:47 2022] [WARN] Plugin 'libjanus_videocall.so' has been disabled, skipping...
[Mon Feb 21 21:17:47 2022] [WARN] Plugin 'libjanus_voicemail.so' has been disabled, skipping...
[Mon Feb 21 21:17:47 2022] [WARN] Plugin 'libjanus_sip.so' has been disabled, skipping...
[Mon Feb 21 21:17:47 2022] Loading plugin 'libjanus_videoroom.so'...
[Mon Feb 21 21:17:47 2022] JANUS VideoRoom plugin initialized!
[Mon Feb 21 21:17:47 2022] [WARN] Plugin 'libjanus_textroom.so' has been disabled, skipping...
[Mon Feb 21 21:17:47 2022] Loading plugin 'libjanus_audiobridge.so'...
[Mon Feb 21 21:17:47 2022] JANUS AudioBridge plugin initialized!
[Mon Feb 21 21:17:47 2022] Transport plugins folder: /usr/lib/x86_64-linux-gnu/janus/transports
[Mon Feb 21 21:17:47 2022] [WARN] Transport plugin 'libjanus_websockets.so' has been disabled, skipping...
[Mon Feb 21 21:17:47 2022] [WARN] Transport plugin 'libjanus_pfunix.so' has been disabled, skipping...
[Mon Feb 21 21:17:47 2022] Loading transport plugin 'libjanus_http.so'...
[Mon Feb 21 21:17:47 2022] HTTP transport timer started
[Mon Feb 21 21:17:47 2022] HTTP webserver started (port 8088, /janus path listener)...
[Mon Feb 21 21:17:47 2022] Admin/monitor HTTP webserver started (port 7088, /admin path listener)...
[Mon Feb 21 21:17:47 2022] JANUS REST (HTTP/HTTPS) transport plugin initialized!
[Mon Feb 21 21:17:47 2022] Loading transport plugin 'libjanus_nanomsg.so'...
[Mon Feb 21 21:17:47 2022] JANUS Nanomsg transport plugin initialized!
[Mon Feb 21 21:17:47 2022] [WARN] Transport plugin 'libjanus_rabbitmq.so' has been disabled, skipping...
[Mon Feb 21 21:17:47 2022] Loading transport plugin 'libjanus_mqtt.so'...
[Mon Feb 21 21:17:47 2022] Nanomsg thread started
[Mon Feb 21 21:17:47 2022] [ERR] [config.c:janus_config_parse:205] Error parsing config file at line 30: syntax error
[Mon Feb 21 21:17:47 2022] [WARN] Couldn't find .jcfg configuration file (janus.transport.mqtt), trying .cfg
[Mon Feb 21 21:17:47 2022] [ERR] [config.c:janus_config_parse:191]   -- Error reading configuration file 'janus.transport.mqtt.cfg'... error 2 (No such file or directory)
[Mon Feb 21 21:17:47 2022] MQTT SSL support disabled
[Mon Feb 21 21:17:47 2022] [WARN] MQTT support disabled for both Janus and Admin API, giving up
[Mon Feb 21 21:17:47 2022] JANUS MQTT transport plugin destroyed!
[Mon Feb 21 21:17:47 2022] [WARN] The 'janus.transport.mqtt' plugin could not be initialized
[Mon Feb 21 21:17:51 2022] Creating new session: 5435537635830265; 0x7f3240001ab0
[Mon Feb 21 21:17:51 2022] Creating new handle in session 5435537635830265: 6630164817773072; 0x7f3240001ab0 0x7f32400022b0
[Mon Feb 21 21:17:52 2022] [WARN] No c-line or source for RTSP video address, resolving server address...
[Mon Feb 21 21:17:52 2022] [2] New video stream! (ssrc=575673039, index 0)

Thanks in advance. Raimon

jp-bennett commented 2 years ago

Video works fine in janus demo: https://i.imgur.com/LqMEZ5O.png

This is really interesting. I wish I could replicate this, but I'll take a look at what the demo code is doing, and see if there's something missing in our code.

jp-bennett commented 2 years ago

Oh! @tb205gti you compiled Janus from source? As of https://github.com/meetecho/janus-gateway/commit/4110eea4568926dc18642a544718c87118629253 Janus made a major change that breaks their API. Now that that change has landed, I should try to revamp our JS to support both API revisions.

To test this, check out the Janus tag, v0.11.8, and see if it works with that release. They minted that release right before merging the big changes.

rabsym commented 2 years ago

@jp-bennett same issue here using v0.11.8 if that helps, also tested with v0.11.7

tb205gti commented 2 years ago

Oh! @tb205gti you compiled Janus from source? As of [meetecho/janus-gateway@4110eea]

Ahh yes, I'm running bc8cc9c3f64f07fb73da21d034b6748a6b8165c4 - I'll try to downgrade

jp-bennett commented 2 years ago

Any updates? Are you guys still having problems?

rabsym commented 2 years ago

Solved issue, in my case was related to using zoneminder with https and the need of making janus https too because javascript errors in browser when crossing from secure to unsecure prevents it working. I already commented this in slack channel with you.

Regards

guiseco commented 2 years ago

Error 401 because zoneminder split username and password from camera link:

Sep 17 12:18:10 orangepi3-lts zmc_m1[106320]: WAR [zmc_m1] [Sending {"janus" : "message", "transaction" : "randomString", "body" : {"request" : "create", "admin_key" : "5Ar$j3u2sFn8g6bT", "type" : "rtsp", "rtsp_quirk" : true, "url" : "**rtsp://192.168.0.110:554/ch0_0.264**", "secret" : "*****", "pin" : "****", "id" : 1, "video" : true}} to http://127.0.0.1:8088/janus/2992383017105706/6425450346156434]

[ERR] [plugins/janus_streaming.c:janus_streaming_rtsp_connect_to_server:6457] Couldn't get DESCRIBE code: 401

Wrong Link: rtsp://192.168.0.110:554/ch0_0.264 Correct Link: rtsp://admin:@192.168.0.110:554/ch0_0.264

jp-bennett commented 2 years ago

@guiseco Is this 1.37.22? Looks like a code push unintentionally reverted part of the code that made the username/password field work. We'll get this fixed

guiseco commented 2 years ago

@guiseco Is this 1.37.22? Looks like a code push unintentionally reverted part of the code that made the username/password field work. We'll get this fixed

Yes, 1.37.22 is broke.

connortechnology commented 2 years ago

should be unbroke now

guiseco commented 1 year ago

I created a debian package using the following command:

./do_debian_package.sh --snapshot=NOW --branch=master --type=local

After that:

dpkg -i zoneminder_1.37.22~20220919153536-jammy_arm64.deb
(Reading database ... 74117 files and directories currently installed.)
Preparing to unpack zoneminder_1.37.22~20220919153536-jammy_arm64.deb ...
Unpacking zoneminder (1.37.22~20220919153536-jammy) over (1.37.22~20220917113849-jammy) ...
Setting up zoneminder (1.37.22~20220919153536-jammy) ...
detected systemd
Warning: The unit file, source configuration file or drop-ins of zoneminder.service changed on disk. Run 'systemctl daemon-reload' to reload units.
Detected db service is mariadb.service
Checking for db
Db exists.
Updating permissions for user zmuser@localhost

Database already at version 1.37.22, update skipped.

Freshening configuration in database
Migratings passwords, if any...
Loading config from DB 235 entries
Saving config to DB 235 entries
Done Updating
Warning: The unit file, source configuration file or drop-ins of zoneminder.service changed on disk. Run 'systemctl daemon-reload' to reload units.
Processing triggers for mailcap (3.70+nmu1ubuntu1) ...
Processing triggers for man-db (2.10.2-1) ...

root@orangepi3-lts:~# tail -f /var/log/syslog

Sep 19 17:32:33 orangepi3-lts mariadbd[1729]: 2022-09-19 17:32:33 298 [Warning] Aborted connection 298 to db: 'zm' user: 'zmuser' host: 'localhost' (Got an error reading communication packets)
Sep 19 17:32:33 orangepi3-lts zmdc[27015]: ERR ['zmc -m 3' exited abnormally, exit status 255]
Sep 19 17:32:34 orangepi3-lts zmdc[27015]: INF [Starting pending process, zmc -m 3]
Sep 19 17:32:34 orangepi3-lts zmdc[27015]: INF ['zmc -m 3' starting at 22/09/19 17:32:34, pid = 27212]
Sep 19 17:32:34 orangepi3-lts zmdc[27212]: INF ['zmc -m 3' started at 22/09/19 17:32:34]
Sep 19 17:32:35 orangepi3-lts zmc_m3[27212]: ERR [zmc_m3] [Can't run query: Unknown column 'Janus_RTSP_User' in 'field list']
Sep 19 17:32:35 orangepi3-lts zmc_m3[27212]: ERR [zmc_m3] [Can't use query result: Unknown column 'Janus_RTSP_User' in 'field list']Sep 19 17:32:35 orangepi3-lts zmc_m3[27212]: ERR [zmc_m3] [No monitors found]
Sep 19 17:32:35 orangepi3-lts mariadbd[1729]: 2022-09-19 17:32:35 301 [Warning] Aborted connection 301 to db: 'zm' user: 'zmuser' host: 'localhost' (Got an error reading communication packets)
Sep 19 17:32:35 orangepi3-lts zmdc[27015]: ERR ['zmc -m 3' exited abnormally, exit status 255]
Sep 19 17:32:38 orangepi3-lts zmdc[27015]: INF [Starting pending process, zmc -m 1]
Sep 19 17:32:38 orangepi3-lts zmdc[27219]: INF ['zmc -m 1' started at 22/09/19 17:32:38]
Sep 19 17:32:38 orangepi3-lts zmdc[27015]: INF ['zmc -m 1' starting at 22/09/19 17:32:38, pid = 27219]
Sep 19 17:32:38 orangepi3-lts zmdc[27015]: INF [Starting pending process, zmc -m 2]
Sep 19 17:32:38 orangepi3-lts zmdc[27015
jp-bennett commented 1 year ago

Can't run query: Unknown column 'Janus_RTSP_User' in 'field list'

I know this has been 4 months, but that sort of error usually means you need to run ``` zmupdate.pl -f


To get the database fields added.