motioneye-project / motioneyeos

A Video Surveillance OS For Single-board Computers
Other
7.9k stars 904 forks source link

RPi 3 + motionEye = slow preview/recording fps #227

Closed perrychan closed 7 years ago

perrychan commented 8 years ago

First of all, great job with motionEyeOS. Was excited to see this software available and bought a couple of RPi 3s.

Unfortunately, recording stutters (1-2fps) once motion is detected. This applies whether its on large or small resolution. While watching the stream, I get 10fps, but drops down to 2-3fps as soon as it detects motion.

A lot of you don't seem to be having this problem. I am using an RPi camera when I first purchased my Raspberry Pi Model B. Think it might have anything to do with that?

ccrisan commented 8 years ago

What fps setting have you configured? If you're using a relatively high fps, the video encoding process might be too much for the CPU.

perrychan commented 8 years ago

It was set to ~20fps. I have adjusted to 10fps and res to 640x480. Am getting an average framerate of 2.5 now, which is an improvement from ~1.5. It's an improvement, but it's not usable at the moment. Any ideas?

I tried to use Fast Network Camera, but the stream never appears (constant spinner).

ccrisan commented 8 years ago

Please attach all of your log files. I'll take a look over them and see if I can spot anything fishy.

perrychan commented 8 years ago

Attached are my logs.

motionEyeOS-logs.zip

cuddylier commented 8 years ago

I just got a RPI 3 today as well and when it starts recording, my FPS also plummets even at 640 x 480 as well.

I've attached my logs. logs.zip

cuddylier commented 8 years ago

It appears to be any sort of recording, even with still images it starts to lag horribly and the FPS drops to 1 or 2 as @perrychan experienced.

cuddylier commented 8 years ago

I watched the CPU usage during recording/image taking and it remains at a normal level of 30 - 40% and the I/O remains at 0% so it doesn't seem like the CPU isn't powerful enough at least?

linus-dev commented 8 years ago

Have the same problem as @perrychan! Running RPi2

https://github.com/ccrisan/motioneyeos/issues/235

Could not upload my log files on github for some reason... My logs

ccrisan commented 8 years ago

I'll take a look over this. I haven't yet managed to investigate the problem.

PappyEric commented 8 years ago

Having same issue with RPI3 as well. I'm new to MotionEyeOS so maybe I'm something wrong. When a person walks into the view, it is initially smooth video, but then looses several frames.

cuddylier commented 8 years ago

@CrazyEyesPete Exactly the same thing I get, it's perfectly smooth for a few seconds when something moves and then drops frames as well. It still does this even with motion disabled and continuous recording enabled, it drops the frames permanently in this mode of course.

zettam commented 8 years ago

Anyone able to find a temp solution to this, till this is fixed permanently? I like motioneyeos but this makes it unusable :(

perrychan commented 8 years ago

I'm hoping @ccrisan will be able to look over the logs soon.

ccrisan commented 8 years ago

I will be taking care of this issue in the following weeks. I'm currently terribly busy with some personal matters but I haven't abandoned this project :)

ShacharWeis commented 8 years ago

Same problem here, only much worse. RPI V2. FPS drops to 0.1 once motion is detected. System is unusable.

ccrisan commented 8 years ago

@perrychan , @ShacharWeis , @CrazyEyesPete , @zettam can I have your config files please? I cannot seem to reproduce the problem at all.

zettam commented 8 years ago

I deleted everything, was waiting for the fix. Sorry. I do not remember changing the defaults though. It worked, with the mentioned problem.

ShacharWeis commented 8 years ago

I've deleted the system and am now installing Zoneminder. After 12 hours my dropbox folder was full of false triggers and blank images that say "unable to open video device". Motioneyeos has a lot of potential, but I don't have time to debug it.

tsrgit commented 8 years ago

@ccrisan , I am having the same issue with my RPi 3. It can easily maintain frame rates over 10 fps, even while detecting motion, as long as it is only streaming. As soon as I enable the saving of movies onto a Samba share on a network drive, the frame rate drops to around 1 fps when motion is detected.

Attached are my logs and what I think are the relevant config files.

motioneyefiles.zip

Let me know if you need anything else.

cuddylier commented 8 years ago

I'm happy to provide my config as well if you let me know where to find it.

zettam commented 8 years ago

