MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    [MMM-RTSPStream] - Video Streaming from Live Feeds & Security Cameras

    Scheduled Pinned Locked Moved Utilities
    602 Posts 67 Posters 2.1m Views 68 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S Offline
      shbatm Module Developer @evroom
      last edited by

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

      Will revert back to the master branch and try again.

      Yes, the omx_stream1 is created the first time you play a stream with the module.

      Please use the develop branch with omxplayer. It was working on my machine the last time I started.

      evroomE 1 Reply Last reply Reply Quote 0
      • Cr4z33C Offline
        Cr4z33 @shbatm
        last edited by

        @shbatm things are doing waaaay better now! :grinning_face_with_smiling_eyes:

        With omxplayer stream switching is almost OK if it wasn’t that it doesn’t select the wanted stream.
        Ie. I want stream3 therefore I give the voice command, but then it starts playing the wrong stream (and always random).
        Voice recognition is 100% correct as I always have a textual confirmation of command on screen.

        With vlc it’s a mess as multiple streams ALWAYS start at the same time after a voice command.

        At this point I don’t care who will be the chosen player as long as we get everything working so omxplayer would be fair enough if running properly. :smiling_face_with_open_mouth_smiling_eyes: :smiling_face_with_open_mouth_cold_sweat:

        S 1 Reply Last reply Reply Quote 0
        • evroomE Offline
          evroom @shbatm
          last edited by

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

          Yes, the omx_stream1 is created the first time you play a stream with the module.

          Please use the develop branch with omxplayer. It was working on my machine the last time I started.

          Back on develop branch again.
          No change.
          Now the “pm2 remove omx_stream1” looks to be a major mistake, as I cannot get the stream running again.
          I do not see the module trying to start a new stream anymore.

          What would be the command line for starting the stream and having it appear under “pm2 list” ?
          In other words, what does the module do in order to achieve this ?

          MagicMirror version: 2.33.0
          Raspberry Pi 4 Model B Rev 1.5 (8 GB RAM)
          Raspbian GNU/Linux 12 (bookworm)

          Test environment:
          MagicMirror version: v2.33.0
          Raspberry Pi 3 Model B Plus Rev 1.3 (1 GB RAM)
          Raspbian GNU/Linux 12 (bookworm)

          S 1 Reply Last reply Reply Quote 0
          • S Offline
            shbatm Module Developer @evroom
            last edited by

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

            Back on develop branch again.

            Please send me your config in a chat.

            1 Reply Last reply Reply Quote 0
            • S Offline
              shbatm Module Developer @Cr4z33
              last edited by

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

              With omxplayer stream switching is almost OK if it wasn’t that it doesn’t select the wanted stream.

              I can’t replicate this issue. Directly sending notifications: of the form notification: "RTSP-PLAY", payload: "streamX" works as expected and switches to the correct stream when using autoStart: false, rotateStreams: true, rotateStreamTimeout: 0.

              How many streams do you have again? Is it less than 10?

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

              With vlc it’s a mess as multiple streams ALWAYS start at the same time after a voice command.

              I think this is related to the fact that VLC doesn’t close the streams automatically when switching, it puts the window in the background until it times out, then it closes. Try adding a shutdownDelay: 0 to your module config to make the VLC stream close immediately on hiding. Same thing with omxplayer though, switching appears to work as expected on my end.

              Please also make sure you have the latest version of PM2: sudo npm install -g pm2

              Cr4z33C 1 Reply Last reply Reply Quote 0
              • D Offline
                djuscha
                last edited by

                @shbatm

                did develop update now, both streams are on stop and error messages :(

                PM2            | App [omx_stream2:1] online
                0|mm           | Initializing new module helper ...
                0|mm           | Module helper loaded: newsfeed
                2|omx_stream1  | * failed to add service - already in use?
                2|omx_stream1  | Video codec omx-mjpeg width 352 height 288 profile -99 fps 30.000000
                2|omx_stream1  | Subtitle count: 0, state: off, index: 1, delay: 0
                2|omx_stream1  | /usr/bin/omxplayer: Zeile 67:  1221 Abgebrochen             (Speicherabzug geschrieben) LD_LIBRARY_PATH="$OMXPLAYER_LIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" $OMXPLAYER_BIN "$@"
                PM2            | App [omx_stream1:2] exited with code [134] via signal [SIGINT]
                PM2            | App [omx_stream1:2] starting in -fork mode-
                PM2            | App [omx_stream1:2] online
                1|omx_stream2  | * failed to add service - already in use?
                1|omx_stream2  | Video codec omx-mjpeg width 352 height 288 profile -99 fps 30.000000
                1|omx_stream2  | Subtitle count: 0, state: off, index: 1, delay: 0
                1|omx_stream2  | /usr/bin/omxplayer: Zeile 67:  1244 Abgebrochen             (Speicherabzug geschrieben) LD_LIBRARY_PATH="$OMXPLAYER_LIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" $OMXPLAYER_BIN "$@"
                PM2            | App [omx_stream2:1] exited with code [134] via signal [SIGINT]
                PM2            | App [omx_stream2:1] starting in -fork mode-
                PM2            | App [omx_stream2:1] online
                2|omx_stream1  | * failed to add service - already in use?
                2|omx_stream1  | Video codec omx-mjpeg width 352 height 288 profile -99 fps 30.000000
                2|omx_stream1  | Subtitle count: 0, state: off, index: 1, delay: 0
                2|omx_stream1  | /usr/bin/omxplayer: Zeile 67:  1287 Abgebrochen             (Speicherabzug geschrieben) LD_LIBRARY_PATH="$OMXPLAYER_LIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" $OMXPLAYER_BIN "$@"
                PM2            | App [omx_stream1:2] exited with code [134] via signal [SIGINT]
                PM2            | App [omx_stream1:2] starting in -fork mode-
                PM2            | App [omx_stream1:2] online
                0|mm           | Initializing new module helper ...
                0|mm           | Module helper loaded: MMM-RTSPStream
                0|mm           | All module helpers loaded.
                0|mm           | Starting server on port 8080 ...
                0|mm           | Server started ...
                0|mm           | Connecting socket for: updatenotification
                0|mm           | Connecting socket for: MMM-Fuel
                0|mm           | Starting module helper: MMM-Fuel
                0|mm           | Connecting socket for: newsfeed
                0|mm           | Starting module: newsfeed
                0|mm           | Connecting socket for: MMM-RTSPStream
                0|mm           | PM2: Stopping all OMXPlayer Streams...
                0|mm           | Sockets connected & modules started ...
                1|omx_stream2  | * failed to add service - already in use?
                1|omx_stream2  | Video codec omx-mjpeg width 352 height 288 profile -99 fps 30.000000
                1|omx_stream2  | Subtitle count: 0, state: off, index: 1, delay: 0
                1|omx_stream2  | /usr/bin/omxplayer: Zeile 67:  1320 Abgebrochen             (Speicherabzug geschrieben) LD_LIBRARY_PATH="$OMXPLAYER_LIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" $OMXPLAYER_BIN "$@"
                PM2            | App [omx_stream2:1] exited with code [134] via signal [SIGINT]
                PM2            | App [omx_stream2:1] starting in -fork mode-
                PM2            | App [omx_stream2:1] online
                2|omx_stream1  | * failed to add service - already in use?
                2|omx_stream1  | Video codec omx-mjpeg width 352 height 288 profile -99 fps 30.000000
                2|omx_stream1  | Subtitle count: 0, state: off, index: 1, delay: 0
                2|omx_stream1  | /usr/bin/omxplayer: Zeile 67:  1349 Abgebrochen             (Speicherabzug geschrieben) LD_LIBRARY_PATH="$OMXPLAYER_LIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" $OMXPLAYER_BIN "$@"
                PM2            | App [omx_stream1:2] exited with code [134] via signal [SIGINT]
                PM2            | App [omx_stream1:2] starting in -fork mode-
                PM2            | App [omx_stream1:2] online
                1|omx_stream2  | * failed to add service - already in use?
                1|omx_stream2  | Video codec omx-mjpeg width 352 height 288 profile -99 fps 30.000000
                1|omx_stream2  | Subtitle count: 0, state: off, index: 1, delay: 0
                1|omx_stream2  | /usr/bin/omxplayer: Zeile 67:  1399 Abgebrochen             (Speicherabzug geschrieben) LD_LIBRARY_PATH="$OMXPLAYER_LIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" $OMXPLAYER_BIN "$@"
                PM2            | App [omx_stream2:1] exited with code [134] via signal [SIGINT]
                PM2            | App [omx_stream2:1] starting in -fork mode-
                PM2            | App [omx_stream2:1] online
                2|omx_stream1  | * failed to add service - already in use?
                2|omx_stream1  | Video codec omx-mjpeg width 352 height 288 profile -99 fps 30.000000
                2|omx_stream1  | Subtitle count: 0, state: off, index: 1, delay: 0
                2|omx_stream1  | /usr/bin/omxplayer: Zeile 67:  1422 Abgebrochen             (Speicherabzug geschrieben) LD_LIBRARY_PATH="$OMXPLAYER_LIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" $OMXPLAYER_BIN "$@"
                PM2            | App [omx_stream1:2] exited with code [134] via signal [SIGINT]
                PM2            | App [omx_stream1:2] starting in -fork mode-
                PM2            | App [omx_stream1:2] online
                0|mm           | Launching application.
                0|mm           | libGL error: MESA-LOADER: failed to retrieve device information
                ^C
                pi@raspberrypi:~ $ pm2 status
                ┌─────────────┬────┬──────┬────────┬─────────┬─────┬────────┬──────────┐
                │ Name        │ id │ mode │ status │ ↺       │ cpu │ memory │
                ├─────────────┼────┼──────┼────────┼─────────┼─────┼────────┼──────────┤
                │ mm          │ 0  │ N/A  │ fork   │ online  │ 0   │ 0%     │ 2.5 MB   │
                │ omx_stream1 │ 2  │ N/A  │ fork   │ stopped │ 9   │ 0%     │ 0 B      │
                │ omx_stream2 │ 1  │ N/A  │ fork   │ stopped │ 9   │ 0%     │ 0 B      │
                └─────────────┴────┴──────┴────────┴─────────┴─────┴────────┴──────────┘
                 Use `pm2 show <id|name>` to get more details about an app
                pi@raspberrypi:~ $
                
                

                can you undo that somehow?

                S 2 Replies Last reply Reply Quote 0
                • S Offline
                  shbatm Module Developer @djuscha
                  last edited by shbatm

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

                  both streams are on stop and error messages

                  This looks like the same error I got when I tried to use omxplayer with the OpenGL driver enabled in raspi-config. You’ll have to use the legacy driver if you want to use omxplayer on the most recent version of Raspbian.

                  EDIT 10-Jan-19: Use the latest develop branch version. omxplayer requires the --no-osd flag to work properly with the OpenGL (Fake KMS) driver.

                  1 Reply Last reply Reply Quote 0
                  • Cr4z33C Offline
                    Cr4z33 @shbatm
                    last edited by

                    @shbatm I can confirm that I followed the whole instructions properly and I am using notification: "RTSP-PLAY", payload: "streamX" indeed for my 7 different streams (so yes less than 10).

                    All I can say is that it is NOT working as intended. :winking_face:

                    Anyway I always forgot to post the (latest version) PM2 log so here it is if you can find anything helpful?
                    I wish I could do more, but again I am not skilled enough sorry… :smiling_face_with_open_mouth_cold_sweat:

                    PM2 Log

                    S 1 Reply Last reply Reply Quote 0
                    • S Offline
                      shbatm Module Developer @Cr4z33
                      last edited by shbatm

                      @cr4z33 @evroom the last things I can suggest to try:

                      1. @Cr4z33 Make sure you have autoStart: false in your config. @evroom yours should be true.
                      2. Update the module one more time:
                      cd ~/MagicMirror/modules/MMM-RTSPStream
                      git fetch --al && git pull
                      rm -R node_modules/
                      npm install
                      
                      1. Nuke and update your pm2:
                      pm2 kill
                      rm ~/.pm2/dump.pm2
                      sudo npm i -g pm2
                      
                      1. Restart the MM script (you’ll have to redo pm2 save BEFORE you run any streams if you want the MM to start on boot).
                      Cr4z33C evroomE 2 Replies Last reply Reply Quote 0
                      • Cr4z33C Offline
                        Cr4z33 @shbatm
                        last edited by

                        @shbatm I feel sorry, but nothing has improved. :disappointed_face:

                        S 1 Reply Last reply Reply Quote 0
                        • evroomE Offline
                          evroom @shbatm
                          last edited by

                          @shbatm
                          Performed all steps.
                          No change: no stream is started (nothing in the pm2 logs).

                          Then deleted the MMM-RTSPStream module completely.
                          Rebooted.
                          Installed the module again.
                          No change: no stream is started (nothing in the pm2 logs).

                          Then performed all steps to get in the develop branch.
                          No change: no stream is started (nothing in the pm2 logs).

                          I ended up disabling the module and running a script under pm2 control.

                          Pity, it worked just fine till I started to test the changes.
                          The ‘pm2 delete omx_stream1’ was the final blow, but should not be the reason for a stream not to appear again.

                          Perhaps a complete re-install of MM is necessary, but that is too much work for now.
                          Should I be forced to do so in the future, I will give MMM-RTSPStream a try again.

                          MagicMirror version: 2.33.0
                          Raspberry Pi 4 Model B Rev 1.5 (8 GB RAM)
                          Raspbian GNU/Linux 12 (bookworm)

                          Test environment:
                          MagicMirror version: v2.33.0
                          Raspberry Pi 3 Model B Plus Rev 1.3 (1 GB RAM)
                          Raspbian GNU/Linux 12 (bookworm)

                          A 1 Reply Last reply Reply Quote 0
                          • S Offline
                            shbatm Module Developer @Cr4z33
                            last edited by

                            @cr4z33 Can you please post (or send in chats) your current config. I’m curious if we’re missing something obvious.

                            @evroom I’m sorry you can’t get it working again. I’m at a loss as to why it’s not starting the streams properly. Everything in your config you sent looks like it should be working from the module’s end. The only thing I can think of is something else is interfering and preventing the module from starting. (Would show up as a “MMM-RTSPStream is suspended…” in the DevTools (web browser) console logs.

                            Cr4z33C 1 Reply Last reply Reply Quote 0
                            • A Offline
                              anthony6608 @evroom
                              last edited by

                              @evroom I’m sorry but I haven’t read too far back in the posts but have you tried disabling your other modules to determine if there’s a conflict somewhere?

                              The reason I ask is because shbatm helped me recently with everything setup correctly but stream not displaying. One of the issues turned out to be the GoogleMapsTraffic module. Just wanted to mention that just in case. Good luck!

                              1 Reply Last reply Reply Quote 0
                              • Cr4z33C Offline
                                Cr4z33 @shbatm
                                last edited by

                                @shbatm here you go. :slightly_smiling_face:

                                config.js

                                1 Reply Last reply Reply Quote 0
                                • C Offline
                                  costascontis
                                  last edited by

                                  hi ,trying to use this module to watch an ip cam.After i start MM i get in the log:

                                  Starting stream stream1 with args: [
                                      "--avdict",
                                      "rtsp_transport:tcp",
                                      "--win",
                                      "738, 63, 1090, 305",
                                      "--live",
                                      "--video_queue",
                                      "4",
                                      "--fps",
                                      "30",
                                      "rtsp://admin:@192.168.1.108:554/12?"
                                  ]
                                  error: object file .git/objects/0a/340d5d575f5675a19c2108bb1acc9f20576259 is empty
                                  error: object file .git/objects/0a/340d5d575f5675a19c2108bb1acc9f20576259 is empty
                                  fatal: loose object 0a340d5d575f5675a19c2108bb1acc9f20576259 (stored in .git/objects/0a/340d5d575f5675a19c2108bb1acc9f20576259) is corrupt
                                  fatal: The remote end hung up unexpectedly
                                  
                                  Starting PM2 for omx_stream1
                                  PM2 started for omx_stream1
                                  
                                  

                                  when i press pause and play again i get:

                                  Stopping stream stream1
                                  Stopping PM2 process: omx_stream1
                                  Starting stream stream1 with args: [
                                      "--avdict",
                                      "rtsp_transport:tcp",
                                      "--win",
                                      "738, 63, 1090, 305",
                                      "--live",
                                      "--video_queue",
                                      "4",
                                      "--fps",
                                      "30",
                                      "rtsp://admin:@192.168.1.108:554/12?"
                                  ]
                                  Starting PM2 for omx_stream1
                                  PM2 started for omx_stream1
                                  

                                  I just get a blank screen.Steam is working nice with vlc,its the second low res stream of this camera.
                                  config:

                                      module: "MMM-RTSPStream",
                                      position: "top_center",
                                      config: {
                                          autoStart: true,
                                          rotateStreams: true,
                                          rotateStreamTimeout: 10,
                                          moduleWidth: 354,
                                          moduleHeight: 240,
                                          localPlayer: 'omxplayer',
                                          remotePlayer: 'none',
                                          showSnapWhenPaused: false,
                                          remoteSnaps: false,
                                          stream1: {
                                              name: 'bibicam',
                                              url: 'rtsp://admin:@192.168.1.108:554/12?',
                                              frameRate: undefined,
                                              width: undefined,
                                              height: undefined,
                                              },
                                          }
                                  }
                                  

                                  any ideas?

                                  S 1 Reply Last reply Reply Quote 0
                                  • S Offline
                                    shbatm Module Developer @costascontis
                                    last edited by shbatm

                                    For the first one:

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

                                    error: object file .git/objects/0a/340d5d575f5675a19c2108bb1acc9f20576259 is empty

                                    That’s a new one by me… maybe time for Google on that one.

                                    For the blank screen: watch all of the PM2 logs (pm2 logs command) and see if you see something like this:

                                    1|omx_stre | * failed to add service - already in use?
                                    1|omx_stre | /usr/bin/omxplayer: line 67: 15281 Aborted (core dumped) 
                                    

                                    If you do, you probably have the latest version of Raspbian with the OpenGL driver enabled in raspi-config– omxplayer isn’t working properly with the OpenGL driver enabled, if you want to use omxplayer, you’ll have to enable the legacy driver: https://www.raspberrypi.org/forums/viewtopic.php?t=204794

                                    If you see anything else in the PM2 logs, let me know.

                                    1 Reply Last reply Reply Quote 0
                                    • C Offline
                                      costascontis
                                      last edited by costascontis

                                      i tested the bunny rtsp and another camera that output a “rtsp://ipcamera:554/ch0.h264” link and both work,so i think the camera i want to use that output the “rtsp://ipcamera:554/12” link has a problem with omxplayer.I will look at pm2 logs and i ll get back to you,thanx
                                      edit : the links that worked for me did not auto started but i had to press pause and play again.

                                      pm2 log :

                                      /home/pi/.pm2/logs/mm-out.log last 15 lines:
                                      0|mm       | Starting stream stream1 with args: [
                                      0|mm       |     "--avdict",
                                      0|mm       |     "rtsp_transport:tcp",
                                      0|mm       |     "--win",
                                      0|mm       |     "738, 63, 1090, 305",
                                      0|mm       |     "--live",
                                      0|mm       |     "--video_queue",
                                      0|mm       |     "4",
                                      0|mm       |     "--fps",
                                      0|mm       |     "30",
                                      0|mm       |     "rtsp://admin:@192.168.1.108/12.h264"
                                      0|mm       | ]
                                      0|mm       | PM2: omx_stream1 already running. Stopping old instance...
                                      0|mm       | Starting PM2 for omx_stream1
                                      0|mm       | PM2 started for omx_stream1
                                      
                                      

                                      i see no error but no streaming,only the name of the cam and black screen…

                                      S 1 Reply Last reply Reply Quote 0
                                      • D Offline
                                        djuscha
                                        last edited by

                                        I found that on my troubleshooting on the internet maybe that helps us?

                                        RTSP-Stream-Viewer

                                        S 1 Reply Last reply Reply Quote 0
                                        • S Offline
                                          shbatm Module Developer @costascontis
                                          last edited by

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

                                          i tested the bunny rtsp and another camera that output a “rtsp://ipcamera:554/ch0.h264” link and both work,so i think the camera i want to use that output the “rtsp://ipcamera:554/12” link has a problem with omxplayer.I will look at pm2 logs and i ll get back to you,thanx
                                          edit : the links that worked for me did not auto started but i had to press pause and play again.

                                          pm2 log :

                                          /home/pi/.pm2/logs/mm-out.log last 15 lines:
                                          0|mm       | Starting stream stream1 with args: [
                                          0|mm       |     "--avdict",
                                          0|mm       |     "rtsp_transport:tcp",
                                          0|mm       |     "--win",
                                          0|mm       |     "738, 63, 1090, 305",
                                          0|mm       |     "--live",
                                          0|mm       |     "--video_queue",
                                          0|mm       |     "4",
                                          0|mm       |     "--fps",
                                          0|mm       |     "30",
                                          0|mm       |     "rtsp://admin:@192.168.1.108/12.h264"
                                          0|mm       | ]
                                          0|mm       | PM2: omx_stream1 already running. Stopping old instance...
                                          0|mm       | Starting PM2 for omx_stream1
                                          0|mm       | PM2 started for omx_stream1
                                          
                                          

                                          i see no error but no streaming,only the name of the cam and black screen…

                                          Looks like you’re using an older version of the module based on the log. Try pulling the new version and switching to the develop branch… you should see the full omxplayer command line output to the logs, which you can use to test your camera outside of MM and the module.

                                          1 Reply Last reply Reply Quote 0
                                          • swvalentiS Offline
                                            swvalenti Project Sponsor
                                            last edited by

                                            Updated to dev branch and use rotate streams true (3) and after 3 hours it completely locks up my entire RPi and I have to pull the plug and disable same. Seems like it is too much on CPU to keep starting/stopping OMX every 15 seconds to cause the crash? Single stream average RPi temp is 128f but when rotate is on it jumps to 160f. Maybe thats the issue?

                                            S 1 Reply Last reply Reply Quote 0

                                            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                            With your input, this post could be even better 💗

                                            Register Login
                                            • 1
                                            • 2
                                            • 27
                                            • 28
                                            • 29
                                            • 30
                                            • 31
                                            • 30 / 31
                                            • First post
                                              Last post
                                            Enjoying MagicMirror? Please consider a donation!
                                            MagicMirror created by Michael Teeuw.
                                            Forum managed by Sam, technical setup by Karsten.
                                            This forum is using NodeBB as its core | Contributors
                                            Contact | Privacy Policy