Hi there! I'm trying to encode some videos uploaded by users, I'm currently using fly.io and spinning up a machine that has ffmpeg and passing the video to be encoded, with these params:
ffmpeg -i /var/folders/5d/4zxvbq_x2q79fww0hg7k1ryh0000gn/T/tmpoe4qof00 -filter_complex [0]scale=height=-1:width=1920[s0] -map [s0] -b:a 128k -acodec aac -crf 23 -preset medium -vcodec libx264 /var/folders/5d/4zxvbq_x2q79fww0hg7k1ryh0000gn/T/tmpp6awkpor.mp4 -y
I'm not sure if I'm doing anything wrong, but even using a performance machine the speed is not ideal (I get 0.305x)
Does anyone have experience in something like this?
For context these video will be running on screens in my parents' shop (via chrome) :blush:
That sounds like it's software encoding on a CPU that doesn't have favorable encoding functionality. I don't use Fly but do you know if they have hardware acceleration capabilities that guests can use? That's likely what you'll need.
@Matthew Sanabria I can use one of these GPUs if that's what you mean: a10
, l40s
, a100-pcie-40gb
and a100-sxm4-80gb
from https://fly.io/docs/reference/configuration/#gpu_kind
That should work! I don't see anything in their documentation about hardware acceleration on CPU only machines. It's likely they want you to use their GPU machines.
They are more expensive though.
Mind you, I haven't used Fly ever so perhaps I'm missing something. But that performance you're noting seems very much like software encoding.
thanks! I'll give it a try :D
Good luck!
@Matthew Sanabria I got this working with a GPU (I had to find a good base docker image as I was having troubles compiling ffmpeg on my own), it's definitely faster, but I need to tweak the settings now :blush:
Heck yeah! Glad to hear it.
Last updated: Jan 13 2025 at 01:14 UTC