Stream: shipit

Topic: enconding videos on the cloud


view this post on Zulip Patrick Arminio (Dec 15 2024 at 20:16):

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:

view this post on Zulip Matthew Sanabria (Dec 15 2024 at 20:39):

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.

view this post on Zulip Patrick Arminio (Dec 15 2024 at 20:44):

@Matthew Sanabria I can use one of these GPUs if that's what you mean: a10l40sa100-pcie-40gb and a100-sxm4-80gb

from https://fly.io/docs/reference/configuration/#gpu_kind

view this post on Zulip Matthew Sanabria (Dec 15 2024 at 20:46):

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.

view this post on Zulip Matthew Sanabria (Dec 15 2024 at 20:46):

They are more expensive though.

view this post on Zulip Matthew Sanabria (Dec 15 2024 at 20:46):

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.

view this post on Zulip Patrick Arminio (Dec 15 2024 at 20:47):

thanks! I'll give it a try :D

view this post on Zulip Matthew Sanabria (Dec 15 2024 at 20:47):

Good luck!

view this post on Zulip Patrick Arminio (Dec 16 2024 at 13:08):

@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:

view this post on Zulip Matthew Sanabria (Dec 16 2024 at 16:24):

Heck yeah! Glad to hear it.


Last updated: Jan 13 2025 at 01:14 UTC