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-MPlayer - display issue

    Scheduled Pinned Locked Moved Solved Troubleshooting
    3 Posts 1 Posters 205 Views 1 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.
    • evroomE Offline
      evroom
      last edited by evroom

      Hi,

      I have this issue with MMM-MPlayer, that also has been reported by other users of the module.

      When using the module, the MPlayer window is seen in the middle of the screen and has a MPlayer title.

      This is what is running when using the module:

      admin@MagicPi3b:~/MagicMirror/modules/MMM-MPlayer $ ps -eaf | grep mplayer | grep -v grep
      admin 38919 38729 18 12:17 ? 00:00:01 mplayer -monitoraspect 0  -noborder -vf rotate=-1 -geometry 10:225 -xy 640 -rtsp-stream-over-tcp -vo xv,gl,gl_nosw,vdpau, -nosound rtsp://axisviewer:password@192.168.178.55/axis-media/media.amp?streamprofile=ACC_Low
      

      The value of DISPLAY is: :0

      When I run the same command like this, it is working as expected:

      admin@MagicPi3b:~/MagicMirror/modules/MMM-MPlayer $ DISPLAY=:0 mplayer -monitoraspect 0  -noborder -vf rotate=-1 -geometry 10:225 -xy 640 -rtsp-stream-over-tcp -vo xv,gl,gl_nosw,vdpau, -nosound rtsp://axisviewer:password@192.168.178.55/axis-media/media.amp?streamprofile=ACC_Low
      

      The MMM-MPlayer module uses this to start mplayer:

          const env = { ...process.env, DISPLAY: ':0' };
          const mplayerProcess = spawn(`mplayer`,
             [`${mplayerOption}`, `${mplayerOptionValue}`,
              :
              :
              `${stream}`],
              {env: env});
      

      I cannot get my finger behind this and I have no idea why this happens like this.
      Any ideas ?

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

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

      evroomE 1 Reply Last reply Reply Quote 0
      • evroomE evroom referenced this topic on
      • evroomE Offline
        evroom @evroom
        last edited by evroom

        To answer myself:

        I cleaned the array using:

            const mplayerArgumentsArrayFilter = mplayerArgumentsArray.filter(discardEmptyArgument);
            function discardEmptyArgument(value, index, array) {
              return value != '';
            }
        

        Then spawned using that array:

            // Spawn a new mplayer process
            const env = { ...process.env, DISPLAY: ':0' };
            const mplayerProcess = spawn(`mplayer`, mplayerArgumentsArrayFilter, {env: env});
        

        Now it is working correct.

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

        Test environment:
        MagicMirror version: v2.30.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 @evroom
          last edited by

          I found out following:

          When using

              // Spawn a new mplayer process
              const env = { ...process.env, DISPLAY: ':0' };
              const mplayerProcess = spawn(`mplayer`,
                 ['-rtsp-stream-over-tcp',
                  '-noborder',
                  '-monitoraspect', '0',
                  '-vf', 'rotate=-1',
                  '-geometry', '5:225',
                  '-x', '640',
                  '-y', '360',
                  'rtsp://axisviewer:password@192.168.178.55/axis-media/media.amp?streamprofile=ACC_Low'],
                  {env: env});
          

          The stream is correct on the monitor.

          When using

              // Spawn a new mplayer process
              const env = { ...process.env, DISPLAY: ':0' };
              const mplayerProcess = spawn(`mplayer`,
                 ['',
                  '', '',
                  '-rtsp-stream-over-tcp',
                  '',
                  '', '',
                  '-noborder',
                  '-monitoraspect', '0',
                  '-vf', 'rotate=-1',
                  '-geometry', '5:225',
                  '-x', '640',
                  '-y', '360',
                  'rtsp://axisviewer:password@192.168.178.55/axis-media/media.amp?streamprofile=ACC_Low'],
                  {env: env});
          

          The stream is NOT correct on the monitor (MPlayer window in the center).

          So the problem is spawning with empty parameters.
          When running it from the command line, this is not an issue, as the shell takes care of the empty places between the arguments.

          I tried with undefined and null iso ''but that does not work.

          Only idea how to solve this ?
          Cleaning the array somehow ?

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

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

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

            To answer myself:

            I cleaned the array using:

                const mplayerArgumentsArrayFilter = mplayerArgumentsArray.filter(discardEmptyArgument);
                function discardEmptyArgument(value, index, array) {
                  return value != '';
                }
            

            Then spawned using that array:

                // Spawn a new mplayer process
                const env = { ...process.env, DISPLAY: ':0' };
                const mplayerProcess = spawn(`mplayer`, mplayerArgumentsArrayFilter, {env: env});
            

            Now it is working correct.

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

            Test environment:
            MagicMirror version: v2.30.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 evroom has marked this topic as solved on
            • 1 / 1
            • 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