How can I run GPU-accelerated FFmpeg in an ECS container on EC2?

0
3
Asked By MellowPine47 On

I'm trying to run FFmpeg with NVIDIA hardware acceleration in Docker on AWS. The workload would run as ECS tasks using the EC2 launch type, rather than standard Fargate. My current plan is to use a GPU-enabled instance such as G7e, install the appropriate NVIDIA GRID drivers and container toolkit, and use an FFmpeg image compiled with NVIDIA support. Has anyone configured this successfully and reliably? I'd especially appreciate examples covering the EC2 host, Docker runtime, ECS task definition, and launching jobs from Step Functions.

3 Answers

Answered By BrightHarbor6 On

You may not need a G7e specifically. G6 and G7 instances can also be suitable for video transcoding and are often less expensive when you don’t need graphics-heavy workloads. Check the current AWS GPU and driver compatibility tables, but a missing mention in one example doesn’t necessarily mean those instance families are unsupported.

MellowPine47 -

Good point. I’ll compare G6 and G7 as well instead of assuming G7e is required. The earlier documentation I found may simply have been incomplete.

Answered By QuietMaple22 On

Build it incrementally rather than debugging the whole ECS setup at once. First launch a GPU-optimized EC2 instance and verify the device with `nvidia-smi`. Next, confirm that FFmpeg running directly on the host can access NVENC or CUDA. After that, run a minimal Docker container that executes `nvidia-smi`, followed by a container containing your NVIDIA-enabled FFmpeg build. Once those pieces work from the command line, add the ECS cluster, capacity configuration, task definition, and service or one-off task orchestration.

Answered By CedarFox8 On

The main limitation is that regular Fargate doesn’t provide GPU passthrough. You’ll need an ECS cluster backed by GPU-capable EC2 instances. Start with an AWS ECS GPU-optimized AMI so the NVIDIA drivers, ECS agent, and container runtime are already set up. Then add a GPU resource requirement to the task definition and use an FFmpeg image built with NVIDIA support.

MellowPine47 -

That clears up the biggest misunderstanding. I was thinking of Fargate-style tasks on EC2, but I’ll need to use the ECS EC2 launch type instead. The Step Functions integration will need a little more wiring, but this gives me a workable direction.

Related Questions

Extract Audio From Video File

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.