Last active
May 1, 2025 20:23
-
-
Save jonathanslenders/aa771c2abaf7652848872b884951ebb2 to your computer and use it in GitHub Desktop.
babymonitor.service
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Instructions: | |
| # 1. apt install ffmpeg | |
| # 2. Install this file as: /etc/systemd/system/babymonitor.service | |
| # 3. Use `arecord -L` and adjust this file so that it reflects the right audio device (`-i` flag). | |
| # 4. Change User/Group and/or make sure this user is part of the 'audio' group. | |
| # 5. systemctl enable babymonitor | |
| # 6. systemctl start babymonitor | |
| [Unit] | |
| Description=Baby monitor mp3 stream | |
| After=network.target | |
| [Service] | |
| # ExecStart=/usr/bin/ffmpeg -f alsa -i plughw:CARD=C920,DEV=0 -acodec mp3 -b:a 128k -listen 1 -f mp3 -content_type audio/mpeg http://0.0.0.0:8000/baby-monitor.mp3 | |
| ExecStart=/usr/bin/cvlc alsa://hw:C920,0 --sout '#transcode{acodec=mp3,ab=128,channels=2}:http{mux=mp3,dst=:8000/baby-monitor.mp3}' --aout=alsa | |
| Restart=always | |
| User=www-data | |
| Group=www-data | |
| [Install] | |
| WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment