Giter VIP home page Giter VIP logo

nginx-media-server's Introduction

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

nginx-media-server's People

Contributors

woonizzooni avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.