Audio transcoder with simple HTTP API written with Rust & Axum & FFmpeg.
Go to file
2024-05-26 16:32:12 +03:00
.github/workflows tmp: remove arm64 support 2024-05-26 15:44:26 +03:00
src add X-Task-Id for upload 2024-05-26 16:32:12 +03:00
.dockerignore initial Dockerfile (works, but image is BIG) 2024-05-25 22:34:06 +03:00
.editorconfig initial commit 2024-05-24 23:44:26 +03:00
.gitignore initial commit 2024-05-24 23:44:26 +03:00
Cargo.toml good, but totally useless new Dockerfile 2024-05-26 13:56:00 +03:00
Dockerfile initial Dockerfile (works, but image is BIG) 2024-05-25 22:34:06 +03:00
Dockerfile.scratch good, but totally useless new Dockerfile 2024-05-26 13:56:00 +03:00
LICENSE.md initial commit 2024-05-24 23:44:26 +03:00
README.md add X-Task-Id for upload 2024-05-26 16:32:12 +03:00

atranscoder-rpc

Docker Automated build docker Status

Audio transcoder with simple HTTP API. Work in progress.

How to Use

Transcoding can be done like this:

  1. Use cargo run or neur0toxine/atranscoder-rpc Docker image.
  2. Upload file for transcoding:
curl --location 'http://localhost:8090/enqueue' \
    --form 'file=@"/home/user/Music/test.mp3"' \
    --form 'format="adts"' \
    --form 'codec="aac"' \
    --form 'bitRate="64000"' \
    --form 'maxBitRate="64000"' \
    --form 'sampleRate="8000"' \
    --form 'channelLayout="mono"' \
    --form 'uploadUrl="http://127.0.0.1:8909/upload"'
  1. Your uploadUrl will receive JSON response with job ID and error in case of failure and the entire transcoded file contents in case of success (success request will have X-Task-Id header with task ID). Use Content-Type header to differentiate between the two data types.

You can change configuration using this environment variables:

  • LISTEN - change this environment variable to change TCP listen address. Default is 0.0.0.0:8090.
  • NUM_WORKERS - can be used to change how many threads will be used to transcode incoming files. Default is equal to logical CPUs.
  • TEMP_DIR - this can be used to change which directory should be used to store incoming downloads and transcoding results. Useful if you want to use a Docker volume for this. Default is system temp directory (/tmp for Linux).
  • LOG_LEVEL - changes log verbosity, default is info.

Roadmap

  • Implement somewhat acceptable error handling.
  • Remove old conversion results and input files that are older than 1 hour.
  • Remove input file after transcoding it.
  • Implement file upload to uploadUrl (if Content-Type: application/json then conversion was not successful and body contains an error info).
  • Remove transcoding result after uploading it to the uploadUrl.
  • Docker image for amd64 and arm64 (currently only amd64 is supported).
  • Restart threads in case of panic. It's better to not panic. Current error handling seems ok for now.
  • Statically linked binary for Docker image & result docker image based on scratch (reduce image size). Not yet, see Dockerfile.scratch.
  • Tests!