TCB13, (edited )
@TCB13@lemmy.world avatar

MediaMTX

Going to Mars seems easier and less resource intensive than that thing.

MediaMTX can sort a lot of this for you. Then its just a matter of accessing your feed on vlc.

Here is how you really “just access your feed from VLC” in three easy easy steps:

Step 1. Configure nginx repositories (nginx.org/en/linux_packages.html)

Step 2. Install nginx / nginx-rtmp

Step 3. Edit nginx config to add:


<span style="color:#323232;">rtmp {
</span><span style="color:#323232;">        server {
</span><span style="color:#323232;">                listen 1935;
</span><span style="color:#323232;">                chunk_size 4096;
</span><span style="color:#323232;">                allow publish 127.0.0.1;
</span><span style="color:#323232;">                deny publish all;
</span><span style="color:#323232;">
</span><span style="color:#323232;">                application live {
</span><span style="color:#323232;">                        live on;
</span><span style="color:#323232;">                        exec_pull /usr/bin/ffmpeg -f v4l2 -input_format h264 -video_size 1920x1080 -i /dev/video4 -copyinkf -codec copy -f flv rtmp://127.0.0.1/live/stream;
</span><span style="color:#323232;">                        record off;
</span><span style="color:#323232;">                }
</span><span style="color:#323232;">        }
</span><span style="color:#323232;">}
</span>

A few notes:

  • /dev/video4 is your camera;
  • Some systems (debian) may require this sudo usermod -a -G video www-data to make sure it will work. Because ffmpeg will be launched with the www-data user that doesn’t have access to the video cameras.
  • It will even turn off the camera if nobody is connected;
  • Use ffmpeg -f v4l2 -list_formats all -i /dev/video0 to find what formats your camera supports;
  • Watch the stream from VLC with the url: rtmp://device-ip/live/stream

Enjoy.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • selfhosted@lemmy.world
  • localhost
  • All magazines
  • Loading…
    Loading the web debug toolbar…
    Attempt #