arthenica / ffmpeg-kit

FFmpeg Kit for applications. Supports Android, Flutter, iOS, Linux, macOS, React Native and tvOS. Supersedes MobileFFmpeg, flutter_ffmpeg and react-native-ffmpeg.
https://arthenica.github.io/ffmpeg-kit
GNU Lesser General Public License v3.0
4.52k stars 603 forks source link

ffmpeg is always rebuilt #1015

Closed TLescoatTFX closed 1 week ago

TLescoatTFX commented 3 months ago

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

lxhlzyh commented 3 months ago

Shell behavior, see: https://github.com/arthenica/ffmpeg-kit/blob/e78b7956c7efd76e61930d9b3571773804c30565/scripts/main-ios.sh#L212

TLescoatTFX commented 2 months ago

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)

tanersener commented 1 week ago

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