tanersener / mobile-ffmpeg

FFmpeg for Android, iOS and tvOS. Not maintained anymore. Superseded by FFmpegKit.
https://tanersener.github.io/mobile-ffmpeg
GNU General Public License v3.0
3.85k stars 787 forks source link

Lower IOS_MIN_VERSION for Main releases #713

Closed fotiDim closed 3 years ago

fotiDim commented 3 years ago

Description I need to support iOS 9.3 and Mac Catalyst. I am installing the library through CocoaPods. There is no version that both supports iOS 9.3 and Mac Catalyst.

Expected behavior LTS version should support Mac Catalyst or Main version should support iOS 9.3

Current behavior There is no version that both supports iOS 9.3 and Mac Catalyst.

Logs I am getting this error when building: In /.../Pods/mobile-ffmpeg-min/libavcodec.framework/libavcodec(012v.o), building for Mac Catalyst, but linking in object file built for iOS Simulator, file '/.../Pods/mobile-ffmpeg-min/libavcodec.framework/libavcodec' for architecture x86_64

Environment

Other My pod file entry

target 'MY APP' do
  platform :ios, '9.3'
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  pod 'mobile-ffmpeg-min', '4.4.LTS'
end

I also tried with FFMPEG-Kit LTS and I have the same issue.

tanersener commented 3 years ago

Well, Main releases and LTS releases originates from the idea that it is not possible to support some of the features in the same binary release. That's why we have separate release variants. To be able to enable some of those features.

As for your request, would you mind explaining how can I do that? Because, an Xcode version that supports both 32 bit architectures of LTS releases and Mac Catalyst architectures of Main Releases does not exist as far as I know.

fotiDim commented 3 years ago

I suppose the problem is the i386 architecture. Since this arch is only useful for legacy MacOS development I don't have any experience. Xcode 9 is the last one supporting it. Can Xcode 9 build the non LTS version of the library?

Otherwise an iOS-only "channel" perhaps makes sense that does not include the i386 architecture. In that case Xcode 12 could be used.

If i386 is indeed the the blocker, a more radical approach would be to drop support for it. People can alway use an older version of the library. I don't think that someone who targets i386 will also target Catalyst. They are kind of mutually exclusive.

tanersener commented 3 years ago

armv7, armv7s and i386 are the 32-bit architectures not supported since Xcode 10. I already dropped them from the Main releases. If I drop them from LTS releases as well, we won't have any reasons to build an LTS release.

Why don't you build your own version of mobile-ffmpeg with versions/features you need inside?

Can Xcode 9 build the non LTS version of the library?

Yes, it can. But it doesn't support xcframeworks and Mac Catalyst. The output will be very similar to LTS releases you have now.

fotiDim commented 3 years ago

What I am I missing here? I am archiving on Xcode 12 using Standard Architectures which includes armv7. I am also deploying on an iPhone 4 using Xcode 11 (by manually putting the 7.1 device support files files in Xcode). I don't think that that armv7 was ever dropped from Xcode.

I could definitely build my own version but the binary size would force me to use git-lfs. I like the convenience of CocoaPods and not having to check in the dependencies in the repo. And I believe there are already too many FFMPEG pods. It is a bit chaotic to find the one you need.

fotiDim commented 3 years ago

Short update: using this command I am able to build using Xcode 12 ./ios.sh --disable-i386 --xcframework --lts --force. All architectures build fine.

XCFrameworks generation reportedly completes successfully Creating xcframeworks under prebuilt: ok but the respective xcframework folders (libavcodec.xcframework, libavdevice.xcframework etc.) end up being empty. There is not indication of failure in the logs. Is that a bug in the script?

mobile-ffmpeg % ./ios.sh --disable-i386 --xcframework --lts --force

(*) LTS packages should be built using SDK 9.3 but current configuration uses SDK 14.4

Building mobile-ffmpeg LTS static library for iOS

Architectures: armv7, armv7s, arm64, x86-64, x86-64-mac-catalyst
Libraries: none

Building armv7 platform

ffmpeg: ok

mobile-ffmpeg: ok

Building armv7s platform

ffmpeg: ok

mobile-ffmpeg: ok

Building arm64 platform

ffmpeg: ok

mobile-ffmpeg: ok

Building x86-64 platform

ffmpeg: ^[^[^[^[^[^[^[^[^[^[^[^[^[^[^[^[^[ok

mobile-ffmpeg: ok

Building x86-64-mac-catalyst platform

ffmpeg: ok

mobile-ffmpeg: ok

Creating xcframeworks under prebuilt: ok

mobile-ffmpeg %
tanersener commented 3 years ago

What I am I missing here? I am archiving on Xcode 12 using Standard Architectures which includes armv7. I am also deploying on an iPhone 4 using Xcode 11 (by manually putting the 7.1 device support files files in Xcode). I don't think that that armv7 was ever dropped from Xcode.

My bad. You're right about this. It is not Xcode that doesn't have support for armv7 and armv7s, it is the -miphoneos-version-min variable used to build Main releases. It is 12.1 and that prevents from enabling armv7 and armv7s in Main releases. I need to run some tests to whether it is possible to use an older version in -miphoneos-version-min.

XCFrameworks generation reportedly completes successfully Creating xcframeworks under prebuilt: ok but the respective xcframework folders (libavcodec.xcframework, libavdevice.xcframework etc.) end up being empty. There is not indication of failure in the logs. Is that a bug in the script?

I'm not sure, I suggest using ffmpeg-kit for that. ffmpeg-kit scripts are better in supporting Mac Catalyst architectures.

fotiDim commented 3 years ago

I am sure that this is not a problem. Xcode 12 can definitely target iOS 9.0. In fact I was wondering why the Main releases have such high iOS version requirement.

For the same command ./ios.sh --disable-i386 --xcframework --lts --force, ffmpeg-kit is giving me (*) LTS packages does not support xcframework bundles. If I remove the --lts argument this bumps the IOS_MIN_VERSION to 12.1 which defeats the whole purpose.

EDIT: I think we should separate MinimumOSVersion from IOS_MIN_VERSION. Those are 2 very different things. MinimumOSVersion: The minimum operating system version required for the app to run on iOS, tvOS, and watchOS. IOS_MIN_VERSION: Should be the minimum SDK version requires to build the framework.

For Xcode 12 (aka iOS 14 SDK) the official MinimumOSVersion is 9.0. In fact it can go even lower if you want to.

EDIT 2: Manually changing IOS_MIN_VERSION in ffmpeg-kit from 12.1 to 9.0 and running ./ios.sh --xcframework completed and built the xcframeworks successfully.

tanersener commented 3 years ago

This project will be retired. Please consider switching to FFmpegKit.