Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Video with audio #105

Open
MrTinkerman opened this issue Jan 5, 2016 · 38 comments
Open

Feature request: Video with audio #105

MrTinkerman opened this issue Jan 5, 2016 · 38 comments

Comments

@MrTinkerman
Copy link

Hi,

I tried MotionEyeOS on a Raspberry Pi2 and it is really all one would want in a surveillance system !
Very nice, easy setup, clean, all the right options, rtsp and webhook support, awesome :)

One thing thouh, the recorded video is without audio :(
I looked into Zoneminder and it also has no audio recording. Is this difficult to implement ?

Anyway, I hope MotionEyeOS could support video with audio at some point.

Thanks for all the great work so far :)

@MrTinkerman
Copy link
Author

I see the audio support is in the roadmap, among other cool features.

I hope you find the time to implement all this.

Thanks

@ccrisan
Copy link
Collaborator

ccrisan commented Jan 6, 2016

Audio support will at least be coming in its "live" form (i.e. no recording support). Live audio could be implementing without touching motion's source code and will take advantage of the HTML5 web apis.

@zettam
Copy link

zettam commented Apr 1, 2016

Any updates with this? When should we expect this?

@ccrisan
Copy link
Collaborator

ccrisan commented Apr 1, 2016

Not any time soon as I'm caught with other stuff these days. Sorry.

@aplocher
Copy link

Hello, don't meant to be a pest but I was wondering if there was any updates on this? Quite frankly, I couldn't care less about audio during recording - just live streams mainly. Is this possible?

I'm prototyping a baby monitor, and so far after trying Raspbian with VLC, FFMPEG, etc - this is my favorite ... except for that one little (or big) feature that I need.

Thank you!

@danielhoherd
Copy link

danielhoherd commented Dec 18, 2016

Having audio play over the stream would be awesome. This could be a fantastic baby cam if that feature was added.

If there's a branch or any work being done, or if somebody can point me in the right direction to add audio support I'll take a crack at it.

@ccrisan
Copy link
Collaborator

ccrisan commented Dec 18, 2016

There's no audio support at all and it is very unlikely this could ever happen, given that it has to be implemented in motion first.

@czarina
Copy link

czarina commented Jan 8, 2017

I've been searching everywhere for a system like motioneyeos, but that supports audio streaming - I'm at my wit's end! How difficult would it be for me to try to add audio support to motioneyeos myself? Does anyone know of other libraries like motion but that include audio support?

@ccrisan
Copy link
Collaborator

ccrisan commented Jan 8, 2017

It might be the project of your life, but you could try implementing it. You'll need to:

  1. implement audio capturing support in motion
  2. rewrite motion to support h264 streaming instead of (or along with) mjpg
  3. rewrite motionEye so that it uses h264 instead of mjpg internally
  4. rewrite motionEye's UI streaming part so that it uses h264
  5. test everything and create pull requests

@ryny24
Copy link

ryny24 commented Jan 25, 2017

This os is amazing, but audio is a requirement. I'll keep an eye on this thread..

@buzink
Copy link

buzink commented Feb 5, 2017

Could you not just do something like ffmpeg -f alsa -ac 1 -i hw:1 -ar 44100 -f mpegts udp://10.255.11.53:1234 or avconv -f alsa -ac 1 -re -i hw:0,0 -acodec libmp3lame -ab 32k -f rtp rtp://192.168.178.51:1234?

@buzink
Copy link

buzink commented Feb 12, 2017

@ccrisan Is it not as simple as

  1. compiling ffmpeg with alsa and mp3 support
  2. starting command ffmpeg -f alsa -ac 1 -re -i hw:0,0 -acodec libmp3lame -ab 32k -f rtp rtp://192.168.178.51:1234
  3. embedding rtp://192.168.178.51:1234 in a html5 audioplayer in the html page?

This will not create a combined video/audio stream, but it will provide both video and audio streams and the ability to play them at the same time.

@ccrisan
Copy link
Collaborator

ccrisan commented Feb 13, 2017

That would capture audio in (almost) real time, which could be useful for some, but most will complain about not having it embedded in the recorded movies.

@jasaw
Copy link
Collaborator

