deadended / motioneyeaudio Goto Github PK
View Code? Open in Web Editor NEWScript to add Audio to MotionEye recordings
Script to add Audio to MotionEye recordings
After reading several issues discussion also the lengthy debug in https://community.home-assistant.io/t/adding-audio-to-motioneye-recordings/198438/8 , I finally figured out why the script is not working on my setup:
"Official" motioneye docker install on arm64 pi board (orange pi 3b)
Turned off Camera1 in motionEye Video Device settings, get the container shell and can successfully try
ffmpeg -y -i "rtsp://admin:[email protected]:554/" -c:a copy test.wav
the wav file can be played smoothly
Turned on Camera1, video recording is turned on. Run the same ffmpeg command in the shell but get:
rtsp://admin:[email protected]:554/: Operation not permitted
I don't know why I counldn't get ffmpeg to stream the rtsp at the same time of video recording. Is it a limitation from ffmpeg? from container's network? from the IP-CAM which doesn't allow two connections from the same IP?
Running out of ideas to move forward... Any insight is much appreciated. Thanks!
right after i added this, the newly recorded files were corrupted
I've recently installed a fresh MotionEyeOS 20200606 on a Raspberry Pi Zero W, hooked it up to the native Raspberry Pi camera and a basic USB microphone. The motioneye-audio.sh file doesn't cause audio to be captured, so I've done a few investigations helped by my fork of the repo, in which I've added some debug lines for each of the variables. You may wish to take a look here... https://github.com/lapsedtheorist/MotionEyeAudio
My Video Device > Extra Motion Options
says on_movie_start /data/etc/motioneye-audio.sh start %t %f '%$'
, and my File Storage > Run a Command
says /data/etc/motioneye-audio.sh stop %t %f '%$'
.
The script definitely runs when it should, however the camera_id
variable remains empty, so the config file is not found. If I attempt to manually run the command that would populate it (from a root SSH session), I see the following terminal output. Note I've hardcoded the "1" in the example, which is the value that comes through from the command line into the motion_thread_id
variable.
# python -c 'import motioneye.motionctl; print motioneye.motionctl.motion_camera_id_to_camera_id(1)'
ERROR:root:failed to list config dir /etc/motioneye: [Errno 2] No such file or directory: '/etc/motioneye'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/motioneye/motionctl.py", line 28, in <module>
File "/usr/lib/python2.7/site-packages/motioneye/mediafiles.py", line 38, in <module>
File "/usr/lib/python2.7/site-packages/motioneye/config.py", line 2085, in <module>
File "/usr/lib/python2.7/site-packages/motioneye/boardctl.py", line 23, in <module>
File "/usr/lib/python2.7/site-packages/motioneye/streameyectl.py", line 563, in <module>
File "/usr/lib/python2.7/site-packages/motioneye/streameyectl.py", line 174, in _get_streameye_enabled
File "/usr/lib/python2.7/site-packages/motioneye/config.py", line 294, in get_camera_ids
OSError: [Errno 2] No such file or directory: '/etc/motioneye'
Does this help?
Also in the config file /data/etc/camera-1.conf
there are no lines containing the word 'netcam'... maybe the native Raspberry Pi camera doesn't present itself that way, I'm not sure?
Anecdotally, I'm looking at variants of the audio capture such as arecord
as well as ffmpeg -y -i default:CARD=Device ...
and have had a little success with the latter however the output is noisy and the CPU is high. I'll keep on with that and will contribute back if I get something working.
The script works in my box in terms of generating aac and merging to the recording clip (mp4). However the audio is way ahead of the video after merging into 1 mp4 file. It is like 4 seconds ahead. Could you please help?
Hi there!
I am using audio enabled IP camera RTSP streaming for video recording. i have set motioneye video recording on 1 minute interval. it is recording audio in some of the videos and mostly videos don't have any audio. even no separate audio file is made for videos those don't have merged audios.
Script motioneye-audio.sh for Home Assistant Generic x86-64?
Please tell me where to put the script motioneye-audio.sh in the installed Home Assistant Generic x86-64?
Thank you.
Скрипт motioneye-audio.sh для Home Assistant Generic x86-64?
Подскажите пожалуйста, куда в установленном Home Assistant Generic x86-64 кинуть скрипт motioneye-audio.sh?
Спасибо.
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.
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
I've followed instructions closely, using an Ubuntu 20.04 VM, and am having no luck with this. When I try to run it manually I get 'No such file or directory'.
Hi,
Thanks for all your efforts.
I seem to be to stupid to find out where to put the start command: on_movie_start /data/etc/motioneye-audio.sh start %t %f '%$'
Do i need to add it to the camera-*.conf of each camera?
There i can't find the "In your camera settings, under the Video Device section add the following to Extra Motion Options:"
br
Michael
I am running motioneyeOS (not on docker) on a raspberry pi 3. Currently I am using a usb camera (for testing currently) and attempting to use the built in microphone in the camera.
I started with the instructions in the readme following for meyeos. I created the motioneye-audio.sh file with vim in the /data/etc folder. I set the permissions with chmod +x for the script as mentioned in the instructions. Then I set the camera's options in the ui as this: on_movie_start /data/etc/motioneye-audio.sh start %t %f '%$'
in Extra Motion settings and /data/etc/motioneye-audio.sh stop %t %f '%$'
for Run a Command in file storage. I did not change any text for any of these.
I didn't see any sign that the script was doing anything. I've restarted several times, manually entered the camera id (1) in the motioneye-audio.sh file, tried to run directly from ssh, and followed many of the issues in github and the home assistant forum.
Running the command alone with the camera id specified I get the /etc/motioneye not found. I am running on motioneyeos so im not sure why it's looking there. It's actually in /data/etc/
Should I install docker with motioneye? Does this work on motioneyeos? Thanks!
Sorry, I'm New. I would like to use:
"ReSpeaker 2-Mic Pi HAT V1.0 for Raspberry Pi Zero and Zero W, Raspberry Pi B+, Raspberry Pi 2B and 3B"
for MotionEyeAudio, is it easy possible?
I found on Youtube "Raspberry Pi Zero W Surveillance Camera" from "ExplainingComputers" that looks easy to use, but without audio, can you help me?
Please tell me how to implement this in adon motioneye homeassistant (https://github.com/hassio-addons/addon-motioneye)
Thank you.
https://i.imgur.com/GFdbNgf.png
https://i.imgur.com/uIH8Qe9.png
It's creating a separate audio file with the same name as the mp4.
Hi, first great job!
I am using now docker motioneye works well!
motionEye Version | 0.43.1b1
Motion Version | 4.6.0
Python 3.11.6
Could you update motioneye-audio.sh to Python 3?
I tried using 2to3 and chatGPT but no lucky...
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.