How can I include FFmpeg binary to production?

Hello everyone!
I’ve developed a app with nextjs 15 app router, and it’s using fluent-ffmpeg for audio watermark.
So I have to include ffmpeg-static’s binary or other binary to call fluent-ffmpeg function.
I can add it to at development environment, but at production deploy, I can’t include it to build result, I tried with nextjs config, so I added binary file to .next/vendor-chunks, and can call at local build env, but at vercel, I can’t call, I checked logs, and it says that can’t find same file, so I think it’s due to vercel’s build method.
Do you know how I can solve it?
Thank you.

1 Like

Hi @mehrzadgsan101-gmail, welcome to the Vercel Community!

To quote from this GitHub issue:

While there are ways to get ffmpeg to install on Vercel’s serverless containers like:

  1. using the @ffmpeg-installer/ffmpeg npm package,
  2. downloading ffmpeg as an executable binary and optionally moving it to a cachable location.

We generally do not recommend running this kind of server workload as serverless functions and installing ffmpeg will very likely push the serverless function over the 50MB limit.

One of our community members @bestcodes has implemented a client side solution, which might be useful. Maybe you two can chat about ideas.

2 Likes

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