This document explains the process flow for uploading a video, creating an HLS stream using Docker, and managing file paths and keys using MinIO and Redis.
-
Upload Video
- The initial step involves uploading a video to the MinIO server.
-
MinIO Storage
- The uploaded video is stored in MinIO, an object storage service.
-
Redis Hash Table
- MinIO stores the file path of the uploaded video in a Redis hash table. This allows for easy retrieval of file paths.
-
Subscriber Retrieval
- A subscriber retrieves the file path from the Redis hash table. This subscriber is responsible for initiating the HLS stream creation process.
-
Create HLS Stream Using Docker
- Using the retrieved file path, a Docker container is utilized to create an HLS stream from the uploaded video. This involves segmenting the video into smaller chunks suitable for streaming.
-
Upload HLS Folder to MinIO
- The resulting HLS stream, which is a folder containing the segmented video files, is uploaded back to MinIO for storage.
-
Delete Key from Redis
- Once the HLS stream creation is completed, the associated key is deleted from Redis to maintain a clean and updated hash table.
-
Clone the repository
-
Open the terminal and navigate to the project directory and run the following command
docker compose up
- Open another terminal and run the following command
bun install
- Now run the following command
bun index.ts
- Open another terminal and run the following command
bun subscriber.ts
- Open the terminal and navigate to the project directory and run the following command
curl --request POST \
--url http://localhost:8080/upload \
--header 'content-type: multipart/form-data' \
--form file=@file
- Open a browser and navigate to http://localhost:9001 and you will be prompted to enter minio credentials
- username: minio
- password: minio123
- your video will be uploaded to minio and the subscriber will create an HLS stream and upload it back to minio