Another FFmpeg build script

Useful and helpful examples and samples that help users compile FFmpeg
Post Reply
oviano
Posts: 12
Joined: Sat May 14, 2016 9:15 am

Another FFmpeg build script

Post by oviano » Sun Aug 21, 2016 11:52 am

I recently put together a simple script for cross-building FFmpeg on Windows. This draws from some of the scripts out there already (ffmpeg-windows-build-helpers in particular), from various bits of info in posts around these forums and also takes some inspiration and code from Zeranoe's MinGW-w64 build script in the way it outputs the progress of the build in a tidy manner.

It doesn't include many of the libraries - only x264, x265 and nvenc (optional by placing the latest Nvidia SDK into the directory the script is run from), but it might be a useful starting point for someone who needs a custom build but wants to build this up from scratch in order to gain an understanding of how the libraries are built and linked. It will take the most recent stable releases of x264 and x265 at the time the script is run and the latest git version of FFmpeg.

ffmpeg-build-1.0.0:

https://www.dropbox.com/s/5pavhjxi9eatn ... 1.0.0?dl=0

The script uses a slightly updated version of Zeranoe's MinGW-w64 build script which builds an updated toolchain, such as gcc 5.4 for example.

mingw-w64-build-3.6.7.oviano:

https://www.dropbox.com/s/vwqstyryrwy77 ... viano?dl=0

Usage is pretty simple; just create a folder (in your home folder or somewhere) and then drop these two scripts into it. If you want to build nvenc then download the latest Nvidia NVENC SDK and drop this in there too (the folder should be called Video_Codec_SDK_7.0.1).

Once in the directory you'll probably need to chmod +x the two scripts to make them executable:

$ chmod +x ffmpeg-build-1.0.0
$ chmod +x mingw-w64-build-3.6.7.oviano

Then just run the ffmpeg build script:

$ ./ffmpeg-build-1.0.0

This will then first run the modified toolchain building script, and assuming that is successful it will then download and build FFmpeg. The build will create static executables for ffmpeg, ffprobe, ffplay, x264 and x265 in both 32-bit and 64-bit flavours. These can be found in the FFmpeg/build/win32/bin and FFmpeg/build/x64/bin folders. Nothing gets installed outside the folder the script is run from, it's all sandboxed.

All output is written to "build.log"; it works very much like Zeranoe's MinGW-w64 build script in this respect.

There are some limitations; perhaps the main one is if you run the script again then although it won't rebuild the MinGW-w64 toolchain again it will do a full download and rebuild of the FFmpeg libraries and FFmpeg itself. There are no command line options to control any aspect of it. It doesn't build shared libraries.

I've tested this successfully on a clean Ubuntu 16.04 installation. I would think it should run on other Linux flavours - at worst there might be one or two packages that would need installing, but I haven't tried it.

Anyway, I hope this is useful for someone who rather than just run something like ffmpeg-windows-build-helpers (fantastic as that is) wanted something a little simpler to begin with to learn from/build from. The Zeranoe builds have been very useful to me over the past year or two, so consider this a little something in return...

rogerdpack
Posts: 1868
Joined: Fri Aug 05, 2011 9:56 pm

Re: Another FFmpeg build script

Post by rogerdpack » Tue Aug 23, 2016 1:32 pm

toss it up on github :)

oviano
Posts: 12
Joined: Sat May 14, 2016 9:15 am

Re: Another FFmpeg build script

Post by oviano » Sun Aug 28, 2016 5:45 pm

Yeah I may put it up on github soon...

In the meantime, here is an updated version which enables nvenc support with the latest SDK 7 and features.

https://www.dropbox.com/s/unmlkf1nm3sd3 ... 1.0.1?dl=0

Also, I've created a version of my script that builds for Linux. It has the same limited set of included libraries as the Windows one but shows the differences between a native and a cross-build in terms of how the builds are configured.

https://www.dropbox.com/s/z8fa1zgri5f9s ... 1.0.1?dl=0

Finally, as of today you no longer need to download the NVIDIA SDK to build with nvenc because the required API header file has now been included in the FFmpeg code.

rogerdpack
Posts: 1868
Joined: Fri Aug 05, 2011 9:56 pm

Re: Another FFmpeg build script

Post by rogerdpack » Wed Aug 31, 2016 1:25 pm

might be nice to post some binaries as well...

sfichera
Posts: 2
Joined: Mon Jun 20, 2016 12:33 am

Re: Another FFmpeg build script

Post by sfichera » Wed Feb 22, 2017 9:51 pm

Hi oviano!

First of all, thanks for your script, its awesome!

Please note i'm trying to build a custom version of ffmpeg and everything is working fine for the x86 version... But i'm not able to get x64 binaries, the script get stuck while trying to compile x264...

I'm attaching the build.log and the config.log generated in FFmpeg/build/x64/temp/x264... it seems to be a missing file/s problem, but i've checked at MinGW/mingw-w64-x86_64/lib folders and the missing files are just there... :(
logs.zip
(35.59 KiB) Downloaded 12 times
Could you please give some advice?
Thanks & Regards!
Sebastián

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest