Skip to content

woonizzooni/nginx-media-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nginx-media-server

Docker image for RTMP/HLS/DASH server running on nginx-1.18.0 with nginx-rtmp-module-1.2.1

Introduction

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.

Dockefile links

Reference Links

Configurations

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.

How to use

Running NGINX-MEDIA-SERVER

  • Run the following:
docker run -d -p 1935:1935 -p 8080:8080 --name nginx-media-server woonizzooni/nginx-media-server:latest

Publishing Stream with

  • 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'

Playing/Watching Stream with

Deploying a Containerized nginx-media-server application on Kubernetes

  • 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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published