DeadEnded / MotionEyeAudio

Script to add Audio to MotionEye recordings
66 stars 26 forks source link

New install, couple issues #3

Open prodiac1 opened 4 years ago

prodiac1 commented 4 years ago

I just installed MotionEyeOS for the first time, using a Raspberry Pi install (non Docker), and discovered your script, once I found out the system itself did not support audio. I installed it last night and ran in to a few issues.

The first issue is that each ffmpeg command was failing because it was looking for camera-.conf. It was failing the command that retrieves the camera ID. Here is the error:

File "", line 1 import motioneye.motionctl; print motioneye.motionctl.motion_camera_id_to_camera_id(/data/media/motioneye_192_168_1_99_securitycamera_chris_prodiac_net/2020-08-08/00-36-39.mp4) ^ SyntaxError: invalid syntax grep: /data/etc/camera-.conf: No such file or directory grep: /data/etc/camera-.conf: No such file or directory grep: /data/etc/camera-.conf: No such file or directory

I temporarily -fixed- this by just commenting this line out and putting "camera_id=1".

The second issue, which I can not seem to find any error for, is that it does not seem to always get the audio. I record by motion, not continuous. About half of my recordings have audio, half do not.

I am running the latest release of motioneye

DeadEnded commented 4 years ago

From the error, it appears that instead of getting the motion thread ID it is getting the config file path. This looks like you have the wrong parameter order being passed in.

Can you please paste in the Extra Motion Options and the Run a Command that you are using? It is getting the second parameter as %f instead of %t so something is messed up I would guess.

Lets fix this part, and then take a look at the missing audio - it could be the same issue as if Motion starts with a different thread # it could miss the audio as well.

Cheers! DeadEnd

DeadEnded commented 4 years ago

FYI another user has had the same issues, it looks like it is a difference between MotionEye and MotionEyeOS. I am working with them to figure it out, and I expect once I have it fix your issue will be resolved as well.

Cheers! DeadEnd

prodiac1 commented 4 years ago

Thanks. I used the same settings right from your docs. But I ended up getting fed up with things not working and just dumped MotionEyeOS for now and switched over to try Shinobi. I will continue to follow this and maybe try it again if that doesn't work out for me.

On Wed, Aug 12, 2020 at 1:29 PM DeadEnd notifications@github.com wrote:

FYI another user has had the same issues, it looks like it is a difference between MotionEye and MotionEyeOS. I am working with them to figure it out, and I expect once I have it fix your issue will be resolved as well.

Cheers! DeadEnd

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/DeadEnded/MotionEyeAudio/issues/3#issuecomment-673094830, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQRSUM4A7WABL7BBXOHC6KLSAL3UJANCNFSM4PZBEHCQ .

DeadEnded commented 4 years ago

I did try shinobi as well. Very nice software - my issue was doing a high and low res feed simultaneously... couldn't get it to work. Also recording lengths weren't consistent - would get random 10 second segments.

I have confirmed the issue is with the difference between MotionEye and MotionEyeOS. I will be working on fixing this... for the initial, if you are using IP cameras you can just comment out line 9 and change line 5:

line 5:

camera_id=$2

comment line 9:

camera_id="$(python -c 'import motioneye.motionctl; ..... blah blah blah

But chances are you are using a camera designed for the PI and so the script doesn't handle that. I will be working to try and write a second script designed for MotionEyeOS but don't have any idea how long it will take if it is even possible.

Cheers! DeadEnd

prodiac1 commented 4 years ago

Did you see the second issue I noted though? Half of my recordings had no audio, while half did. After I manually did comment out the line 9, and manually set camera_id=1 to get it working at all.

DeadEnded commented 4 years ago

how long are your recordings typically? there could be some delay in the processing and so for short recordings it could be missed.

prodiac1 commented 4 years ago

My motion detection settings did not seem to be working properly and I was getting recordings for 45seconds-1min every couple of minutes, when I was noticing this.

DeadEnded commented 4 years ago

hmm... IDK to be honest. it could be the script wasn't being called every time, but I can't say why. You could try digging through logs and see what you can find - needle in a haystack.

What camera are you using? Is it a Pi cam or an IP cam?

prodiac1 commented 4 years ago

It's a Sercomm ipcamera2, I had gone through my logs, couldn't find any indication of ffmpeg being triggered for the extra trigger on the times where I got no audio to be honest.

DeadEnded commented 4 years ago

Ok, then the existing script should work. A new script is going to need to be made for when the camera is a raspberry pi cam and they are using a separate mic. Since you are using an IP cam the first script should work with the small change that you've already done.

As to why the audio is being missed on some recordings, I am wondering if it is related to your issue with motion detection not working sometimes... IDK if there is a setup issue or a resource issue? Maybe rule out the resource by taking a look while its running (specifically when recording) and see how high the usage goes. If CPU is maxing out during recording it just might not have enough juice to keep up. Just an idea.

Or if you are liking Shinobi run with that - easier than hacking together something else 😄 .

Cheers! DeadEnd