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

Add support for Apple Silicon on Mac Catalyst #597

Closed wfltaylor closed 3 years ago

wfltaylor commented 3 years ago

Description Currently MobileFFmpeg does not compile for arm64 on Mac Catalyst, only x86_64.

Environment

Neil20170220 commented 3 years ago

any one help?

zapsleep commented 3 years ago

Until the pod is updated by @tanersener you can build the xcframework with M1 arm64 slice locally by using ios.sh -x script with XCode 12.2 toolchain installed. It should create xcframework with proper naming for maccatalyst and including arm64 slice. The only problem with that is current master appears to fail when building giflib on my macbook. I have a Catalyst project too, haven't updated it to arm64 mac yet - waiting for mobile-ffmpeg xcframework to include arm64-maccatalyst binary. If you have trouble building the project on XCode 12.2 even for x86_64 only - renaming slices inside the mobile-ffmpeg xcframework manually could help.

Neil20170220 commented 3 years ago

I think should add some code like ARCH_ARM64_MAC_CATALYST=7 https://github.com/tanersener/mobile-ffmpeg/blob/195a809cca79b645a66f686b668818e035c243d4/ios.sh#L3-L10

confucious commented 3 years ago

I've done some experimentation on this and I think the build / packaging scripts will need to be reworked to support the arm64 simulator and arm64 Mac catalyst targets.

I've been focusing on the arm64 simulator target and I've reached a point where I can build a framework for the arm64-simulator.

The problem is that when I try to package it with the x86_64-simulator framework into the xcframework, xcodebuild returns an error Both ios-x86_64-simulator and ios-arm64-simulator represent two equivalent library definitions.

From this post: https://developer.apple.com/forums/thread/666335 it appears that simulator (and Mac catalyst) frameworks need to be delivered as a fat binary in the xcframework.

The cleanest way to do this probably is to add a preprocessing step before xcodebuild --create-framework to look for targets with -simulator or -maccatalyst and combine them to a fat binary (using lipo) and then pass that result to xcodebuild.

tanersener commented 3 years ago

I completed refactoring the build scripts to support new apple architectures and macos. They are being tested at the moment. Also a new macos test app is on the way. I'll push those changes when they're stable enough. The plan was to publish them on January but I had issues during testing. I'll need 1-2 weeks more to complete the tests.

hongfeiyang commented 3 years ago

Any news on the progress?

tanersener commented 3 years ago

I implemented these changes under FFmpegKit, which is the continuation of MobileFFmpeg. I suggest switching to FFmpegKit if you want to use newer Apple architectures.

hongfeiyang commented 3 years ago

I implemented these changes under FFmpegKit, which is the continuation of MobileFFmpeg. I suggest switching to FFmpegKit if you want to use newer Apple architectures.

Thanks, also is there any plan to migrate to swift in the future?

tanersener commented 3 years ago

Unfortunately, merging the Swift API implemented in https://github.com/tanersener/mobile-ffmpeg/pull/599 wasn't possible. However, if someone implements a new Swift API identical to Objective-C API we have in FFmpegKit then we can merge it and use it.