kewlbear / FFmpeg-iOS-build-script

Shell scripts to build FFmpeg for iOS and tvOS
3.03k stars 898 forks source link

Implemented building single XCFramework #147

Open 666tos opened 5 years ago

666tos commented 5 years ago

Supported platforms

Issues

666tos commented 5 years ago

Now fixing issues and submitting PR with fix to FFmpeg

kewlbear commented 5 years ago

Don't you get an error like above while building for macCatalyst?

simayang01 commented 5 years ago

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 !

666tos commented 5 years ago

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 5 years ago

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

Everything worked well when I modify the libavcodec/videotoolbox.c, Thank you very much @666tos Your magic script really helped me .

666tos commented 5 years ago

👍

roshnadsouza commented 5 years ago

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 4 years ago

Isn't -miphoneos-version-min=13.0.0 also required for catalyst build?

tmm1 commented 4 years ago
  • 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 4 years ago

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.

Raees678 commented 4 years ago

@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 4 years ago

@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?

@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.