Sign inSign up

bardiir/ffmpeg-srtla

By bardiir

Updated almost 3 years ago

Minimal FFmpeg Docker image built on Alpine Linux including SRT /w Link Aggregation

Image
0

10K+

bardiir/ffmpeg-srtla repository overview

Current FFmpeg version: 6.0

The SRT Library in this build is made from BELABOX/srt instead of the upstream srt library making it more robust towards out-of-line Paket receiving which is an unavoidable byproduct of Link Aggregation. This is mainly made to be used with bardiir/srtla_send and bardiir/srtla_rec to create a robust stream ingestion server for mobile streaming to Twitch/Youtube or other RTMP ingestion Sites using multiple uplinks to increase bandwidth and stability for the stream.

Usage

This container is mostly meant to be used as a Proxy between a set stream and twitch.tv like this:

docker run bardiir/ffmpeg-srt -i "srt://:1234?mode=listener&transtype=live&latency=3000000&ffs=128000&rcvbuf=100058624" -c copy -f flv "rtmp://live-cdg.twitch.tv/app/yourStreamKey"

See https://obsproject.com/wiki/Streaming-With-SRT-Or-RIST-Protocols for further information. You should also replace live-cdg.twitch.tv with the appropriate stream ingest server for your region: https://help.twitch.tv/s/twitch-ingest-recommendation

Example for full SRTLA Ingestion Setup

You will need the following hardware on your person for a (mobile) srtla streaming setup:

  • an srt source (camera & mini-pc or camera that can send srt directly)
  • a possibility to execute the bardiir/srtla_send docker container
  • at least one uplink modem

And you will need a server that has a stable backhaul connection to the RTMP destination somewhere at home or in a datacenter.

We’re going to start setting this up backwards starting with the receiving/rtmp proxy end.

On the receiving backhaul server

The first thing to run is the proxy as seen above:

docker run -d bardiir/ffmpeg-srt -i "srt://:1234?mode=listener&transtype=live&latency=3000000&ffs=128000&rcvbuf=100058624" -c copy -f flv "rtmp://live-cdg.twitch.tv/app/yourStreamKey"

This part of the setup will listen to port 1234 and transmit everything received there to the twitch channel configured. You might need to tinker with the Settings a bit depending on your situation. Let me know if you got a better example setup that works for you.

Also needed on the backhaul server is going to be the srtla receiver for the Link Aggregation:

docker run -d bardiir/srtla_rec 5000 127.0.0.1 1234

This will receive SRTLA Data on Port 5000 (which you need to open/forward in your firewall to the server) and then send it to the ffmpeg RTMP proxy on port 1234.

On your mobile setup

On your mobile routing computer you will need to run the following command. This assumes two mobile modems with the mobile router having the IPs 192.168.0.2 on the first modem and 192.168.1.2 on the second modem. Make sure to use host network mode to make sure the container can bind to the IPs correctly.

echo 192.168.0.2 > /tmp/srtla_ips
echo 192.168.1.2 >> /tmp/srtla_ips
docker run -d -v /tmp/srtla_ips:/tmp/srtla_ips --network host bardiir/srtla_send 6000 10.0.0.1 5000 /tmp/srtla_ips

You need to replace 10.0.0.1 with the public IP or Hostname of your Backhaul Server. Now your mobile computer will accept any srt stream from OBS, ffmpeg or any other SRT Source on port 6000 and will forward this on all channels configured in the srtla_ips file towards the backhaul server which then will reassemble the packages and forward it.

Other usage

But you can of course also use the container for the usual ffmpeg stuff:

$ docker run bardiir/ffmpeg-srt -i http://files.coconut.co.s3.amazonaws.com/test.mp4 -f webm -c:v libvpx -c:a libvorbis - > test.webm

To encode a local file, you can mount the current path on the Docker host's filesystem as a volume inside the container like this:

$ docker run -v=`pwd`:/tmp/ffmpeg bardiir/ffmpeg-srt -i localfile.mp4 out.webm

You can create an alias so you use the Docker container like if FFmpeg is installed on your computer:

In ~/.bashrc:

alias ffmpeg='docker run -v=`pwd`:/tmp/ffmpeg bardiir/ffmpeg-srt‘

Now we can execute FFmpeg with just:

$ ffmpeg -buildconf

FFmpeg Build Configuration

ffmpeg version 6.0 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12.2.1 (Alpine 12.2.1_git20220924-r10) 20220924
  configuration: --enable-version3 --enable-libsrt --enable-gpl --enable-nonfree --enable-small --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libvpx --enable-libtheora --enable-libvorbis --enable-libopus --enable-libass --enable-libwebp --enable-librtmp --enable-postproc --enable-libfreetype --enable-openssl --disable-debug
  libavutil      58.  2.100 / 58.  2.100
  libavcodec     60.  3.100 / 60.  3.100
  libavformat    60.  3.100 / 60.  3.100
  libavdevice    60.  1.100 / 60.  1.100
  libavfilter     9.  3.100 /  9.  3.100
  libswscale      7.  1.100 /  7.  1.100
  libswresample   4. 10.100 /  4. 10.100
  libpostproc    57.  1.100 / 57.  1.100

  configuration:
    --enable-version3
    --enable-libsrt
    --enable-gpl
    --enable-nonfree
    --enable-small
    --enable-libmp3lame
    --enable-libx264
    --enable-libx265
    --enable-libvpx
    --enable-libtheora
    --enable-libvorbis
    --enable-libopus
    --enable-libass
    --enable-libwebp
    --enable-librtmp
    --enable-postproc
    --enable-libfreetype
    --enable-openssl
    --disable-debug

Tag summary

Content type

Image

Digest

sha256:8dd414018

Size

75.6 MB

Last updated

almost 3 years ago

docker pull bardiir/ffmpeg-srtla