OpenWrt Forum Archive

Topic: mjpg-streamer webcam audio and garage door

The content of this topic has been archived on 12 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

First off, thanks to the developers, I could install openwrt on my TP-Link as soon as I got it.

Then I put the router in my garage and connected a Teensy 2.0 to my garage door opener. That was a few years ago. Just this month I've seen several posts on smartphone-controlled garage door openers. I wonder if the code I'm using is worth publishing? Anyone interested in testing this on more garage door openers?

1. small dev board + transistor + code running on the router + custom android app = remote control of the door. Already done for my Genie Opener, but needs testing on more openers.

2. USB webcam = security monitor using mjpg-streamer. Already available in openwrt.

New features I'm working on:

3. Add audio to mjpg-streamer

4. Add a plugin to mjpg-streamer to talk to a generic CDC-ACM dev board, include sketches for Arduino, Teensy/AVR, TI Launchpad. Remote control of the door is then possible from a web page.

5. Publish the android app, it does better at handling all the steps automatically. Turn on wifi, wait for wifi to connect, send the HTTP request, retry if it fails. (For approaching the garage door from outside wifi range, tell the app to open the door even before wifi is available and it does the rest.)

6. Make the plugin upload time-lapse video from the camera (low CPU load). Encrypt the video, then upload it to Google Drive, Dropbox, Github, ... Add support to the android app to decrypt and view the video.

7. Make the plugin automatically find the garage door in the video and detect its position (open, closed, partly open, ...)


Some of the posts I've seen on the subject:

http://postscapes.com/wifi-garage-door-opener - I like it for all the different options

http://coreygilmore.io/portal/ - I like the complete feature set

Hello there!
I'm curious if you've added audio to mjpg-streamer already and if you have..would share your knowledge. Thank you.

+1 for the mjpg-streamer audio feature.

I used alsa to get the audio stream from my Microsoft HD5000 webcam:

ssh root@openwrt_ip_address -p 22 arecord -f cd | aplay -f cd

note: you also need alsa installed on the receiving side (ex.: your linux computer),
you have to enter openwrt root password each time you launch this command.

If you want to hear it from the internet, open tcp 22 port of your router.

You can adjust microphone volume level by using 'alsamixer' command + F4 (Gui in the shell).

   opkg update
   opkg install kmod-sound-core
   opkg install kmod-usb-audio
   opkg install alsa-utils
   opkg install alsa-lib

There is no other easy way to stream audio from your webcam sad

(Last edited by pilovis on 8 Nov 2014, 14:45)

Thanks for the reply. I was just curious cause dch24 have posed he's working on this audio feature and it would be great to stream both video and audio using only mjpg-streamer. I mean streaming audio and video using only a browser would solve problems like having linux on the receiving side. At least what you're saying is a way, but not that convenient - depending on the project i guess..

3. Add audio to mjpg-streamer

I also did some experiments with audio, too. Under attitude adjustment, probably tools became more handy since.
First thing I learned from teh internetz is that MJPEG is not a container format, so no possibility to embed a synchronized audio stream into it by nature. (As far as I remember the creator of the MJPEG format wrote something like that.)
My solution covered sending an independent audio (mp2 or mp3) stream by ffserver + ffmpeg, and playing it for example by winamp or whatever client in reach. It was pretty unstable, most probably because CPUs in routers lack floating point capability, so audio compression generated high load. So it is definitely beyond the limit of common openwrt hardware.

A possible way out could be using a .h264 capable webcam. (.h264 IS a container format you can embed synchronized audio into.) However - as I understood - .h264 is not yet a rock solid standard, different webcam vendors have different vision of it. There is at least an example on the internet, utilizing a logitech c920 webcam as a video+audio streaming source for openwrt. However please not that such a webcam is relatively pricey.
Instead of investing into an expensive webcam (which may be a dead end in tecnology) I'd pay a comparable sum for a raspberry instead, while keeping the old webcam. But again, it is not a rational investment, "a lot" of money for nothing (additional audio).


7. Make the plugin automatically find the garage door in the video and detect its position (open, closed, partly open, ...)

Just an idea. Put some reflective material (which can be easily detected by some software) at the bottom of the garage door. It should most probably work in any conditions, so I assume you need a fixed or smartly driven light source, too. The least annoying for humans may be an IR light. Teh internetz is full of webcam hacks, where the IR filter gets removed.

Put together the puzzle and have a good luck. smile

hurjup wrote:

A possible way out could be using a .h264 capable webcam.

Is there proper support for h264 in openwrt?
AFAIK no.

Maybe we could cerate a new app like mjpg-stream to solve the audio stream.

The discussion might have continued from here.