Transcode all H.264 encoded video files to H.265.
Since recoding is a slow and resource hungry, we'd like to have the power of scaling out.
- Docker - self-contained and immutable container platform
- Amazon ECS - fully managed container orchestrator
- AWS Fargate - serverless compute engine
- Amazon S3 - temporary block storage for video files
- Amazon EventBridge - event bus which triggers ECS on S3 events
- FFmpeg - open source transcoder
The entire process looks like this:
processor.py
searches the filesystem and uploads video files to S3 (TODO/
prefix)- S3 sends an upload event to EventBridge
- EventBridge triggers a new ECS task (hevc-processor)
transcoder.py
downloads the file from S3transcoder.py
transcodes the file to H.265transcoder.py
uploads the file to S3 (DONE/
prefix)processor.py
downloads the file from S3
A GitHub actions workflow will build the Docker container and configure the AWS infrastructure with Terraform. The local Docker container is started by scheduler.
There are basically 2 important folders within this repository:
- hevc_transcoder
- terraform
This folder contains a Python project with the 2 main modules processor.py
and transcoder.py
.
The project uses poetry for dependency management and pytest for unit testing.
There is a Dockerfile to build the deployable container.
This folder contains all the terraform code to set up the entire infrastructure within AWS.
There is a Makefile with a few targets to make life easier:
clean
- delete all generated filesinstall
- download and install the Python dependenciestest
- run unit testsbuild
- create a build (Python wheel)full-build
- build the docker containerplan
- runterraform plan
apply
- runterraform apply
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.