Docker image for RTMP/HLS/DASH server running on nginx-1.18.0 with nginx-rtmp-module-1.2.1
This docker image can be used to create an RTMP server to serv HLS, DASH and RTMP at a time with nginx and nginx-rtmp-module, built from the current latest sources of the NGINX stable branch.
This image exposes port 1935 for RTMP steams and 8080 for HLS and DASH streams.
A fragment(HLS & DASH) length is set to 2 seconds, and the total length is set to 16 seconds in the manifest (m3u8/mpd).
Refer to /etc/nginx/nginx.conf for details.
- Run the following:
docker run -d -p 1935:1935 -p 8080:8080 --name nginx-media-server woonizzooni/nginx-media-server:latest
-
FFMPEG
- Download and Install
- Capture Desktop or Camera and Publish RTMP stream
ffmpeg -f avfoundation -video_device_index 1 -audio_device_index 0 -i "default" \ -c:v libx264 -deinterlace -r 24 -s 1280x720 -b:v 1200k \ -minrate 1200k -maxrate 1200k -bufsize 1200k -pix_fmt yuv420p \ -profile:v baseline -x264-params keyint=48:keyint_min=24:scenecut=0:bframes=0 \ -c:a libfdk_aac -b:a 128k -ar 44100 -f flv rtmp://localhost:1935/live/test
ffmpeg -f gdigrab -i desktop \ -c:v libx264 -deinterlace -r 24 -s 1280x720 \ -b:v 2400k -minrate 2400k -maxrate 2400k -bufsize 2400k -pix_fmt yuv420p \ -profile:v baseline -x264-params keyint=48:keyint_min=24:scenecut=0:bframes=0 \ -f flv rtmp://localhost:1935/live/test
- Publish RTMP stream with MP4
ffmpeg -nostdin -re -stream_loop -1 -i ~/Movies/sample_h264_aac.mp4 \ -c:v copy -c:a copy \ -f flv "rtmp://localhost:1935/live/test"
-
OBS Studio
- Download and Install
- Set the stream settings as follows:
Settings > Stream Service: Custom... Server: rtmp://localhost:1935/live Stream Key: test
- Click 'Start Streaming'
-
PlaybackURL
HLS : http://localhost:8080/hls/test/index.m3u8 MPEG-DASH : http://localhost:8080/dash/test/index.mpd
-
FFPROBE
ffplay http://localhost:8080/hls/test/index.m3u8
-
VLC or Universal MediaPlayer that supported HLS and MPEG-DASH
-
List of Players
-
Open network stream menu and enter the HLS playback url (ex. https://localhost:8080/hls/test/index.m3u8)
-
-
Prerequisite : kubernetes cluster
-
Creating
$ kubectl apply -f ./k8s/namespace.yaml $ kubectl apply -f ./k8s/service.yaml $ kubectl apply -f ./k8s/deployment.yaml
-
Deleting
$ kubectl delete -f ./k8s/deployment.yaml $ kubectl delete -f ./k8s/service.yaml $ kubectl delete -f ./k8s/namespace.yaml