From 4d232537e5484761aa20c21344a116f4c28e3274 Mon Sep 17 00:00:00 2001 From: Skylar Grant Date: Sun, 14 Jul 2024 15:04:45 +0000 Subject: [PATCH] Update Scanner AV Streaming on VM in Unraid --- Scanner-AV-Streaming-on-VM-in-Unraid.md | 30 +++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/Scanner-AV-Streaming-on-VM-in-Unraid.md b/Scanner-AV-Streaming-on-VM-in-Unraid.md index 0294d7c..b30548c 100644 --- a/Scanner-AV-Streaming-on-VM-in-Unraid.md +++ b/Scanner-AV-Streaming-on-VM-in-Unraid.md @@ -35,7 +35,9 @@ sudo apt update && sudo apt upgrade -y sudo apt install ffmpeg 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 +sudo mkdir /usr/local/share/mediamtx 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: ``` @@ -44,7 +46,35 @@ paths: 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 ``` +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**: 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`.