2017-08-10 6 views
1

私はffmpegライブラリをコンパイルしました。私のXCodeプロジェクトにffmpegを追加する

私はXCodeプロジェクトで同じものを実装する必要があります。私のプロジェクトに追加する最善の方法は何ですか。

1つのフレームワークを作成したいが、どのファイルを追加する必要がありますか?

コンパイル後に多数の.cファイルと.aファイルがあります。

答えて

2

私はこれまで、this build scriptを使用してffmpegを統合しました。

特に明記されていない限り、Objective-CプロジェクトとSwiftプロジェクトの両方で使用できる画像の説明は以下のとおりです。

補足として、ffmpegがジョブの正しいツールであることを確認する必要があります。 AVFoundationとVideoToolBoxは、Appleが多くのビデオ操作を行うために提供する非常に強力なツールです。

スクリプトを実行したら、あなたは以下のファイルがあります:

enter image description here

コピープロジェクトへのFFmpeg-のiOSフォルダ:

enter image description here

追加プロジェクトへのファイル:

(ファインダーからのドラッグアンドドロップによる) これらの設定でenter image description here

enter image description here

あなたのヘッダに含まれたディレクトリに追加:

enter image description here

リンクに必要なライブラリ:

enter image description here

を210

(スウィフト専用)架橋ヘッダにヘッダを追加する:

#import "libavcodec/avcodec.h" 
#import "libavdevice/avdevice.h" 
#import "libavfilter/avfilter.h" 
#import "libavformat/avformat.h" 
#import "libavutil/avutil.h" 
#import "libswresample/swresample.h" 
#import "libswscale/swscale.h" 

Objective-Cの単純な例:

#import "AppDelegate.h" 
#import "libavformat/avformat.h" 

@interface AppDelegate() 
@end 

@implementation AppDelegate 

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 

    AVFormatContext *context = avformat_alloc_context(); 

    return YES; 
} 

@end 

かつ迅速に:

import UIKit 

@UIApplicationMain 
class AppDelegate: UIResponder, UIApplicationDelegate { 

    var window: UIWindow? 


    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 

     let context = avformat_alloc_context() 

     return true 
    } 
} 
+0

はいこれは何であります私はコンパイルするのに使ったことがあります...私が知る必要があるのは、コンパイルされたファイルをxcodeに追加することです。 – Saranjith

+0

@Saranjithあなたは迅速か客観的なCを使用していますか? –

+0

私は客観的なCを使用しています。私はビデオのようにMTSを再生する必要があるので、私はこのffmpegが必要です。 – Saranjith

関連する問題