Has two components
- Encoder: Listens on port 5050 for video stream, and encodes it to live folder using HLS encoding, with adaptive bit rate. (Creates video chunk .ts files of 1 second each.)
- CDN Simulator: Hosts the live folder on port 8080. Ideally the files inside the live folder needs to be uploaded to S3, which will be frontended by a CDN like CloudFront or Akamai. (The .m3u8 files are re-generated every second, hence the CDN must be configured, not to cache them).
- Publisher: Run it from a laptop which has direct access to the camera. It publishes the video stream to the server(Encoder), on port 5050
cd server
./encode.sh
./simulate-cdn.sh
cd ../camera
./publish.sh
(Sequencing matters)
FFmpeg encoding on CPU slows down, as the number of parallel streams for adaptive bit rate increases. Hardware acceleration is required to achieve near real-time performance.
- Spin off an AWS G3 Nvidia GPU Instance (These are very costly instances, so run them only when the live stream is on)
- Install Nvidia drivers
- Install CUDA
- Compile FFmpeg with CUDA
(Refer Dockerfile)
Safari on Mac & iOS shows a "Live Broadcast" indicator in the player