MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    1. Home
    2. shbatm
    3. Posts
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.
    S
    Offline
    • Profile
    • Following 0
    • Followers 3
    • Topics 12
    • Posts 208
    • Groups 1

    Posts

    Recent Best Controversial
    • RE: [MMM-RTSPStream] - Video Streaming from Live Feeds & Security Cameras

      Version 1.2.1 (Updated 15 Oct 2017) Now Available on ‘master’ branch

      • Now uses hardware-accelerated OMXPlayer as default player for local video
      • Resolved latency issues
      • Uses PM2 to control stream playback – automatically restarts streams when they close
      • Fullscreen, custom window and offset options now available.
      • Important - please update your configurations after updating this module. as some settings have changed. This new version includes a new configuration tool for building your configuration section.

      Fresh Install:

      See the installation instructions on the README.

      To switch back from the ‘wip’ branch:

      (Only necessary if you want to, the ‘wip’ and ‘master’ are the same currently, but I will update the ‘wip’ with new features and bug-fixes first for testing. If you want to beta test, stay on ‘wip’)

      cd ~/MagicMirror/modules/MMM-RSTPStream
      git checkout master
      git pull
      npm install
      http-server -p 9999
      # From a web browser, navigate to http://mirror-ip:9999/config.html
      # Once your config is made, press Ctrl+C to exit the config builder
      # Restart your mirror and test!
      
      posted in Utilities
      S
      shbatm
    • RE: Exit MM2 process gracefully?

      @j.e.f.f That could be, I wonder if when Electron starts it somehow removes any SIGINT listeners already created.

      With respect to running stop() during a MM crash – the main function in js/app.js is still attaching to process.on("SIGINT", ...) just upstream of the individual node_helper files. If MM crashes I think it should still call the stop() functions unless the node_helper array gets corrupted. An advantage to cycling through each node_helper would be that you don’t have multiple individual SIGINT listeners that are trying to call a process.exit before the other is done.

      posted in Bug Hunt
      S
      shbatm
    • RE: Exit MM2 process gracefully?

      @j-e-f-f, very strange. Mine was in the node-helper file as well, called inside the start function and I also tried it in the core js/app.js file with the same result. As I mentioned, it worked fine for server only and I was pulling my hair out trying to get it to work when running MM normally… Ctrl+C when running npm start and pm2 stop mm with pm2 would exit without even writing the console line.

      Full code that wasn’t working here

      Working code based on the change request I described here

      Thank you for the help, I’m going to chalk it up to a fluke that I’ve spent too much time investigating and now have a work around. It’ll be nice to have a standard clean-up method incorporated in the main code anyways.

      posted in Bug Hunt
      S
      shbatm
    • RE: Exit MM2 process gracefully?

      @j.e.f.f Just curious, are you running MM as server-only or with Electron (npm start)? My problem is I used almost exactly the same snippet you have and it was completely ignored when using Electron; however, it worked fine when using server-only mode. I did some research and found that the Electron browser intercepts the exit commands and needs an app.on("before-quit"... command, but I couldn’t override this from a module.

      I ended up making a tweak to the core and a pull request to work around this:
      https://github.com/MichMich/MagicMirror/pull/1058

      If this gets incorporated then all you’d need in your node_helper.js is a stop() function:

      stop: function() { 
        console.log("[MMM-MyWink] Cleaning Up");
        self.pubnub.removeListener(self.pnListener);
        self.pubnub.unsubscribeAll();
      } 
      
      posted in Bug Hunt
      S
      shbatm
    • RE: Exit MM2 process gracefully?

      I ended up opening an issue related to this on GitHub here: #1056. I was trying to implement the method @j-e-f-f suggested, but when using Electron, it ignores the call to process.on('SIGINT'...).

      What I am suggesting, in case anyone else developing a module needs this: allow module developers to implement a stop: function() { } in their node_helper.js file that performs any cleanup required. When exiting, the MM app will call this function, if it exists, and each module can gracefully exit on it’s own.

      There is a working example of this here: shbatm/MagicMirror@9935d2f

      posted in Bug Hunt
      S
      shbatm
    • RE: [MMM-RTSPStream] - Video Streaming from Live Feeds & Security Cameras

      @Johans Which other modules are you using? It looks like you may be using something like MMM-ProfileSwitcher, there may be a conflict between these modules or it may be because of the % symbol in the password.

      Also, when you switched to the wip branch, did you remember to re-run npm install in that folder? There are some additional dependencies for the wip branch.

      posted in Utilities
      S
      shbatm
    • RE: [MMM-RTSPStream] - Video Streaming from Live Feeds & Security Cameras

      @kasperb - I have a suspicion – I think this is the same issue @Niggich was having where OMXPlayer doesn’t like non-integer window dimensions.

      Please try changing the moduleOffset: 0, setting to 0.5 and see if the video will work. If it works, you can change the offset back to 0 and try updating the module with the patch I just pushed:

      cd ~/MagicMirror/modules/MMM-RTSPStream
      git fetch --all
      git pull
      

      If you experience issues with the stream stopping after running for a few days, I am still finalizing work on another branch to resolve this: wip_patch which runs OMXPlayer through pm2 so it will automatically restart feed and hopefully be more stable.

      posted in Utilities
      S
      shbatm
    • RE: [MMM-RTSPStream] - Video Streaming from Live Feeds & Security Cameras

      @kasperb said in [MMM-RTSPStream] - Video Streaming from Live Feeds & Security Cameras:

      Is there a way to add the command to the config in order for the camera to work?

      Adding protocol: 'tcp' should have done the trick. You can also try just removing the protocol line completely since the default protocol is TCP. The default command for omxplayer is:

      omxplayer --avdict rtsp_transport:tcp --win 'x y w h' --live --video_queue 4 --fps 30 {{url}}
      

      The bit of code you referenced is to not include --avdict rtsp_transport:tcp when using a UDP stream.

      Also, check the console log to see what command was used to start OMXPlayer. It should print the list of arguments.

      posted in Utilities
      S
      shbatm
    • RE: [MMM-RTSPStream] - Video Streaming from Live Feeds & Security Cameras

      @Niggich could you please post your server log (console or PM2’s log file) when it does this? You should have several lines starting with:

      Starting stream stream1 with args: 
      

      Also, what are you using to show/hide the module? (via MMM-Remote-Control or another module?)

      This will help diagnose.

      posted in Utilities
      S
      shbatm
    • RE: [MMM-RTSPStream] - Video Streaming from Live Feeds & Security Cameras

      @barnosch said in [MMM-RTSPStream] - Video Streaming from Live Feeds & Security Cameras:

      added the pkill commands but it does not work. It does not kill the apps.
      From time to time, the feed disappears. Have not yet found when and why.
      Sometimes it runs 2 days without problems, the other day it only lasts for some hours.

      Issue #14 opened to track this problem to closure.

      posted in Utilities
      S
      shbatm
    • 1 / 1