Skip to content

superwall/mediaconverter

 
 

Gumroad Mediaconverter (GRMC)

A video conversion service that transforms video files into HLS streaming formats using FFmpeg. Compatible with AWS S3, Cloudflare R2, and other S3-compatible storage services.

Endpoints

POST /convert

Requires authentication. Enqueues an internal job to convert a video. If too many jobs are already processing, the request will be rejected with a 429 status code.

curl --basic -u $YOUR_API_KEY: -X POST $GRMC_SERVER/convert -H "Content-Type: application/json" -d '{ "id": "123456", "s3_video_uri": "s3://[......]", "s3_hls_dir_uri": "s3://[......]/hls/", "presets": ["hls_480p", "hls_720p"], "callback_url": "https://example.com/callback" }'

# HTTP 200 OK
# {"job_id":"f2fea87585"}
# or
# HTTP 429 Too Many Requests

GET /status

Requires authentication. Returns list of jobs currently being processed.

curl --basic -u $YOUR_API_KEY: -X GET $GRMC_SERVER/status

# HTTP 200 OK
# {"running_jobs":[{"JobID":"f2fea87585","Request":{"s3_video_uri":"s3://[......]","s3_hls_dir_uri":"s3://[......]/hls/","presets":["hls_480p","hls_720p"],"id":"123456","callback_url":"https://example.com/callback"},"Status":"processing","ErrorMsg":"","StartTime":"2024-10-11T08:44:45.09950379Z"}]}

GET /up

Returns 200 OK if the server is running and environment variables are set.

Configuration

Storage Services

This service supports multiple S3-compatible storage providers:

AWS S3

AWS_REGION=us-east-1
AWS_ACCESS_KEY_ID=your_access_key
AWS_SECRET_ACCESS_KEY=your_secret_key

Cloudflare R2

S3_ENDPOINT=https://YOUR_ACCOUNT_ID.r2.cloudflarestorage.com
AWS_ACCESS_KEY_ID=your_r2_access_key
AWS_SECRET_ACCESS_KEY=your_r2_secret_key
# AWS_REGION is optional for R2 (can be omitted or set to "auto")

Other S3-Compatible Services

S3_ENDPOINT=https://your-s3-compatible-endpoint.com
AWS_ACCESS_KEY_ID=your_access_key
AWS_SECRET_ACCESS_KEY=your_secret_key
AWS_REGION=your-region  # if required by the service

Development

You need to set a .env at the root of the project.

# Via docker
docker run -p 7454:7454 --env-file .env $(docker build -f Dockerfile . -q)

# Outside of docker
make && dotenv -f .env ./mediaconverter

Deployment to production

  • Assuming you're using kamal to deploy
  • Assuming you have a .env.production at the root of the project
# First time: dotenv -f ./.env.production kamal setup
dotenv -f ./.env.production kamal deploy

License

Gumroad Mediaconverter is licensed under the MIT License.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Go 72.8%
  • Shell 24.1%
  • Dockerfile 2.6%
  • Makefile 0.5%