with ffmpeg
When testing RTMP connections with ffmpeg or gstreamer I mostly used the nginx-rtmp-module which is of course brilliant !!!
https://bitmovin.com/encoding-service
and their RTMP-examples:
https://github.com/bitmovin/bitmovin-api-sdk-examples
This repository provides examples demonstrating usage of the
Bitmovin API SDKs in different programming languages.
But using this was sometimes a bit unhandy, so I wanted to just do it with a simple `ffmpeg`-cli command.
ffmpeg provides a listener mode for RTMP, so this was simple (after I found out that listening at localhost in my case did not work).
ffmpeg -f flv -listen 1 -i rtmp://127.0.0.1:1935/live/ ...
this worked like a charm for testing with OBS for example.
After I had a good script I wanted to port it to docker and wanted to amke it stable, means not abort after I diconnected with OBS. This is why I used supervisord in this container, as I never before used it but already stumbled upon it a couple of times.
This was a good opportunity to use it for the first time!
- install
ffmpegfrom the staticjohnvansickle.com-ffmpeg-builds - use a bash-script to create a
MPEG-DASH-stream and createthumbnailswithffmpeg - look that it is always running by the use of
supervisord
...
docker build -t riha/rtmp-server-ffmpeg .
or ignore the cache
docker build --no-cache -t riha/rtmp-server-ffmpeg .
docker run -it -p 1935:1935 -v $PWD/out:/output riha/rtmp-server-ffmpeg:latest
- make sure that the out-Folder on the host has a dash- & thumbs-subfolder !
- configure ABR for DASH with a JSON-File -> https://starkandwayne.com/blog/bash-for-loop-over-json-array-using-jq/
- add config params for this server
- RTMP-PORT
- ABR-CONFIG-FILE
- THUMBNAIL-FREQUENCY in seconds
- OUPUT-FOLDER