break out mds

This commit is contained in:
Boaz Sender 2025-03-28 13:31:25 -07:00
parent 675b141fc1
commit 5fedab85a8
5 changed files with 226 additions and 108 deletions

52
icecast-darkice.md Normal file
View file

@ -0,0 +1,52 @@
https://dev.to/shilleh/stream-audio-from-raspberry-pi-to-local-computer-1a1c
icecast/darkice
sudo apt install icecast2
sudo apt install darkice
sudo vim /etc/darkice.cfg
```
[general]
duration = 0 # Stream indefinitely
bufferSecs = 5 # Buffer for the input, in seconds
reconnect = yes # Reconnect to the server if disconnected
[input]
device = plughw:1,0 # Your audio capture device
sampleRate = 44100
bitsPerSample = 16 # Bits per sample
channel = 1 # 2 = stereo, 1 = mono
[icecast2-0]
bitrateMode = cbr # Constant bit rate
format = mp3 # Audio format
bitrate = 128 # Bitrate in kbps
server = localhost # Server name or IP
port = 8000 # Port number
password=emergence # Your Icecast password
mountPoint = portal # Mount point to stream to
name = Black Portal # Name of the stream
description = Black Portal Project # Description of the stream
url = http://192.168.0.203 # URL related to the stream
genre = politics # Genre of the stream
public = no # Do not list on public lists
```
sudo vim /lib/systemd/system/owncast.service
[Unit]
Description=Darkice Service
[Service]
User=root
Type=simple
Restart=on-failure
RestartSec=5
WorkingDirectory=/home/grace
ExecStart=/usr/bin/darkice -c /etc/darkice.cfg
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload

13
listener.md Normal file
View file

@ -0,0 +1,13 @@
1. install raspian
2. boot
3. configure default sound card
c
alsamixer
arecord -l
arecord -f cd -D plughw:0,0 | ffmpeg -i - -acodec libmp3lame -ab 128k -ac 1 -f rtp rtp://127.0.0.1:3000
sudo apt install git nginx vim zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

122
nginx-rtmp.md Normal file
View file

@ -0,0 +1,122 @@
1. install raspian
2. boot
3. configure default sound card
c
alsamixer
arecord -l
arecord -f cd -D plughw:0,0 | ffmpeg -i - -acodec libmp3lame -ab 128k -ac 1 -f rtp rtp://127.0.0.1:3000
sudo apt install git nginx vim zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
https://www.digitalocean.com/community/tutorials/how-to-set-up-a-video-streaming-server-using-nginx-rtmp-on-ubuntu-20-04
sudo apt install libnginx-mod-rtmp
sudo vim /etc/nginx/nginx.conf
```
rtmp {
server {
listen 1935;
chunk_size 4096;
allow publish 127.0.0.1;
deny publish all;
application live {
live on;
record off;
hls on;
hls_path /var/www/html/portal/hls;
hls_fragment 3;
hls_playlist_length 60;
dash on;
dash_path /var/www/html/portal/dash;
}
}
}
```
sudo vim /etc/nginx/sites-available/portal.conf
```
server {
listen 8080;
server_name localhost;
# rtmp stat
location /stat {
rtmp_stat all;
rtmp_stat_stylesheet stat.xsl;
}
location /stat.xsl {
root /var/www/html/portal;
}
# rtmp control
location /control {
rtmp_control all;
}
}
server {
listen 80;
location / {
add_header Access-Control-Allow-Origin *;
root /var/www/html/portal;
}
}
types {
application/dash+xml mpd;
}
```
sudo ln -s /etc/nginx/sites-available/portal.conf /etc/nginx/sites-enabled/portal.conf
sudo mkdir /var/www/html/portal
sudo chown -R $USER:$USER /var/www/html/portal
sudo vim /var/www/html/portal/stat.xsl
paste in https://github.com/arut/nginx-rtmp-module/blob/master/stat.xsl
https://github.com/arut/nginx-rtmp-module/blob/master/stat.xsl
sudo systemctl reload nginx
sudo apt install ffmpeg
vim ~/portal.sh
arecord -f cd -D plughw:3,0 | ffmpeg -i - -acodec aac -ab 128k -ac 1 -f flv rtmp://localhost/live/portal
chmod u+x ~/portal.sh
sudo vim /lib/systemd/system/portal.service
```
[Unit]
Description=portal
After=network.target
[Service]
Environment=NODE_ENV=production
Type=simple
User=grace
WorkingDirectory=/home/grace/
ExecStart=/home/grace/portal.sh
Restart=on-failure
[Install]
WantedBy=multi-user.target
```
sudo systemctl daemon-reload && sudo systemctl enable --now portal && sudo systemctl start portal

