Giter VIP home page Giter VIP logo

video-streaming-over-http's Introduction

video-streaming-over-http

Description

This is a demonstration of video streaming from your webcam to a server, we first encode the input from webcam using FFmpeg with multiple bitrates for adaptive streaming then transfer encoded streams to our EC2 instance with RTMP. NGINX server's endpoint on server awaits for the stream then serves it accordingly. Project also contains a HTML file for the demo to enhance viewing experience with a player, hls.js in our case.

Project uses NGINX and to store and serve the video from an AWS EC2 instance. NGINX RTMP Module is used on the server to configure NGINX.

I had a hard time while working on this, so here is a tutorial for you:

Tutorial

  1. If you want to store the video on a server and make it accessible to Internet, get an instance from any provider you want, make sure required ports (80, 1935) are not blocked by the firewall.

  2. Set the NGINX up by either copy and pasting the commands in config.sh or using the running the config script I have provided on your server.

Restart the nginx server

sudo /usr/local/nginx/sbin/nginx -s stop sudo /usr/local/nginx/sbin/nginx

  1. Open a folder under /mnt called /hls and replace the NGINX configuration file with my nginx.conf file. You can use the defaults or change the stream parameters as you wish. After this step, your server is ready to go, video segments will be stored under /mnt/hls and your HTTP document root is: home/ubuntu/public/public_html and NGINX serves from port 80

  2. Encode the video using FFmpeg. Set the parameters (IP and ffmpeg path) in the script and run the encodeAndTransfer.sh script on your laptop, make sure input device numbers match if you get an input/output error. You can see device numbers with ffmpeg --list-devices command.

  3. Your segments are being stored in mnt/hls/ and you can request your playlist from any browser with /hls/stream.m3u8 endpoint.

  4. Optionally you can have an index.html file with a video player for a better experience, I used hls.js, you can use my index.html by changing the hls.loadSource('http://your_ip/hls/stream.m3u8'); line with your IP address and putting the file in home/ubuntu/public/public_html.

  5. ENJOY YOUR STREAM!

video-streaming-over-http's People

Contributors

yigiterinc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

video-streaming-over-http's Issues

nginx: [emerg] unknown directive "rtmp" in /etc/nginx/nginx.conf:7

The configuration file throws an error:

โ— nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2021-03-11 21:52:48 UTC; 11s ago
Docs: man:nginx(8)
Process: 6024 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)

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.