@ShacharWeis I would not bother with zoneminder. I've tried it. It does the same thing, motion does (of course depends on what you're looking for) with a much complicated and needy setup process. It's old.

ShacharWeis commented 8 years ago

@zettam yeah, I found that out. Can't even get Zoneminder to run at all. I've given up and am now using an old android phone. Very sad. Do you have a good guide for setting up Motion?

zettam commented 8 years ago

@ShacharWeis motion is very easy to set up actually, did you check the online docs? I got zoneminder running, it's not worth the effort really. Motion is much better, with the same capabilities (and a newer/better interface) with much cleaner setup.

perrychan commented 8 years ago

@cuddylier you can find the log files under the Expert Settings menu.

cuddylier commented 8 years ago

@perrychan I already attached my log files earlier in this issue report, just found the config backup part under General.

@ccrisan my config files: ConfigFiles.zip

ghost commented 8 years ago

Same problem, currently on a RPi 2 (Model B).

linus-dev commented 8 years ago

Is this bug only on MotionEyeOS or can switch to Motion untill the bug is fixed?

ccrisan commented 8 years ago

I haven't been able to establish what "the bug" is about. People complain about slow fps in general. I'll take a look over the log files but I doubt there's one single problem that covers everything users are complaining about here.

linus-dev commented 8 years ago

@ccrisan I dont know if this has something to do with the bug but read this thread.

They talk about ARMv6 and ARMv7. I dont know, maybe this has something to do with it.

kingsquirrel152 commented 8 years ago

I too am having the same issues. I don't see any spike in CPU load.

Kayak83 commented 8 years ago

How are you guys monitoring CPU useage? I'm running the OS image and I don't see a way of seeing the CPU temp or load. Do I need to run it in Raspbian for that functionality?

dmarkscouk commented 8 years ago

I'm also having the same issue. I've uploaded some same video's here: https://www.dropbox.com/s/k05uyybz5yq2nlk/stuttery.zip?dl=0

I get the same issue weather I'm running hi or low resolution, and 30 or 20 fps. I get great video with Fast Network Camera enabled, but as I can't record this it does not help.

I'm running a Raspberry Pi 3, with the camera module 2. My log files are here: https://www.dropbox.com/s/h4lrb325aa45kj3/motion_logs.zip?dl=0

Thanks, David.

ccrisan commented 8 years ago

@dmarkscouk unfortunately I'm afraid that's the best you can get with motionEyeOS. No hardware/accelerated encoding/decoding is performed by the motion daemon and therefore the performance is limited to what the CPU can offer.

A slow SD card may impact the performance as well, while saving videos to a network share could make matters even worse.

The reason why FNA is that fast is that it doesn't use the motion "backend" but rather makes use of the streamEye project to simply capture and stream the mjpeg frames without processing them in any way (hence the great performance).

I know this is not ideal and is probably not what most of you were hoping for when decided to try motionEye(OS) but this is what we have.

I use 7 FNA-enabled cameras based on RPI1 and a powerful central computer with 8 cores running Arch Linux + motionEye that acts as a DVR for the RPI1 cameras. I believe this is the best setup you can have with motionEye.

Phesten commented 8 years ago

So would it not be a good idea to use a RPi 3 as a hub for 3x Foscam IP cameras? They are capable of 720p video.

I intend to offload the camera data from the Pi to a USB attached hard drive.

I really want to be able to use MotionEyeOS for this, but it won't recognize the Foscams for some reason.

Sent from my iPhone

On May 13, 2016, at 1:55 AM, Calin Crisan notifications@github.com<mailto:notifications@github.com> wrote:

@dmarkscoukhttps://github.com/dmarkscouk unfortunately I'm afraid that's the best you can get with motionEyeOS. No hardware/accelerated encoding/decoding is performed by the motion daemon and therefore the performance is limited to what the CPU can offer.

A slow SD card may impact the performance as well, while saving videos to a network share could make matters even worse.

The reason why FNA is that fast is that it doesn't use the motion "backend" but rather makes use of the streamEye project to simply capture and stream the mjpeg frames without processing them in any way (hence the great performance).

I know this is not ideal and is probably not what most of you were hoping for when decided to try motionEye(OS) but this is what we have.

