This is a small step-by-step guide on how to download, compile and install GPAC and especially MP4Box on a Mac environment. I suppose most of it could be done with Linux in a very similar manner. There is an official guide for this, and it helped me quite a lot, but it was missing some (for me) crucial steps. That’s why I’m summarizing my steps I did to install GPAC.
#1 Clone GitHub
You can find the GPAC repository here: https://github.com/gpac/gpac
Create a new folder locally and then clone the repo normally:
git clone https://github.com/gpac/gpac.git
#2 Installing GPAC extra libs
Now it starts to get very interesting. You need some additional libraries so that GPAC works properly. To get them they use MacPorts in the official guide for this. If you haven’t installed MacPorts yet (as me) then you need to follow the steps on the MacPorts page here. I can only recommend using the package installer because that’s way easier than the other way (with Xcode etc.). But your choice.
If you have already installed MacPorts
If you have updated your operating system since you’ve last used MacPorts, then it is very likely that you have to update MacPorts again. You will get messages like:
Error: Current platform "darwin 15" does not match expected platform "darwin 14" Error: If you upgraded your OS, please follow the migration instructions: https://trac.macports.org/wiki/Migration OS platform mismatch while executing "mportinit ui_options global_options global_variations" Error: /opt/local/bin/port: Failed to initialize MacPorts, OS platform mismatch
Just go to the install page and get your appropriate “macOS Package (.pkg) Installer” from there. Then install it and continue with the following steps,
When you successfully installed MacPorts you then update MacPorts itself with:
sudo port -v selfupdate
After that, you can install all the libraries needed for GPAC via MacPorts:
sudo port install pkgconfig freetype libpng jpeg spidermonkey185 libsdl ffmpeg faad2 libmad xvid libogg libvorbis libtheora a52dec openjpeg
If you get the warnings about not having installed the Xcode Command Line Tools:
Warning: The Xcode Command Line Tools don't appear to be installed; most ports will likely fail to build. Warning: Install them by running `xcode-select --install'.
Then just do as told and run
Error: Port libsdl-devel not found
This was an error that occurred while trying to install “libsdl-devel”. This library simply isn’t available anymore. But that’s no problem, as this was the development version anyway. Just use “libsdl” instead.
For my installation, I skipped the steps Setting up UPnP (Optional) and Setting up OpenSVCDecoder (Optional).
#3 Compile/Build the code
To configure the installation use the following command:
Then you can build GPAC with the normal make command:
The build process should work without problems now.
#4 Install GPAC/MP4Box
Now after the build was successful, you have two options to install GPAC. You can create a DMG-file or install it directly with:
sudo make install
Even though I made this and restarted everything MP4Box wasn’t still working and I had to manually copy the files to the system. I used the following commands for that:
cd bin/gcc/ cp libgpac.dylib /usr/local/lib/ cp libgpac.dylib /usr/local/include/ cp MP4Box /usr/local/bin/
After that MP4Box should work properly: