FFmpeg.NET icon indicating copy to clipboard operation
FFmpeg.NET copied to clipboard

Use ffmpeg.net on Ubuntu

Open Excalib88 opened this issue 6 years ago • 3 comments

Hello! I want to deploy my app on Ubuntu, but i need to set engine path to Engine type. How i can use this in ubuntu? Can you help me, please

Excalib88 avatar Dec 09 '19 11:12 Excalib88

Looking for the same thing but on Debian. I notice the commands for ffmpeg are the same regardless of OS. I'm assuming that when executing a command in either Windows or Linux, should be the same. The only difference is the binaries are different. I'm experimenting with it now and see I can create a PR if successful.

codematrix avatar Dec 30 '19 16:12 codematrix

I got a workaround. However, it requires that you install ffmpeg along with your docker image. It takes about a min to install but once installs it works as perusal.

In my docker file I have the following. I use Debian 10. You can get a list of .NET runtimes here. https://hub.docker.com/_/microsoft-dotnet-core-aspnet

FROM mcr.microsoft.com/dotnet/core/runtime:3.1-buster-slim AS base
RUN ["apt-get", "--assume-yes", "update"]
RUN ["apt-get", "--assume-yes", "install", "ffmpeg"] 

… other stuff

Then in your code base to pass the ffmpeg file, you have to do this.

   var ffmpegPath = RuntimeInformation.IsOSPlatform(OSPlatform.Linux)
                    ? $"/usr/bin/ffmpeg"
                    : $"{AppDomain.CurrentDomain.BaseDirectory}ffmpeg.exe";

   var engine = new FFmpeg.NET.Engine(ffmpegPath);

Deployment will take a lot longer. I'm still exploring other options.

codematrix

codematrix avatar Dec 30 '19 22:12 codematrix

Hello,

I created a public image hubster/dotnet.core.runtime

You can use this as it has ffmpeg preinstalled installed on top of .net core 3.1.buster-slim as defined in https://hub.docker.com/_/microsoft-dotnet-core-aspnet

So in your Dockerfile, just change the first FROM like this.

FROM hubster/dotnet.core.runtime:3.1-buster-slim-ffmpeg AS base

You still need to do this in your code base:

   var ffmpegPath = RuntimeInformation.IsOSPlatform(OSPlatform.Linux)
                    ? $"/usr/bin/ffmpeg"
                    : $"{AppDomain.CurrentDomain.BaseDirectory}ffmpeg.exe";

   var engine = new FFmpeg.NET.Engine(ffmpegPath);

codematrix

codematrix avatar Dec 31 '19 19:12 codematrix