Coder Social home page Coder Social logo

sanduhrs / rtmp-hls-server Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tareqalqutami/rtmp-hls-server

0.0 0.0 0.0 30 KB

a docker file to create a streaming server that supports RTMP, HLS and DASH content based on nginx and nginx-rtmp-module.

License: MIT License

Shell 68.18% HTML 18.06% Dockerfile 13.77%

rtmp-hls-server's Introduction

RTMP-HLS Docker

Docker image for video streaming server that supports RTMP, HLS, and DASH streams.

Docker Automated build Build Status

Description

This Docker image can be used to create a video streaming server that supports RTMP, HLS, DASH out of the box. It also allows adaptive streaming and custom transcoding of video streams. All modules are built from source on Debian and Alpine Linux base images.

Features

  • The backend is Nginx with nginx-rtmp-module.
  • FFmpeg for transcoding and adaptive streaming.
  • Default settings:
    • RTMP is ON
    • HLS is ON (adaptive, 5 variants)
    • DASH is ON
    • Other Nginx configuration files are also provided to allow for RTMP-only streams or no-FFmpeg transcoding.
  • Statistic page of RTMP streams at http://<server ip>:<server port>/stats.
  • Available web video players (based on video.js and hls.js) at /usr/local/nginx/html/players.

Current Image is built using:

  • Nginx 1.17.5 (compiled from source)
  • Nginx-rtmp-module 1.2.1 (compiled from source)
  • FFmpeg 4.2.1 (compiled from source)

This image was inspired by similar docker images from tiangolo and alfg. It has small build size, adds support for HTTP-based streams and adaptive streaming using FFmpeg.

Usage

To run the server

docker run -d -p 1935:1935 -p 8080:8080 alqutami/rtmp-hls

For Alpine-based Image use:

docker run -d -p 1935:1935 -p 8080:8080 alqutami/rtmp-hls:latest-alpine

To run with custom conf file:

docker run -d -p 1935:1935 -p 8080:8080 -v custom.conf:/etc/nginx/nginx.conf alqutami/rtmp-hls

where custom.conf is the new conf file for Nginx.

To stream to the server

  • Stream live RTMP content to:

    rtmp://<server ip>:1935/live/<stream_key>
    

    where <stream_key> is any stream key you specify.

  • Configure OBS to stream content:
    Go to Settings > Stream, choose the following settings:

    • Service: Custom Streaming Server.
    • Server: rtmp://<server ip>:1935/live.
    • Stream key: anything you want, however provided video players assume stream key is test

To view the stream

  • Using VLC:

    • Go to Media > Open Network Stream.
    • Enter the streaming URL: rtmp://<server ip>:1935/live/<stream-key> Replace <server ip> with the IP of where the server is running, and <stream-key> with the stream key you used when setting up the stream.
    • For HLS and DASH, the URLs are of the forms: http://<server ip>:8080/hls/<stream-key>.m3u8 and http://<server ip>:8080/dash/<stream-key>_src.mpd respectively.
    • Click Play.
  • Using provided web players:
    The provided demo players assume the stream-key is called test and the player is opened in localhost.

    • To play RTMP content (requires Flash): http://localhost:8080/players/rtmp.html
    • To play HLS content: http://localhost:8080/players/hls.html
    • To play HLS content using hls.js library: http://localhost:8080/players/hls_hlsjs.html
    • To play DASH content: http://localhost:8080/players/dash.html
    • To play RTMP and HLS contents on the same page: http://localhost:8080/players/rtmp_hls.html

    Notes:

    • These web players are hardcoded to play stream key "test" at localhost.
    • To change the stream source for these players. Download the html files and modify the src attribute in the video tag in the html file. You can then mount the modified files to the container as follows:
       docker run -d -p 1935:1935 -p 8080:8080 -v custom_players:/usr/local/nginx/html/players alqutami/rtmp-hls
      
      where custom_players is the directory holding the modified html files.

Copyright

Released under MIT license.

More info

rtmp-hls-server's People

Contributors

dunn avatar dv4mp1r3 avatar tareqalqutami avatar v0l 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.