Rob Rob - 4 months ago 40
Vb.net Question

compile ffmpeg decode only without audio codecs

I work on a media manager and use ffmpeg.exe to extract screenshots.
With the latest size of ffmpeg.exe exceeding 35MB, I am attempting to build ffmpeg without the majority of its functions, to allow only saving of a frame of video.

I had thought disabling many of the filters, Audio Codecs etc would shrink the size of ffmpeg to something more manageable.

Following this guide
https://pracucci.com/compile-ffmpeg-on-windows-with-visual-studio-compiler.html
to allow building of ffmpeg using Visual Studio 2015, I have come to the part of ./configuration and hit a wall.
With so many options and no idea what all of them mean or do, I am asking if someone in the community can give me laymans instructions.

I also know that I need to build x264, and possible x265 (HEVC), but am not sure if there is anything other codecs needed.
In the end, I and am hoping to just have the one file, ffmpeg.exe for use in the media manager project.

The code I use to get a screenshot is as follows

Public Shared Function CreateScreenShot(ByVal FullPathAndFilename As String, ByVal SavePath As String, ByVal sec As Integer, Optional ByVal Overwrite As Boolean = False) As Boolean
If Not File.Exists(SavePath) Or Overwrite Then
Try
IO.File.Delete(SavePath)
Catch
Return False
End Try
If IO.File.Exists(FullPathAndFilename) Then
Dim myProcess As Process = New Process
Try
Dim seconds As Integer = sec
myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
myProcess.StartInfo.CreateNoWindow = False
myProcess.StartInfo.FileName = Utilities.applicationPath & "\Assets\ffmpeg.exe"
Dim proc_arguments As String = "-ss " & seconds.ToString & " -i """ & FullPathAndFilename & """ -vframes:v 1 -an " & """" & SavePath & """"
myProcess.StartInfo.Arguments = proc_arguments
myProcess.Start()
myProcess.WaitForExit()
If File.Exists(SavePath) Then Return True
Catch ex As Exception
Throw ex
Finally
myProcess.Close()
End Try
End If
End If
Return False
End Function


I hope this is sufficient information, and appreciated any help or suggestions.

Answer

There is an option --disable-everything which will disable all components without enabling explicitly.

I guess you may try to build it with:

./configure --disable-everything --enable-libx264 --enable-libx265 --toolchain=msvc --enable-yasm --enable-asm

If there is any other codecs needed, they should be added to the option too.

And if some ffmpeg libs are not needed, they can be disabled like:

./configure --disable-postproc

See the Component options part in ./configure --help output for how to disable/enable those libs.