Update Scanner AV Streaming on VM in Unraid

Skylar Grant 2024-07-14 15:04:45 +00:00
parent 864b4902e9
commit 4d232537e5

@ -35,7 +35,9 @@ sudo apt update && sudo apt upgrade -y
sudo apt install ffmpeg sudo apt install ffmpeg
wget https://github.com/bluenviron/mediamtx/releases/download/v1.8.4/mediamtx_v1.8.4_linux_amd64.tar.gz wget https://github.com/bluenviron/mediamtx/releases/download/v1.8.4/mediamtx_v1.8.4_linux_amd64.tar.gz
tar -xvf mediamtx_v1.8.4_linux_amd64.tar.gz tar -xvf mediamtx_v1.8.4_linux_amd64.tar.gz
sudo mkdir /usr/local/share/mediamtx
sudo mv mediamtx /usr/local/bin/ sudo mv mediamtx /usr/local/bin/
sudo mv mediamtx.yml /usr/local/share/mediamtx/
``` ```
2. Edit mediamtx.yml and remove the `paths:` at the end, replacing with: 2. Edit mediamtx.yml and remove the `paths:` at the end, replacing with:
``` ```
@ -44,7 +46,35 @@ paths:
source: publisher source: publisher
runOnInit: ffmpeg -f v4l2 -i /dev/video0 -f alsa -i hw:0 -c:v libx264 -preset veryfast -tune zerolatency -pix_fmt yuv420p -f rtsp rtsp://localhost:8554/scanner runOnInit: ffmpeg -f v4l2 -i /dev/video0 -f alsa -i hw:0 -c:v libx264 -preset veryfast -tune zerolatency -pix_fmt yuv420p -f rtsp rtsp://localhost:8554/scanner
``` ```
3. Run it with `mediamtx /usr/local/share/mediamtx/mediamtx.yml` and test, adjusting configuration as needed.
## Daemonize the Stream
1. Create a service file: `sudo nano /etc/systemd/system/mediamtx.service`
2. Place the following in the file:
```ini
[Unit]
Description=MediaMTX Streaming Service
After=network.target
[Service]
ExecStart=mediamtx /usr/local/share/mediamtx.yml
Restart=always
User=nobody
Group=nogroup
WorkingDirectory=/usr/local/bin/
[Install]
WantedBy=multi-user.target
```
3. Reload `systemd`: `sudo systemctl daemon-reload`
4. Enable the service at boot: `sudo systemctl enable mediamtx`
5. Start the service now: `sudo service mediamtx start`
6. Check on the status: `sudo service mediamtx status`
7. Get more log info: `journalctl -u mediamtx`
## [Coming Soon] Accessing the Stream
# `mediamtx` and `ffmpeg` Configuration Information
### Paths Section: ### Paths Section:
- **paths**: This section contains the definitions for different streaming paths. - **paths**: This section contains the definitions for different streaming paths.
- **scanner**: This is the name of the path. You can name it whatever makes sense for your use case, such as `scanner`, `camera`, or `stream`. - **scanner**: This is the name of the path. You can name it whatever makes sense for your use case, such as `scanner`, `camera`, or `stream`.