1

I would like to reduce the size of a mp4 video from a webjob on Azure. I have a queue trigger in my webjob, each time a new video is added, the VideoCompressor Webjob will reduce the size of the mp4 video file (reduce to 200px width or height depending of the orientation + crop to only 2 min).

From what I read on internet, ffmpeg is the answer. There is nuget package: FFmpeg.stable.GZCR. I would like to use a nugget package to not have to go on the ffmpeg website and verify each time if there a new version.

But I don't find any documentation about it:

I found some information about FFmpeg but it's for WinRT, so not usefull in my case:

I found this code, it seems to be what I would like to do. The problem is from the nugget package, I dont know how to access to the ffmpeg.exe", but maybe you have other idea?

Do you have any idea or suggestion?

4
  • Just use ffmpeg.exe directly, no need for any wrappers or nuget packages. Commented Apr 24, 2018 at 19:42
  • The problem is I would like to have the last version easily. with nugget, I just need to do: Update-Package Automatically all my packages are updated. By using the .exe, I need to go to the website, download it in the right folder. When you have to do manually things, you increase the possibility of failure. If someone else works on the project, it could not know that he has to update it manually. With "FFmpeg.stable.GZCR", it seems that the ffmpeg.exe is embedded in the dll, but I dont know how to call it. Commented Apr 24, 2018 at 22:02
  • Well current fmpeg version is 4.0 and that package has 3.4, so using package does not guarantee last version. And I don't think it contains ffmpeg.exe. Plus, blindly update such things might be dangerous, without testing. But, that's just my opinion. Note that download of that file can be automated without package. Commented Apr 24, 2018 at 22:16
  • Ok, this is a good point! I will use ffmpeg.exe. Can you give me more details about the automation for ffmpeg.exe update please? Commented Apr 24, 2018 at 22:47

1 Answer 1

4

FFMPEG has a very complex API and you may be better off calling the tool directly from a C# program. When researching how to do something in ffmpeg everyone will be discussing the tool in terms of accessing the .exe directly so you will have less confusion than attempting to use a wrapper API.

You can do this using System.Diagnostics.Process, for example

var process = new Process
{
    // Path to your ffmpeg binary
    FileName = "ffmpeg.exe",
    // Example ffmpeg command to get the sound from an mp4 video
    Arguments = "-i input.mp4 -vn -ab 320 output.mp3",
    UseShellExecute = false
}

process.Start();

If you want to automate upgrading ffmpeg you could script it to get the latest release from the GitHub repository and compile ffmpeg yourself.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for your answer :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.