1. install raspian 2. boot 3. configure default sound card lsusb 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 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 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