Skip to content
This repository has been archived by the owner on Feb 9, 2024. It is now read-only.

Sample repository demonstrating HLS streaming with nginx.

Notifications You must be signed in to change notification settings

MGTheTrain/nginx-hls-sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

nginx-hls-sample

Table of Contents

Summary

Sample repository demonstrating HLS streaming with nginx

References

Main reference

How to use

Build docker image and run nginx docker container

# Build 
sudo docker build -t nginx-video-streaming:stable .
# Run on Unix systems
sudo docker run -v /dev/shm/hls:/usr/share/nginx/html/hls \
-v $(pwd)/assets:/usr/share/nginx/html \
-p 8080:80 -d nginx-video-streaming:stable

Record new video and audio segments with ffmpeg

# HLS with h264 (video codec) and aac (audio codec) on Unix systems

sudo mkdir -vp /dev/shm/hls
sudo ffmpeg -y -f v4l2 -framerate 30 -i /dev/video0 -f alsa -i hw:0 -c:v libx264 -preset veryfast -tune zerolatency -pix_fmt yuv420p -b:v 1500k -c:a aac -b:a 64k -ar 44100 -f hls -hls_time 1 -hls_list_size 30 -hls_flags delete_segments /dev/shm/hls/live.m3u8

View results

Visit localhost:8080/hls-stream.html in a browser of choice (e.g. Safari, Chrome, Firefox).

About

Sample repository demonstrating HLS streaming with nginx.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published