30
owncast.md Normal file
View file

@ -0,0 +1,30 @@
owncast
curl -s https://owncast.online/install.sh | bash
cd owncast
./owncast
sudo apt install v4l2loopback-dkms
v4l2-ctl --list-devices
ffmpeg -f alsa -ac 2 -i hw:1,0 -thread_queue_size 64 -f v4l2 -framerate 60 -video_size 1280x720 -input_format yuyv422 -i /dev/video2 -c:v libx264 -preset veryfast -b:v 1984k -maxrate 1984k -bufsize 3968k -vf "format=yuv420p" -g 60 -c:a aac -b:a 128k -ar 44100 -f flv rtmp://localhost/live/Kw12mhxBlBQMsbMZUqNk6qDRgl!
ffmpeg -input_format h264 -f video4linux2 -s 1920x1080 -i /dev/video0 -f lavfi -i anullsrc -c:v copy -c:a aac -shortest -f flv rtmp://localhost/live/Kw12mhxBlBQMsbMZUqNk6qDRgl!
sudo vim /lib/systemd/system/owncast.service
[Unit]
Description=Owncast Service
[Service]
Type=simple
Restart=on-failure
RestartSec=5
WorkingDirectory=/home/grace/owncast
ExecStart=/var/www/owncast/owncast
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl start owncast

117
readme.md
View file

@ -1,113 +1,14 @@
1. install raspian
2. boot
3. configure default sound card
# Black Portal Detroit
https://blackportaldetroit.com
lsusb
alsamixer
## Broadcaster
user: grace
hostname: portal.local
Running icecast and darkice. See icecast-darkice.md for setup instructions.
arecord -l
arecord -f cd -D plughw:0,0 | ffmpeg -i - -acodec libmp3lame -ab 128k -ac 1 -f rtp rtp://127.0.0.1:3000
sudo apt install git nginx vim
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
## Listener
user: grace
hostname: listener.local
https://www.digitalocean.com/community/tutorials/how-to-set-up-a-video-streaming-server-using-nginx-rtmp-on-ubuntu-20-04
sudo apt install libnginx-mod-rtmp
sudo vim /etc/nginx/nginx.conf
```
rtmp {
server {
listen 1935;
chunk_size 4096;
allow publish 127.0.0.1;
deny publish all;
application live {
live on;
record off;
hls on;
hls_path /var/www/html/portal/hls;
hls_fragment 3;
hls_playlist_length 60;
dash on;
dash_path /var/www/html/portal/dash;
}
}
}
```
sudo nano /etc/nginx/sites-available/portal.conf
```
server {
listen 8080;
server_name localhost;
# rtmp stat
location /stat {
rtmp_stat all;
rtmp_stat_stylesheet stat.xsl;
}
location /stat.xsl {
root /var/www/html/portal;
}
# rtmp control
location /control {
rtmp_control all;
}
}
server {
listen 80;
location / {
add_header Access-Control-Allow-Origin *;
root /var/www/html/portal;
}
}
types {
application/dash+xml mpd;
}
```
sudo ln -s /etc/nginx/sites-available/portal.conf /etc/nginx/sites-enabled/portal.conf
sudo chown -R $USER:$USER /var/www/html/portal
sudo chmod -R 775 /var/www/html/portal
sudo mkdir /var/www/html/portal
sudo systemctl reload nginx
sudo apt install ffmpeg
nano ~/portal.sh
arecord -f cd -D plughw:3,0 | ffmpeg -i - -acodec aac -ab 128k -ac 1 -f flv rtmp://localhost/live/portal
chmod u+x ~/portal.sh
sudo nano /lib/systemd/system/portal.service
```
[Unit]
Description=portal
After=network.target
[Service]
Environment=NODE_ENV=production
Type=simple
User=grace
WorkingDirectory=/home/grace/
ExecStart=/home/grace/portal.sh
Restart=on-failure
[Install]
WantedBy=multi-user.target
```
sudo systemctl daemon-reload && sudo systemctl enable --now portal && sudo systemctl start portal