foundations/stream/README.md
The Stream is a high-performance HTTP-based transcoding service. Stream supports the TUS protocol, enabling reliable, resumable transcoding. Designed for seamless and consistent media processing, it supports advanced transcoding features with robust integration options.
mp4webmhlsgo mod tidy
docker build . -t hcengineering/stream:latest
The following environment variables can be used:
KEY TYPE DEFAULT DESCRIPTION
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 listens 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/transcoding/ path to the directory where transcoded files are stored
STREAM_SENTRY_DSN String "" sentry dsn for error tracking
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.
if you're working with S3 storage type, these envs must be provided: AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY
The service exposes an HTTP API.
Below are some examples of how to interact with it.
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: A TUS client is required to play with the service locally. You can use the tus-js-client example with video.
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"
}'
We welcome contributions! To get started:
This project is licensed under the MIT License.
Enjoy seamless transcoding with Stream! 🚀