Hello I made an electron app that uses ffmpeg to combine audio and renders video, it works fine on windows, linux, and modern mac osx computers, but a user has reported to me that on an older version of mac osx such as High Sierra 10.13, the way that I have setup ffmpeg does not work.
I have a virtual machine with High Sierra v10.13 where I install RenderTune-mac.dmg
from my RenderTune releases page, then I download 2 audio files and the image from this link. I open RenderTune, and try render a video. My command to combine the audio files into a single mp3 works fine, but when I try to combine that mp3 with the image file, the ffmpeg build I have packaged with my electron app fails with this error:
Command was killed with SIGABRT (Aborted): /Applications/RenderTune.app/Contents/Resources/ffmpeg -loop 1 -framerate 2 -i /Users/martin/Downloads/R-3777978-1344032418-8379.jpeg.jpg -i /Users/martin/Downloads/output-871140.mp3 -y -acodec copy -b:a 320k -vcodec libx264 -b:v 8000k -maxrate 8000k -minrate 8000k -bufsize 3M -filter:v scale=w=1920:h=1954 -preset medium -tune stillimage -crf 18 -pix_fmt yuv420p -shortest /Users/martin/Downloads/concatVideo-871140.mp4
ffmpeg version git-2021-03-24-13335df Copyright (c) 2000-2021 the FFmpeg developers
built with Apple LLVM version 10.0.1 (clang-1001.0.46.4)
configuration: --pkgconfigdir=/Users/martinbarker/Documents/projects/rendertune-0.5.0/workspace/lib/pkgconfig --prefix=/Users/martinbarker/Documents/projects/rendertune-0.5.0/workspace --pkg-config-flags=--static --extra-cflags='-I/Users/martinbarker/Documents/projects/rendertune-0.5.0/workspace/include -mmacosx-version-min=10.10' --extra-ldflags='-L/Users/martinbarker/Documents/projects/rendertune-0.5.0/workspace/lib -mmacosx-version-min=10.10' --extra-libs='-lpthread -lm' --enable-static --disable-securetransport --disable-debug --disable-shared --disable-ffplay --disable-lzma --disable-doc --enable-version3 --enable-pthreads --enable-runtime-cpudetect --enable-avfilter --enable-filters --disable-libxcb --enable-gpl --enable-nonfree --disable-libass --enable-libfdk-aac --enable-libmp3lame --enable-libx264
libavutil 56. 66.100 / 56. 66.100
libavcodec 58.128.100 / 58.128.100
libavformat 58. 69.100 / 58. 69.100
libavdevice 58. 12.100 / 58. 12.100
libavfilter 7.107.100 / 7.107.100
libswscale 5. 8.100 / 5. 8.100
libswresample 3. 8.100 / 3. 8.100
libpostproc 55. 8.100 / 55. 8.100
Input #0, image2, from '/Users/martin/Downloads/R-3777978-1344032418-8379.jpeg.jpg':
Duration: 00:00:00.50, start: 0.000000, bitrate: 1758 kb/s
Stream #0:0: Video: mjpeg (Progressive), yuvj444p(pc, bt470bg/unknown/unknown), 590x600 [SAR 1:1 DAR 59:60], 2 fps, 2 tbr, 2 tbn, 2 tbc
Input #1, mp3, from '/Users/martin/Downloads/output-871140.mp3':
Metadata:
title : My Little Grass Shack
album : Our Hawaii - A Collection Of Personal Favorites
artist : Society Of Seven
track : 11
encoder : Lavf58.69.100
Duration: 00:06:25.59, start: 0.025057, bitrate: 320 kb/s
Stream #1:0: Audio: mp3, 44100 Hz, stereo, fltp, 320 kb/s
Metadata:
encoder : Lavc58.12
Stream mapping:
Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Stream #1:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
[swscaler @ 0x7fbad9167600] deprecated pixel format used, make sure you did set range correctly
[libx264 @ 0x7fbad9040400] using SAR=2681/2679
dyld: lazy symbol binding failed: Symbol not found: ____chkstk_darwin
Referenced from: /Applications/RenderTune.app/Contents/Resources/ffmpeg
Expected in: /usr/lib/libSystem.B.dylib
dyld: Symbol not found: ____chkstk_darwin
Referenced from: /Applications/RenderTune.app/Contents/Resources/ffmpeg
Expected in: /usr/lib/libSystem.B.dylib
at makeError (/Applications/Render…eca/lib/error.js:59)
at handlePromise (/Applications/Render…/execa/index.js:114)
at async file:/Applicat…js/newindex.js:1323
These files will render fine on windows/linux and recent mac versions. In order to package ffmpeg in my electron app on mac computers I had to build a custom sandboxed version with no dynamically linked libraries. I have a .sh file that automatically downloads ffmpeg and builds it with all the necessary flags for mac computers. https://github.com/MartinBarker/RenderTune/blob/master/buildffmpeg.sh Inside this .sh file is where I compile ffmpeg using these flags :
./configure \
--pkgconfigdir="$WORKSPACE/lib/pkgconfig" \
--prefix=${WORKSPACE} \
--pkg-config-flags="--static" \
--extra-cflags="-I$WORKSPACE/include -mmacosx-version-min=${MACOS_MIN}" \
--extra-ldflags="-L$WORKSPACE/lib -mmacosx-version-min=${MACOS_MIN}" \
--extra-libs="-lpthread -lm" \
--enable-static \
--disable-securetransport \
--disable-debug \
--disable-shared \
--disable-ffplay \
--disable-lzma \
--disable-doc \
--enable-version3 \
--enable-pthreads \
--enable-runtime-cpudetect \
--enable-avfilter \
--enable-filters \
--disable-libxcb \
--enable-gpl \
--enable-nonfree \
--disable-libass \
--enable-libfdk-aac \
--enable-libmp3lame \
--enable-libx264
If I try to run this script in my High Sierra VM, it fails with this message:
Unknown option "-extra-libs=-lpthread"
if I remove that flag it fails with a different message:
Unknown option "--enable-static"
I need this flag in order to release my electron app on the mac apple store, can anyone help me compile a static version of ffmpeg that works on old versions like High Sierra 10.13 as well as works on modern mac os systems?
You'll need multiple versions if you are supporting multiple OSes and their various versions. I successfully compiled FFmpeg on High Sierra 10.13 by compiling AdoptOpenJDK and then compiling FFmpeg 2.8. I used homebrew manually and will now automate it to use network requests to download static versions.