Skip to content

Importing macOS Frameworks

Taner Sener edited this page Jul 15, 2026 · 2 revisions

FFmpegKitNext artifacts are produced locally. Build the macOS package by following Building macOS, then add the generated local package, xcframeworks, or framework bundles to your Xcode project.

Swift Package Manager

Use this option for new Xcode projects and for projects that can consume a local package.

  1. In Xcode, select File -> Add Package Dependencies.

  2. Choose Add Local....

  3. Select the generated folder, for example:

    prebuilt/bundle-apple-xcframework-macos-10.15/
    
  4. Add the ffmpeg-kit package product to the macOS app target.

  5. Import the module from Swift:

    import ffmpegkit

For Objective-C sources, include the framework header:

#include <ffmpegkit/FFmpegKit.h>

Regenerate the package after changing enabled libraries, architectures, build type, or deployment target. The Package.swift references the local xcframeworks by relative path, so keep the generated folder together with the framework bundles it was created for.

Manual xcframework Integration

Use this option when you do not want to add the local Swift package.

Build with -x or --xcframework, then add every generated xcframework from the macOS output folder to the app target:

ffmpegkit.xcframework
libavcodec.xcframework
libavdevice.xcframework
libavfilter.xcframework
libavformat.xcframework
libavutil.xcframework
libswresample.xcframework
libswscale.xcframework

In General -> Frameworks, Libraries, and Embedded Content, set the generated xcframeworks to Embed & Sign for the final app target. If they are not copied into the Xcode project, make sure Framework Search Paths points to the generated output folder.

Manual framework Integration

If you build without -x, framework bundles are created under folders named like:

prebuilt/bundle-apple-framework-macos-10.15/

Add all generated .framework bundles from that folder, not only ffmpegkit.framework.

For app targets, embed and sign the generated frameworks. Add a Run Script phase after Embed Frameworks so unsupported slices are removed from the final app bundle:

${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/ffmpegkit.framework/Resources/strip-frameworks.sh

System Libraries

Always link ffmpegkit together with all generated FFmpeg libraries listed above. If your build enables platform/system options, Xcode may also need the corresponding Apple framework or system library:

  • --enable-macos-audiotoolbox: AudioToolbox
  • --enable-macos-avfoundation: AVFoundation
  • --enable-macos-bzip2: libbz2
  • --enable-macos-coreimage: CoreImage and AppKit
  • --enable-macos-libiconv: libiconv
  • --enable-macos-opencl: OpenCL
  • --enable-macos-opengl: OpenGL
  • --enable-macos-videotoolbox: VideoToolbox
  • --enable-macos-zlib: libz

Some external library combinations may add more link requirements. For example, rubberband and tesseract link Accelerate.

Notes

  • Mac Catalyst apps use the iOS output, not the macOS output.
  • Do not mix frameworks from different builds, deployment targets, or enabled-library sets.
  • Rebuild and re-import the artifacts after changing build options.

Clone this wiki locally