Skip to content

Instantly share code, notes, and snippets.

@jonathanslenders
Last active May 1, 2025 20:23
Show Gist options
  • Select an option

  • Save jonathanslenders/aa771c2abaf7652848872b884951ebb2 to your computer and use it in GitHub Desktop.

Select an option

Save jonathanslenders/aa771c2abaf7652848872b884951ebb2 to your computer and use it in GitHub Desktop.
babymonitor.service
# 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