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 @shbatm
      last edited by

      @djuscha I’ve reverted the changes that I think broke the master channel. Please try updating your module to the current master branch and test.

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

        @cr4z33 Added something that might help. Please use the develop branch and update your change channel commands to :

        {
        notification: “RTSP-PLAY”,
        payload: { stream:“stream1”, stopOthers: true }
        }

        EDIT: Nevermind, don’t do that. I fixed the glitch on the develop channel that was starting more than one stream when rotateStreams: true was set. Please try that and see if it works now.

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

          @shbatm Hey, I updated issue #33 with the errors I am seeing when you have a chance. Also, should I run this update although I am using the VLCplayer method? Let me know what you think. Thanks again for all your help!

          1 Reply Last reply Reply Quote 0
          • BKeyportB Offline
            BKeyport Module Developer
            last edited by

            I’m unable to get this module to load and run with FFMPeg anymore - as of 3PM 1/4/19 (Pacific Time (Seattle))

            Update was applied as of that time.

            I don’t know how to retrieve logs.

            – Bug filed on github - https://github.com/shbatm/MMM-RTSPStream/issues/34

            The "E" in "Javascript" stands for "Easy"

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

              @djuscha, @Cr4z33 @barnosch @anthony6608 @bhepler @evroom, and anyone else using this module:

              I just pushed a bunch of bug fixes for OMX Player to the develop branch. Please test and let me know if you are still seeing the same issues.

              Fixes include:

              • App closing now spawns a new process to actually kill the OMX streams, it was getting cut off in the middle of closing everything due to it being an async process and leaving streams open.
              • Wait for DOM to be shown before calling to start the streams–this was causing the Fullscreen on Resume problems.
              • Only start one stream at a time if we’re in RotateStreams mode
              • Can jump to a specific stream in RotateStreams mode using notifications
              • Fixed and cleaned up all notifications and control from other modules
              • Fixed broken key bindings after MMM-KeyBindings upgrade
              • Fixed issue where module was trying to connect to PM2 while it was already connected (e.g. stop stream 1 and start stream 2 back to back).

              To switch branches:

              cd ~/MagicMirror/modules/MMM-RTSPStream
              sudo rm -R node_modules/
              git fetch --al
              git checkout develop
              git pull
              npm install
              
              Cr4z33C D 2 Replies Last reply Reply Quote 0
              • evroomE Offline
                evroom
                last edited by

                @shbatm
                I installed the new changes according your procedure.
                I am using omxplayer for a RTSP stream of a IP cam.
                I do not use rotation or any other fancy stuff.
                I see the same issue as before: omx_stream1 has status stopped and when I click on the play button it also will not start.
                I stopped and started mm 2 times and even did a complete reboot
                It only can be started using

                $ pm2 start omx_stream1
                

                Another restart of mm shows that the omx_stream1 is being stopped, but never restarted.
                After ever mm restart I will need to perform:

                $ pm2 start omx_stream1
                
                

                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)

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

                  I noticed this in pm2 logs (do not see this after every mm restart):

                  0|mm  | Connecting socket for: MMM-RTSPStream
                  0|mm  | PM2: Stopping all OMXPlayer Streams...
                  0|mm  | Sockets connected & modules started ...
                  0|mm  | Launching application.
                  0|mm  | PM2: Checking if omx_stream1 is running...
                  0|mm  | PM2: Stopping omx_stream1...
                  PM2      | Stopping app:omx_stream1 id:1
                  1|omx_stream1  | Video codec omx-h264 width 640 height 360 profile 77 fps 30.000000
                  1|omx_stream1  | Subtitle count: 0, state: off, index: 1, delay: 0
                  1|omx_stream1  | V:PortSettingsChanged: 640x360@30.00 interlace:0 deinterlace:0 anaglyph:0 par:1.00 display:0 layer:0 alpha:255 aspectMode:0
                  1|omx_stream1  | have a nice day ;)
                  PM2            | App [omx_stream1:1] exited with code [1] via signal [SIGINT]
                  PM2            | pid=2104 msg=process killed
                  
                  

                  In this case it was tried to start the stream, but it exited.
                  Starting it by hand makes it work 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)

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

                    @shbatm I ran the develop update.

                    With omxplayer (and autoStart: false) I see stream labels changing when giving a voice command, but then no stream is starting.

                    With vlc nothing happens, not a single stream starting by voice command.

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

                      @shbatm

                      have made yesterday update without develoop only

                      git pull
                      npm install
                      

                      everything runs :)

                       Name        │ id │ mode │ status │ ↺      │ cpu │ memory │
                      ├─────────────┼────┼──────┼────────┼────────┼─────┼────────┼──────────┤
                      │ mm          │ 0  │ N/A  │ fork   │ online │ 0   │ 0%     │ 2.5 MB   │
                      │ omx_stream1 │ 1  │ N/A  │ fork   │ online │ 17  │ 0%     │ 2.8 MB   │
                      │ omx_stream2 │ 2  │ N/A  │ fork   │ online │ 6   │ 0%     │ 2.8 MB   
                      

                      Many Thanks .

                      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:

                        after every mm restart

                        There was a problem with the steams not stopping on a restart, so the module sends a stop command first whenever it starts, do you have autoStart: true in your config?

                        evroomE 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 (and autoStart: false) I see stream labels changing when giving a voice command, but then no stream is starting.

                          OK. I’ll check this later today, the notification RTSP-PLAY should switch and start the stream so that’s an issue.

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

                            @Cr4z33 try inserting this.playing = true; at Line 574 as the first line in the if statement and see if that works. I’ll test later today.

                            EDIT: Just pushed an update. Please try the latest release in develop

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

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

                              There was a problem with the steams not stopping on a restart, so the module sends a stop command first whenever it starts, do you have autoStart: true in your config?

                              Yes, I have.

                              Just to understand, when you start fresh, there is no omx_stream1 under pm2 list.
                              When you start your first stream, it is first visible under pm2 list, right?

                              Till now I was able to start the stream with pm2 start, but after removing the stream (pm2 remove omx_stream1), I cannot get it to work anymore.
                              MM restart, reboot, nothing helps.
                              And pm2 start now says:

                              pi@MagicPi:~ $ pm2 start omx_stream1
                              [PM2][ERROR] script not found : /home/pi/omx_stream1
                              script not found : /home/pi/omx_stream1
                              ┌──────────┬────┬─────────┬──────┬─────┬────────┬─────────┬────────┬─────┬──────────┬──────┬──────────┐
                              │ App name │ id │ version │ mode │ pid │ status │ restart │ uptime │ cpu │ mem      │ user │ watching │
                              ├──────────┼────┼─────────┼──────┼─────┼────────┼─────────┼────────┼─────┼──────────┼──────┼──────────┤
                              │ mm       │ 0  │ 2.5.0   │ fork │ 811 │ online │ 0       │ 4m     │ 0%  │ 2.5 MB   │ pi   │ disabled │
                              └──────────┴────┴─────────┴──────┴─────┴────────┴─────────┴────────┴─────┴──────────┴──────┴──────────┘
                              

                              Which makes sort of sense.

                              After MM restart, pm2 logs shows:

                              0|mm  | Connecting socket for: MMM-RTSPStream
                              0|mm  | PM2: Stopping all OMXPlayer Streams...
                              0|mm  | Sockets connected & modules started ...
                              0|mm  | Launching application.
                              

                              Will revert back to the master branch and 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)

                              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:

                                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

                                            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
                                            • 8
                                            • 9
                                            • 10
                                            • 11
                                            • 12
                                            • 30
                                            • 31
                                            • 10 / 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