-
-
Notifications
You must be signed in to change notification settings - Fork 899
Implemented building single XCFramework #147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
But before I merge, you should fix some issues I found while testing.
- uncomment BuildAll
- try to download FFmpeg source if missing
- macCatalyst fails to build
src/libavcodec/videotoolbox.c:699:45: error: 'kCVPixelBufferOpenGLESCompatibilityKey' is
unavailable: not available on macCatalyst
CFDictionarySetValue(buffer_attributes, kCVPixelBufferOpenGLESCompatibilityKey, kCFB... - framework name should be FFmpeg (notice lower case m)
Now fixing issues and submitting PR with fix to FFmpeg
Don't you get an error like above while building for macCatalyst?
Don't you get an error like above while building for macCatalyst?
I got the same error such as 「'kCVPixelBufferOpenGLESCompatibilityKey' is
unavailable: not available on macCatalyst」
I got the source from Url:
https://ffmpeg.org/releases/ffmpeg-4.2.tar.bz2
hopes solve the problem and good luck !
I also had same error while building.
That's why I mentioned submitting PR with fix to FFmpeg
You can resolve the issue yourself by changing following lines in libavcodec/videotoolbox.c
#if TARGET_OS_IPHONE
CFDictionarySetValue(buffer_attributes, kCVPixelBufferOpenGLESCompatibilityKey, kCFBooleanTrue);
#else
CFDictionarySetValue(buffer_attributes, kCVPixelBufferIOSurfaceOpenGLTextureCompatibilityKey, kCFBooleanTrue);
#endif
to following code:
#if TARGET_ABI_USES_IOS_VALUES
CFDictionarySetValue(buffer_attributes, kCVPixelBufferOpenGLESCompatibilityKey, kCFBooleanTrue);
#elif TARGET_OS_OSX
CFDictionarySetValue(buffer_attributes, kCVPixelBufferIOSurfaceOpenGLTextureCompatibilityKey, kCFBooleanTrue);
#endif
simayang01
commented
Oct 11, 2019
I also had same error while building.
That's why I mentioned submitting PR with fix toFFmpeg
You can resolve the issue yourself by changing following lines inlibavcodec/videotoolbox.c
#if TARGET_OS_IPHONE CFDictionarySetValue(buffer_attributes, kCVPixelBufferOpenGLESCompatibilityKey, kCFBooleanTrue); #else CFDictionarySetValue(buffer_attributes, kCVPixelBufferIOSurfaceOpenGLTextureCompatibilityKey, kCFBooleanTrue); #endif
to following code:
#if TARGET_ABI_USES_IOS_VALUES CFDictionarySetValue(buffer_attributes, kCVPixelBufferOpenGLESCompatibilityKey, kCFBooleanTrue); #elif TARGET_OS_OSX CFDictionarySetValue(buffer_attributes, kCVPixelBufferIOSurfaceOpenGLTextureCompatibilityKey, kCFBooleanTrue); #endif
Everything worked well when I modify the libavcodec/videotoolbox.c, Thank you very much @666tos Your magic script really helped me .
👍
roshnadsouza
commented
Oct 19, 2019
Hi,
I am trying to get the frames of the video, but then i get the below error.
[h264 @ 0x7f8c21030200] No start code is found.
[h264 @ 0x7f8c21030200] Error splitting the input into NAL units.
Can anyone please help me.
tmm1
commented
Dec 20, 2019
Isn't -miphoneos-version-min=13.0.0
also required for catalyst build?
@tmm1
tmm1
Dec 20, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need to call libtool instead of using the .a generated by ffmpeg?
tmm1
commented
Dec 20, 2019
- x86_64 binaries are built without ASM support, since ASM for x86_64 is actually x86 and that confuses
xcodebuild -create-xcframework
This is due to yasm
not injecting platform identifiers (via LC_BUILD_VERSION
load command) into the generated mach-o objects. See https://stackoverflow.com/a/59103419/332798
amayers
commented
Mar 17, 2020
I've gotten the XCFramework
to build using this and modifying the libavcodec/videotoolbox.c
file as mentioned above. However I can't figure out how to import the FFmpeg headers using this method. I have the FFmpeg.xcframework
linked & embedded. I've tried @import FFmpeg;
#import <FFmpeg/<any header I can see in the headers folder>.h>
, #import <FFmpeg/<nested folder>/<file>.h>
and nothing seems to find them. This is all from Objective-C.
@amayers I'm having a similar issue with importing the framework using Swift in an iOS project. Did you manage to figure this out? All I get is No such module 'FFmpeg'
. I have my framework embedded and signed in the Frameworks Libraries and Embedded content section of the General tab and have the framework added in the Link Binary with Libraries section in the Build Phases tab. I also have the Framework Search Paths set to the correct directory of the framework in the Build Settings tab. Is there something I am missing as to how to properly import FFmpeg.xcframework
?
amayers
commented
Jul 10, 2020
@amayers I'm having a similar issue with importing the framework using Swift in an iOS project. Did you manage to figure this out? All I get is
No such module 'FFmpeg'
. I have my framework embedded and signed in the Frameworks Libraries and Embedded content section of the General tab and have the framework added in the Link Binary with Libraries section in the Build Phases tab. I also have the Framework Search Paths set to the correct directory of the framework in the Build Settings tab. Is there something I am missing as to how to properly importFFmpeg.xcframework
?
@Raees678 Not with this repo. But I did get xcframeworks from https://github.com/tanersener/mobile-ffmpeg and with those I just dropped them in and it just worked. I didn’t try from Swift as I have an older Objective-C wrapper around the parts I needed. The strange thing is that project gives you a handful of xcframeworks instead of the one that this PR gives you.
That repo has a nice script to build it with just the things you want, or they have up to date prebuilt releases.
Supported platforms
Issues
xcodebuild -create-xcframework