ffmpeg encoding on multiple machines

Hey this might seem too advanced topic, but it’s so urgent.

I would like to have a 3 machines of my app one of them are serving the actuall app and the other two machine are responsible for ffmpeg encoding commands. as you might know the other two machines won’t run all the time it’ll run only when there is an encoding videos then stops and the first app is running all the time.

How can I achieve this on fly.io?

1 Like

I’d recommend two apps. Here’s why.

The main app would be public with HTTP services on your toml and public IPs. You can edit your toml to make it not auto stop machines or make it stop machines and have at least one running, both cases would satisfy you need for the web server to be always running.

The other app, for ffmpeg, would be similar to the previous app but make it auto stop machines and not have minimum of running machines. Our proxy will stop it when there’s no traffic so you won’t need to worry about it.

Having distinct apps will also make it easier for you on the future to scale vertically and horizontally those differently. I assume you’d want the ffmpeg machines stronger for example.

Is that helpful?

Yeah that’s helpful,

I have been thinking of this too, if I set the server to auto_stop it’ll stop even if there is an ffmpeg command are executing why is this? and how can I avoid this senario?

Our proxy stops machines with no TCP traffic. If your processing doesn’t require a TCP connection you can disable auto_stop machines but keep auto_start enabled. To stop your machine just exit the process and the machine will be suspended until another request is made.

To make things clear If I disabled the auto_stop it’ll not stop after the ffmpeg command are finished, it’ll be up forever, how to take care of this?

You can exit the process. In nodejs would be something like process.exit(0).

1 Like

If I exited the process, the machine will stop?

Oh cool I didn’t know that, Thank you!

1 Like

I have another question ( I know I might be silly ), but how many videos (of 1hr and 15 mins) would shared-cpu-8x can handle at the same time?

because I am trying to encode a 5 videos at the same time and it’s taking like 1 hour to finish, is that okay? ( I am using ffmpeg )

I don’t have a clue, I’d recommend looking for places were they understand more about that specifically.

Maybe some other community member here would know and they could reply about it.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.