Signed-off-by: denis-tingaikin <denis.tingajkin@xored.com>
Stream
About
The Stream is high-performance HTTP-based transcoding service. Stream supports TUS protocol, enabling reliable, resumable transcodings. Designed for seamless and consistent media processing,it supports advanced transcoding features with robust integration options.
Features
TUS Protocol Support
- Resumable transcoding: Leveraging the TUS protocol, Stream ensures reliable and efficient transcoding bucket processing.
Input Support
- Supported Input Formats:
mp4webm
Output Options
- Supported Output Formats:
hls
Upload options
- s3 Upload: Direct upload to S3 storage.
- datalake Upload: Upload to datalake storage.
Key Functionalities
- Live transcoing with minimal upload time: Transcoding results are going to be avaible after stream completion.
- Transcoding Cancelation: Cancel or pause ongoing transcoding in real-time.
- Transcoding Resumption: Resume incomplete transcoding tasks efficiently.
Transcoding scheduling
Installation
Prerequisites
Steps
- Install dependencies:
go mod tidy
- Build the service:
docker build . -t hcengineering/sream:latest
Configuraiton
App env configuraiton
The following environment variables can be used:
KEY TYPE DEFAULT STREAM_LOG_LEVEL String debug sets log level for the application
STREAM_SERVER_SECRET String server secret required to generate and verify tokens
STREAM_PPROF_ENABLED True or False true starts profile server on localhost:6060 if true
STREAM_INSECURE True or False false ignores authorization check if true
STREAM_SERVE_URL String 0.0.0.0:1080 listen on url
STREAM_ENDPOINT_URL URL s3://127.0.0.1:9000 S3 or Datalake endpoint, example: s3://my-ip-address, datalake://my-ip-address
STREAM_MAX_PARALLEL_SCALING_COUNT Integer 2 how much parallel scaling can be processed
STREAM_MAX_THREAD_COUNT Integer 4 max number of threads for transcoder
STREAM_OUTPUT_DIR String /tmp/transcoing/ path to the directory with tra
Metadata
resolution: if passed, set the resolution for the output, for example, 'resolution: 1920:1080'.
token: must be provided to be authorized in the Huly's datalake service.
workspace: required for uploading content to the datalake storage.
S3 Env configuration
if you're working with S3 storage type, these envs must be provided: AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY
Usage
The service exposes an HTTP API.
Below are some examples of how to interact with it.
Trnascode via TUS
curl -X POST http://localhost:1080/recording \
-H "Tus-Resumable: 1.0.0" \
-H "Upload-Length: <file-size>" \
--data-binary @path/to/your/file.mp4
Note: tus client is required, to play with a service locally you can use tus-js-client example with video
Schedule a transcoding
curl -X POST http://localhost:1080/transcoding \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <token>" \
-d '{
"source": "<input file name>",
"format": "hls",
"workspace": "test"
}'
Contributing
We welcome contributions! To get started:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Submit a pull request describing your changes.
License
This project is licensed under the MIT License.
Enjoy seamless transcoding with Stream! 🚀