Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ftp27/GoHLStreamer
Go-based server that streams video content in the HTTP Live Streaming (HLS) format
https://github.com/ftp27/GoHLStreamer
appwrite hls hls-stream
Last synced: 3 months ago
JSON representation
Go-based server that streams video content in the HTTP Live Streaming (HLS) format
- Host: GitHub
- URL: https://github.com/ftp27/GoHLStreamer
- Owner: ftp27
- License: mit
- Created: 2023-06-19T11:45:18.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-06-23T14:09:43.000Z (over 1 year ago)
- Last Synced: 2024-07-27T12:45:20.686Z (3 months ago)
- Topics: appwrite, hls, hls-stream
- Language: Go
- Homepage:
- Size: 20.5 KB
- Stars: 16
- Watchers: 2
- Forks: 54
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GoHLStreamer
GoHLStreamer is a Go-based server that streams video content in the HTTP Live Streaming (HLS) format. It allows you to convert MP4 files to HLS and serve them over HTTP. The server uses DigitalOcean Spaces for storing the MP4 files and the generated HLS files.
This project adds support for HTTP Live Streaming (HLS) to your Appwrite server. If you're not using Appwrite server, you can still use this project to load MP4 files from DigitalOcean Spaces (or another solution by defining the proper host).
All files for streaming will be saved in the output directory on the Object Storage during the first load. Therefore, the initial load may take longer due to the export process. However, subsequent fetches will utilize the cached files from the Object Storage, resulting in faster loading times.
## Features
- Converts MP4 files to HLS format on-the-fly.
- Serves HLS streams for smooth video playback.
- Loading files from Appwrite server or DigitalOcean Spaces.
- Uses DigitalOcean Spaces for storing the media files.
- Easy to set up and configure.## Prerequisites
- Go 1.15 or higher installed
- FFmpeg installed (used for MP4 to HLS conversion)
- DigitalOcean Spaces account with API credentials## Installation
### Manual
1. Clone the repository:
```shell
git clone https://github.com/ftp27/GoHLStreamer.git
```2. Change into the project directory:
```shell
cd GoHLStreamer
```3. Install the dependencies:
```shell
go mod download
```4. Set up your environment by creating a `.env` file in the project directory with the following contents:
```shell
ENDPOINT=
ACCESS_KEY_ID=
SECRET_ACCESS_KEY=
BUCKET_NAME=
BASE_URL=
TEMP_DIR=
INPUT_DIR=
OUTPUT_DIR=
FFMPEG_PATH=
CACHE_SIZE=
```If you want to use Appwrite instead of DigitalOcean Spaces, you can use the following environment variables:
```shell
APPWRITE_HOST=
APPWRITE_PROJECT=
APPWRITE_SECRET=
APPWRITE_BUCKET=
```5. Run the server:
```shell
go run main.go
```By default, the server will be available at `http://localhost:8080`. Adjust the `BASE_URL` value in the `.env` file to match your server's actual URL.
### Docker
To run the GoHLSStreamer server using Docker, follow these steps:
1. Install Docker on your machine by following the instructions specific to your operating system: [Docker Installation Guide](https://docs.docker.com/get-docker/).
2. Clone the repository:
```bash
git clone https://github.com/ftp27/GoHLSStreamer.git
```3. Navigate to the project directory:
```bash
cd GoHLSStreamer
```4. Build the Docker image:
```bash
docker build -t gohlsstreamer .
```This command will build the Docker image based on the provided `Dockerfile`.
5. Run the Docker container:
```bash
docker run --env-file .env -p 8080:8080 gohlsstreamer
```This command will start the GoHLSStreamer server inside the Docker container and map port 8080 of the container to port 8080 on your local machine.
## Usage
1. Upload your MP4 files to the specified DigitalOcean Spaces bucket.
2. Access the HLS streams by appending `/hls//playlist.m3u8` to the server's URL.
Example:
```
http://your-server-url/hls//playlist.m3u8
```## Contributing
Contributions are welcome! If you find any issues or have suggestions for improvements, please submit an issue or a pull request.
## License
This project is licensed under the [MIT License](LICENSE).