ffmpeg is always rebuilt
Description
Using ./ios.sh, ffmpeg is always rebuilt. Scenario: run twice the exact same command. This adds at least 1 min per build
Expected behavior
> ./ios.sh --disable-armv7 --disable-armv7s --disable-arm64-simulator --disable-arm64-mac-catalyst --disable-arm64e --disable-i386 --disable-x86-64 --disable-x86-64-mac-catalyst --enable-openh264 -x
Building ffmpeg-kit shared library for iOS
Architectures: arm64
Libraries: openh264
Downloading sources: ok
Building arm64 platform targeting iOS SDK 12.1 and Mac Catalyst 14.0
openh264: already built
ffmpeg: ok
ffmpeg-kit: ok
Creating xcframeworks under prebuilt: ok
> ./ios.sh --disable-armv7 --disable-armv7s --disable-arm64-simulator --disable-arm64-mac-catalyst --disable-arm64e --disable-i386 --disable-x86-64 --disable-x86-64-mac-catalyst --enable-openh264 -x
Building ffmpeg-kit shared library for iOS
Architectures: arm64
Libraries: openh264
Downloading sources: ok
Building arm64 platform targeting iOS SDK 12.1 and Mac Catalyst 14.0
openh264: already built
ffmpeg: already built
ffmpeg-kit: already built
Creating xcframeworks under prebuilt: already built
Note the already built that I expect to see
Current behavior
> ./ios.sh --disable-armv7 --disable-armv7s --disable-arm64-simulator --disable-arm64-mac-catalyst --disable-arm64e --disable-i386 --disable-x86-64 --disable-x86-64-mac-catalyst --enable-openh264 -x
Building ffmpeg-kit shared library for iOS
Architectures: arm64
Libraries: openh264
Downloading sources: ok
Building arm64 platform targeting iOS SDK 12.1 and Mac Catalyst 14.0
openh264: already built
ffmpeg: ok
ffmpeg-kit: ok
Creating xcframeworks under prebuilt: ok
> ./ios.sh --disable-armv7 --disable-armv7s --disable-arm64-simulator --disable-arm64-mac-catalyst --disable-arm64e --disable-i386 --disable-x86-64 --disable-x86-64-mac-catalyst --enable-openh264 -x
Building ffmpeg-kit shared library for iOS
Architectures: arm64
Libraries: openh264
Downloading sources: ok
Building arm64 platform targeting iOS SDK 12.1 and Mac Catalyst 14.0
openh264: already built
ffmpeg: ok
ffmpeg-kit: ok
Creating xcframeworks under prebuilt: ok
Note the ok instead of already built
To Reproduce Run the same command twice
Screenshots N/A
Logs N/A
Environment
- Platform:
iOS - Architecture: all of them
- Version:
v5.1 - Source branch:
main - Xcode version:
15.4
Shell behavior, see: https://github.com/arthenica/ffmpeg-kit/blob/e78b7956c7efd76e61930d9b3571773804c30565/scripts/main-ios.sh#L212
I see, but I would actually prefer it to behave exactly like the custom libraries: build if not present, else do not rebuild. I do not want to set SKIP_ffmpeg manually (this is the job of the shell script, I do not want to replicate some logic outside of it)
Unlike external libraries, the build scripts are set to always build ffmpeg and ffmpeg-kit. Here’s why: External libraries don’t change, so running their build scripts again will create the same binary unless the build tools are updated. But for ffmpeg, the binary depends on which external libraries are enabled. For example, running ./ios.sh --enable-opus will produce different ffmpeg binaries than ./ios.sh --enable-dav1d. That’s why we’ve set it up this way.
If you’re sure that rebuilding ffmpeg isn’t needed, you can pass --skip-ffmpeg and/or --skip-ffmpeg-kit options to the build script.
./ios.sh -x --skip-ffmpeg --skip-ffmpeg-kit