I use 7 FNA-enabled cameras based on RPI1 and a powerful central computer with 8 cores running Arch Linux + motionEye that acts as a DVR for the RPI1 cameras. I believe this is the best setup you can have with motionEye.

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHubhttps://github.com/ccrisan/motioneyeos/issues/227#issuecomment-218988064

tsrgit commented 8 years ago

@ccrisan are you saying that MotionEyeOS cannot achieve better than 1 fps on a RPi when recording video with the motion engine?

ccrisan commented 8 years ago

It can, but at lower resolutions. I remember recording 3-4 fps videos at 640x480 with RPi1.

cuddylier commented 8 years ago

That sucks then, not really usable :(

ccrisan commented 8 years ago

@cuddylier I totally agree. That's why I recommend using RPi1 devices just as fast network cameras. I myself have 8 of them (I just finished installing the 8th one today), all of them working in FNA mode. I use an Odroid XU4 running motionEye as a hub that performs all the motion detection, movie encoding, notifications and whatnot.

kingsquirrel152 commented 8 years ago

So - I've had some success setting the motion trigger to a low setting (it almost seems like if the motion trigger stops - it stops recoding the video). Ill export settings and examples later tonight.

On Wed, May 18, 2016 at 2:17 PM, cuddylier notifications@github.com wrote:

That sucks then, not really usable :(

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/ccrisan/motioneyeos/issues/227#issuecomment-220113333

dmarkscouk commented 8 years ago

Would it be possible to activate video recording using a physical motion sensor or ultrasonic distance sensor (I presume this would save CPU power, that could then be used to record video)? Recording video in HD is no problem when I use the standard raspivid function.

MMiknis commented 8 years ago

It seems to be odd, using Pi2 I can stream at 20fps once motion is detected and recording starts it drops to 0.8fps. When I check the video the first two seconds are at high frame-rate but after that fps drops :( so recorded video is no good.

hacker112 commented 8 years ago

I think motion performance could be improved by:

and/or

What do you think about that, @ccrisan?

ccrisan commented 8 years ago

I totally agree that motion could make use of the GPU-accelerated routines to encode h264 movies. I believe I saw some work in this direction, although I believe it was something related to ffmpeg and not motion itself. However, I am not willing to touch motion's source code so we'll need to use the motion version that we currently have.

There are ways to use an external ffmpeg command using the extpipe motion option but things start to get complicated and I don't have the time to add that to the current UI and then deal with all the problems that will occur.

ikarisan commented 8 years ago

Very disappointing. :(

I had the choice between one of these Chinese "phone home" IP cameras and the Pi3+Motion solution and I did chose the last option. :/

Now I am stuck at 352x288 videos with 10fps instead of 1280x720/30fps as offered by these chinese IP cameras. :(

ShadowNetworks commented 8 years ago

I'm okay with setting up MotionEye on a Linux machine and catching the FNA stream. Is there any way to secure the stream? Maybe my searches didn't turn up anything.

Hey ccrisan, would any of the Linux OS's work on the Odroid XU4 with motionEye? I'm looking at ubuntu server.

Maxmudjon commented 8 years ago

I have a question . I'm on raspberry PI 3 connect IP camera and watch the video broadcast but slow. You do not know the problem?

sjabbie88 commented 7 years ago

@ccrisan That's why I recommend using RPi1 devices just as fast network cameras. I myself have 8 of them (I just finished installing the 8th one today), all of them working in FNA mode. I use an Odroid XU4 running motionEye as a hub that performs all the motion detection, movie encoding, notifications and whatnot.

Casin, can you clarify how you have set-up motionEye on your Odroid XU4 to perform the motion detection and encoding of your 8 cameras while they are set-up as Fast Network Cameras on the Odroid XU4?

If I imitate your setup, I only have a fraction of the FNA camera options on the MotionEye Hub device, only general settings and no motion detection or encoding options....?

The way I read it, It is a very interesting set-up =)

ccrisan commented 7 years ago

FNC is not available on Odroid XU4. You'll have to enable it on your RPi-based cameras, and then add them as regular network cameras to the Odroid XU4 running regular motionEye or motionEyeOS.

cuddylier commented 7 years ago

@ccrisan You haven't seen any FPS issues using motioneyeos on your Odroid in this setup during recording of video?

ccrisan commented 7 years ago

I run my 9 cameras at 1024x768@10fps. Provided not all of them record motion at once, things are pretty smooth.