[FFmpeg-user] Apple M1 builds of FFmpeg and FFprobe

Vincentius Vincentius macytdl at gmail.com
Sun May 22 03:47:11 EEST 2022


I don’t know where it came from but, some posts on other forums say it was at patch to FFmpeg provided by Apple to the Handbrake developers:

https://arstechnica.com/civis/viewtopic.php?f=19&t=1472102&start=400 <https://arstechnica.com/civis/viewtopic.php?f=19&t=1472102&start=400>

But, I can’t find a direct source.  I don’t understand why Apple would not provide the patch to the FFmpeg developers – maybe someone did.

This post starts with some interesting detail from a Handbrake developer: “Apple contributed a x265 patch with a bunch of neon asm to improve x265 performance”.

https://bitbucket.org/multicoreware/x265_git/issues/563/patch-neon-arm64-improvements <https://bitbucket.org/multicoreware/x265_git/issues/563/patch-neon-arm64-improvements>

Apparently, it speeds up x264 and x265 encoding by 200% or more.  But, there are forum comments that the x265 developers were ignoring it during 2020 and 2021.

Wikipedia has some detail on Neon itself (I should always look there first):  https://en.wikipedia.org/wiki/ARM_architecture_family#Advanced_SIMD_(Neon) <https://en.wikipedia.org/wiki/ARM_architecture_family#Advanced_SIMD_(Neon)>

When I run a conversion using Handbrake on my M1 Mac, the log file contains this line:

x264 [info]: using cpu capabilities: ARMv8 NEON

I think Handbrake is using the “libx264” encoder.

This is a link to the Pull Request in which the “ Neon patch” was added to the Homebrew script:

https://github.com/homebrew-ffmpeg/homebrew-ffmpeg/pull/98/commits/041119acb9f1968513829795600d574794411295 <https://github.com/homebrew-ffmpeg/homebrew-ffmpeg/pull/98/commits/041119acb9f1968513829795600d574794411295>

The “osxexperts” script for compiling FFmpeg <http://www.osxexperts.net/> has this nearly at the end:

./configure --prefix=${SOURCE} --extra-cflags="-fno-stack-check" --arch=arm64 --cc=/usr/bin/clang --enable-gpl --enable-libopenjpeg --enable-libopus --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libvpx --enable-libwebp --enable-libass --enable-libfreetype --enable-libtheora --enable-libvorbis --enable-libsnappy --enable-libaom --enable-libvidstab --enable-libzimg --enable-libsvtav1 --enable-version3 --pkg-config-flags=--static --disable-ffplay --enable-postproc --enable-nonfree --enable-neon --enable-runtime-cpudetect --disable-indev=qtkit --disable-indev=x11grab_xcb

This GitHub repo incorporates Neon into that developer’s build of FFmpeg: https://github.com/Vargol/ffmpeg-apple-arm64-build <https://github.com/Vargol/ffmpeg-apple-arm64-build>

I think this contains the Neon patch: https://github.com/Vargol/ffmpeg-apple-arm64-build/blob/master/build/apple_arm64_x265.patch <https://github.com/Vargol/ffmpeg-apple-arm64-build/blob/master/build/apple_arm64_x265.patch>

This is all way above my head so, I hope this helps.


Garry
macytdl at gmail.com


> On 21 May 2022, at 9:47 pm, Martin Riedl via ffmpeg-user <ffmpeg-user at ffmpeg.org> wrote:
> 
> Can you provide more details?
> 
> Where can I find more details about this patch?
> Do you know, why this patch is not directly applied to FFmpeg source code?
> 
>> On 21. May 2022, at 07:55, Vincentius Vincentius <macytdl at gmail.com> wrote:
>> 
>> Yes, thank you for the builds.  They are a great help.
>> 
>> Please excuse my ignorance but, does/could this include the “Neon” patch for the ARM64 builds ?  It has been added to the Homebrew builds (PR #98).
>> 
>> 
>> Garry
>> 
>> 
>>>> Am 20.05.2022 um 12:17 schrieb Martin Riedl via ffmpeg-user <ffmpeg-user at ffmpeg.org>:
>>>> 
>>>> You can check out my build server:
>>>> https://ffmpeg.martin-riedl.de <https://ffmpeg.martin-riedl.de/>
>>>> It provides static builds for FFmpeg, FFprobe and FFplay for Intel and Apple Silicon (nightly builds and releases).
>>>> 
>>>> One major difference to evermeet.cx <http://evermeet.cx/> is that I don’t have that much external codecs embedded (will be extended over time).
>>>> In addition my binaries are signed and the installers also notarized (so no/less trouble with Gatekeeper :-D ).
>>>> 
>>>> Also the source code for compilation is located here:
>>>> https://gitlab.com/martinr92/ffmpeg <https://gitlab.com/martinr92/ffmpeg>
>>>> Feel free to open an issue here if you miss a codec that is important for you.
>>>> 
>>>> Regards,
>>>> Martin


More information about the ffmpeg-user mailing list