jasaw commented Aug 23, 2017

I think audio can be added in live stream or recorded movie by using motion extpipe to ffmpeg. From ffmpeg command, you can easily stream the rtsp output to anywhere you like.

@jasaw
Copy link
Collaborator

jasaw commented Aug 23, 2017

I haven't got time to try this out yet, but here's what I would do based on my experience from my own baby monitor project from 3 years ago.

  1. Enable alsa audio driver and audio tools (alsamixer, arecord, ...) in MotionEyeOS.
  2. Patch MotionEye to allow extpipe. It's a 2 liner patch.
  3. Enable AAC encoder in MotionEyeOS. Last time I used faac-1.28.
  4. Patch ffmpeg to reduce max-interleave-delta, otherwise audio and video eventually drifts too far apart and loses sync. I had to patch it because the command line option didn't work, not sure if it has been fixed by now.
  5. Add to ffmpeg configure options: --enable-libfaac
  6. Once compiled everything, it's time to play with motion's extpipe. Something like this extpipe should encode video and audio into audio video interleaved stream:
    ffmpeg -fflags +nobuffer -re -y -f rawvideo -pix_fmt yuv420p -video_size %wx%h -framerate %fps -i pipe:0 -fflags +nobuffer -re -f alsa -ar 16000 -ac 2 -i hw:1,0 -map 0:0 -map 1:0 -c:v h264_omx -profile:v high -b:v 2000000 -c:a aac -b:a 16k -ac 1 -f rtsp -metadata title=BabyMotionEye rtsp://0.0.0.0:554. To record into movie instead of RTSP stream, replace -f rtsp -metadata title=BabyMotionEye rtsp://0.0.0.0:554 with -f mp4 %f.mp4 or -f matroska %f.mkv.
  7. Disable motion's pre-capture and motion gap as they will cause havoc to the video stream.
  8. For streaming, I used RTSP and RTMP protocol for low latency and best overall playback support from web browsers and mobile devices.
  9. Install crtmpserver on MotionEyeOS to convert RTSP to RTMP if you want RTMP.
  10. Patch MotionEye to serve the video audio interleaved stream.

@LTechik
Copy link

LTechik commented Sep 5, 2017

@jasaw have u tried it yet ?
All my tries to get video and sound simutaniously on logitech usb camera with integrated mic ended bad, best option for that was vlc or u4vl, but both options lack stuff motioneye does.

@jasaw
Copy link
Collaborator

jasaw commented Sep 5, 2017

@LTechik Sorry no, I haven't got any time to try this. I already have my home made baby camera from 3 years ago, so this is really low priority for me.

I wonder whether MotionEye(OS) really the right place to start if you want a baby monitor. Motion(Eye(OS)) really is geared towards surveillance, which is quite different from a baby monitor. I did a thorough comparison 3 years ago, and concluded that motion software is not the best choice for a baby monitor. I ended up with raspivid + ffmpeg + nginx + crtmpserver. What it lacked was a nice web interface.

Edit: The baby monitor bit was in response to someone mentioning baby monitor in earlier post.

@LTechik
Copy link

LTechik commented Sep 6, 2017

I got you, does ur baby monitor works with logitech cams with build in mic ?
Thanks for your answer !

@jasaw
Copy link
Collaborator

jasaw commented Sep 6, 2017

@LTechik I've only used the Pi camera. If you want to use a different camera, try changing the ffmpeg command to use the USB camera as video input. More info on how to use ffmpeg with USB camera here. Same thing for audio.

@jordanwilliams1
Copy link

jordanwilliams1 commented Jul 2, 2019

3 Years & a half since this has feature quest and it's still not added :( Damm I really wanted audio for my camera.

@jasaw
Copy link
Collaborator

jasaw commented Jul 2, 2019

There's audio support in Fast Network Camera mode with RTSP stream. See #1764
Keep in mind that the audio part is not well tested. I suspect there's a problem with audio and video drift, but I haven't got time to fully test it.

To record videos with audio, you'll have to rely on motion's extpipe option and use ffmpeg to add in the audio channel, as I have mentioned in my earlier post. Alternatively, you could create a feature request in motion project and hope for the best. 3rd alternative is to implement audio encoding support in motion and do a pull-request to get it merged upstream.

@rapattack55
Copy link

Definately would like to see audio in motioneyesos....didnt realise motion didnt have it bummer. I really need it so i can catch who is making all the noise at my apartment block not just see them

@jasaw
Copy link
Collaborator

jasaw commented Jan 20, 2020

@rapattack55 Motion developers are reluctant to support audio recording because of privacy laws in certain countries. Maybe motion developers will change their mind when there's enough people requesting for audio feature?

@rapattack55
Copy link

rapattack55 commented Jan 28, 2020 via email

@sergey-zhuravel
Copy link

3 years have passed, and they did not add audio recording :(

@starbasessd
Copy link

starbasessd commented Feb 12, 2020 via email

@grtessman
Copy link

I just installed motioneye... My search for why sound/microphone support wasn't working led me here. Would be a great feature to add!

@DeadEnded
Copy link

I know audio in MotionEye can be a hot topic. I have been using MotionEye for 24/7 recording and it has been fantastic! As I wanted my recordings to have audio, I was able to write up a script to do it.

I am a novice at best, and it probably is not the cleanest or best way to do it... but it works. It basically kicks off an audio recording whenever a video recording starts (yes an extra process). Then when video stops, it stops audio recording and then merges the two together.

I have not testing it beyond my single camera model doing 24/7 recording in 60 minute segments... but it should work for others as well. I don't want to break any rules or anything, so I will first ask if there is any issue with me posting a link here to it?

If there is not a problem with posting a link to it I'm happy to share it... again its a novice's work - but help to improve it will always be welcome (PR's)!

Cheers!
DeadEnd

@MacDos
Copy link

MacDos commented May 31, 2020

Has someone tried the Modul "ReSpeaker 2-Mic Pi HAT V1.0 for Raspberry Pi Zero and Zero W"
Sorry, I have no software skills, but perhaps someone could use it?

@Tylersuard
Copy link

@DeadEnded I'm interested! Can you share the script please?

@DeadEnded
Copy link

https://github.com/DeadEnded/MotionEyeAudio

I am no longer using MotionEye, but can merge any fixes that others find... or you can fork it.
Good Luck!

@rapattack55
Copy link

rapattack55 commented Jan 26, 2021 via email

@ghost
Copy link

ghost commented Feb 10, 2021

I hope this gets implemented into the core of motion eye os and works out of the box.

@DeadEnded
Copy link

Unlikely.
MotionEye is based on the motion daemon.
It has been stated multiple times that until audio is added to motion, MotionEye won't have it.
What I created was a hack at best... it has many flaws and is a workaround.
I have since moved on to another NVR software that does support audio out of the box.

@0BackDoor1
Copy link

Discovered Meye about a week ago, installed and it's very amazing project, works very well, until "hey, wait! where is audio settings?" and then the bad news, even if rtsp has audio info, meye simply doesn't use it... what's the meaning of a NVR system without audio???

@starbasessd
Copy link

@0BackDoor1
N Network
V VIDEO
R Recorder

@0BackDoor1
Copy link

0BackDoor1 commented May 16, 2021

@0BackDoor1
N Network
V VIDEO
R Recorder

oh thanks man! I never read meaning of "video" word before, I'm going to write to youtube's support because on their VIDEO they put also AUDIO, that's crazy thing!
I think there is a reason if this issue still "open" since 2016, isn't it? I'm not the only one.

@starbasessd
Copy link

@0BackDoor1
It's still open because it's a feature request.
It's been requested multiple times in multiple threads.
I was accepted as a support person last year, and have been slowly going through the open tickets, closing ones completed, trying to close those that haven't had any follow ups, and labeling the ones kept open to make it easier to find active issues, enhancements and feature requests for anyone who wants to contribute.
The owner of the project hasn't put much effort into it maybe because he doesn't see any priority for it. There needs to be some upstream support in motion (which he contributes, but is not the owner) before motionEye will support it. Look at his first responses to this thread.
Are you also going through Motion-Project's support issues and 'bumping' them to get audio support?
He has made it abundantly clear that if you want to implement it, feel free. Motion and motionEye are both open source, and will accept patches, fixes, new features.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests