motioneye-project / motioneye

A web frontend for the motion daemon.
GNU General Public License v3.0
3.99k stars 655 forks source link

Motioneye on DietPi #2982

Closed UKnau22 closed 6 months ago

UKnau22 commented 6 months ago

I installed MotionEye on a RaspberryPi 4 with DietPi, using the dietpi-software command.

I spent a whole day trying to figure out how to add my new Reolink camera and get an rtsp stream. I also tried adding a camera that I know is working with MotionEye. Turns out there's nothing wrong with the camera or my settings. I was able to add the Reolink camera without any issues in my MotionEye installation on HomeAssistant, which is where I also run the camera I tried adding to the DietPi setup.

So what's happening is that I can add the camera rtsp stream, but the camera view actually is just grey, nothing visible.

I reinstalled MotionEye to no avail

Anybody have any experience with that or idea what might be wrong? Some dependencies issues?

MichaIng commented 6 months ago

The Home Assistant integration uses the old Python 2 based motionEye 0.42.1 code, which differs quite significantly from what is installed on DietPi or when you follow these instructions: https://github.com/motioneye-project/motioneye?tab=readme-ov-file#installation

Also, the underlying motion version, is likely different, as well as v4l2-ctl and ffmpeg, respectively the used FFmpeg libraries. Means, there is no point to compare both setups, but instead we need to focus on why it does not work with the bare metal motionEye Python 3 module and latest motion version.

Just to be sure I understood correctly, you added it as network camera with rtsp:// URL, right? Does motionEye throw any related errors?

journalctl -u motioneye

Btw, as a general recommendation: When you have questions or face issues with a distribution's implementation of some software, report/ask it to the distribution first. Upstream developer might not know which distribution implemented it how, which version they use, whether they apply patches etc. Similarly, I have no detailed idea how HA implemented their motionEye integration. The distribution maintainer(s) can then redirect it upstream, if it turns out to be an upstream issue. However, in this case, I know it is an upstream issue, since I am the DietPi maintainer and know that we implemented motionEye just like it is advertised on the readme linked above 😉.

UKnau22 commented 6 months ago

I did read a few posts on the DietPi forum and concluded that this is the better place to ask...

Yes, I added it as a network camera with rtsp://URL

Following errors are thrown, the first one several times:

May 14 11:12:20 MotionEye meyectl[669]: ERROR: ffmpeg: could find version: Command '['/usr/bin/ffmpeg', '-version']' returned non-zero exit status 127.

May 14 11:12:20 MotionEye meyectl[669]: ERROR: 500 POST /config/add/?_=1715710340275&_username=*&_signature=*** (192.168.1.147) 518.23ms May 14 11:12:21 MotionEye meyectl[669]: ERROR: motion not running, starting it May 14 11:12:22 MotionEye meyectl[669]: ERROR: failed to start motion: motion failed to start

May 14 11:12:32 MotionEye meyectl[669]: ERROR: failed to start motion: motion failed to start May 14 11:12:32 MotionEye meyectl[669]: Traceback (most recent call last): May 14 11:12:32 MotionEye meyectl[669]: File "/usr/local/lib/python3.11/dist-packages/motioneye/server.py", line 374, in checker May 14 11:12:32 MotionEye meyectl[669]: motionctl.start() May 14 11:12:32 MotionEye meyectl[669]: File "/usr/local/lib/python3.11/dist-packages/motioneye/motionctl.py", line 127, in start May 14 11:12:32 MotionEye meyectl[669]: raise Exception('motion failed to start') May 14 11:12:32 MotionEye meyectl[669]: Exception: motion failed to start

MichaIng commented 6 months ago

I did read a few posts on the DietPi forum and concluded that this is the better place to ask...

Ah, well concluded then 🙂.

exit status 127 means that the file/command was not found. That is strange, FFmpeg should have been installed as dependency in dietpi-software, and even if that was somehow missing, again when motioneye_init is executed.

Can you check that:

which ffmpeg
ls -l /usr/bin/ffmpeg
dpkg -l ffmpeg
UKnau22 commented 6 months ago

I will as soon as I get back home

Sent from Proton Mail Android

-------- Original Message -------- On 5/14/24 11:44, MichaIng wrote:

I did read a few posts on the DietPi forum and concluded that this is the better place to ask...

Ah, well concluded then 🙂.

exit status 127 means that the file/command was not found. That is strange, FFmpeg should have been installed as dependency in dietpi-software, and even if that was somehow missing, again when motioneye_init is executed.

Can you check that:

which ffmpeg ls -l /usr/bin/ffmpeg dpkg -l ffmpeg

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

UKnau22 commented 6 months ago

Here's the output of that....

root@MotionEye:~# which ffmpeg
/usr/bin/ffmpeg
root@MotionEye:~# ls -l /usr/bin/ffmpeg
-rwxr-xr-x 1 root root 330136 Feb 28 07:38 /usr/bin/ffmpeg
root@MotionEye:~# dpkg -l ffmpeg
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version                Architecture Description
+++-==============-======================-============-================================================================
ii  ffmpeg         8:5.1.4-0+rpt3+deb12u1 arm64        Tools for transcoding, streaming and playing of multimedia files
MichaIng commented 6 months ago

That looks all good. And the command motionEye failed to execute, does it work?

/usr/bin/ffmpeg -version
sudo -u motion /usr/bin/ffmpeg -version
UKnau22 commented 6 months ago

root@MotionEye:~# motionEye -bash: motionEye: command not found

This doesn't seem right... I'm sorry, not a pro with command line....

MichaIng commented 6 months ago

I did not mean the command "motionEye", but the command which motionEye failed to run 😄. Please execute the commands from the code box instead.

UKnau22 commented 6 months ago

Hmmm.... I tried that all kinds of ways, below is the output. Sorry if I'm being stupid...

root@MotionEye:~# /usr/bin/ffmpeg -version
/usr/bin/ffmpeg: symbol lookup error: /lib/aarch64-linux-gnu/libgio-2.0.so.0: undefined symbol: g^list_foreach

root@MotionEye:~# -u motion /usr/bin/ffmpeg -version
-bash: -u: command not found

root@MotionEye:~# /usr/bin/ffmpeg -version
sudo -u motion /usr/bin/ffmpeg -version
/usr/bin/ffmpeg: symbol lookup error: /lib/aarch64-linux-gnu/libgio-2.0.so.0: undefined symbol: g^list_foreach
/usr/bin/ffmpeg: symbol lookup error: /lib/aarch64-linux-gnu/libgio-2.0.so.0: undefined symbol: g^list_foreach
MichaIng commented 6 months ago

There we have the issue. This library is from the libglib2.0-0 package. g^list_foreach looks like the file is corrupted. It should be g_list_foreach. Please try to reinstall that package:

apt install --reinstall libglib2.0-0
systemctl restart motioneye
UKnau22 commented 6 months ago

That absolutely did the trick! Thank you so much! I spent all day yesterday trying to figure out what I'm doing wrong....

MichaIng commented 6 months ago

Great. That was not an easy one, indeed. Reading the output, I am about to enhance the logging a little: https://github.com/motioneye-project/motioneye/pull/2983/files

Though, the most important output about the library error is still missing. The CalledProcessError returned only the exit code:

Command '['/usr/bin/ffmpeg', '-version']' returned non-zero exit status 127.

while I would like to (additionally) see the actual error there:

/usr/bin/ffmpeg: symbol lookup error: /lib/aarch64-linux-gnu/libgio-2.0.so.0: undefined symbol: g^list_foreach

And I even interpreted the exit code 127 wrong in this case, as the shell returns it when an executable was not found. In this case, however, the command was found and executed, a shared library loaded, and only within this library, a symbol was found undefined (due to false character/corruption). No idea why this results in 127 as well 😄.

Probably the command's STDERR was stored in that output variable as well, so that we can just append it to the error message.

UKnau22 commented 6 months ago

Was any of that English?! 🤣🤣🤣

Well you did figure it out and are obviously much more well versed in this

Thank you!

Sent from Proton Mail Android

-------- Original Message -------- On 5/14/24 15:11, MichaIng wrote:

Great. That was not an easy one, indeed. Reading the output, I am about to enhance the logging a little: https://github.com/motioneye-project/motioneye/pull/2983/files

Though, the most important output about the library error is still missing. The CalledProcessError returned only the exit code:

Command '['/usr/bin/ffmpeg', '-version']' returned non-zero exit status 127.

while I would like to (additionally) see the actual error there:

/usr/bin/ffmpeg: symbol lookup error: /lib/aarch64-linux-gnu/libgio-2.0.so.0: undefined symbol: g^list_foreach

And I even interpreted the exit code 127 wrong in this case, as the shell returns it when an executable was not found. In this case, however, the command was found and executed, a shared library loaded, and only within this library, a symbol was found undefined (due to false character/corruption). No idea why this results in 127 as well 😄.

Probably the command's STDERR was stored in that output variable as well, so that we can just append it to the error message.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you modified the open/close state.Message ID: @.***>