2013-01-07 9 views
6

Video Encoding using AVAssetWriter - CRASHESに記載されているように、基本的にはフォトギャラリー/アセットライブラリから取得したビデオを読み込み、別のビットレートで書き込んで(最終的なネットワークアップロードのために)スタイルを使用しています。AVAssetReaderで使用するピクセルフォーマットタイプ(kCVPixelBufferPixelFormatTypeKey)の選択方法は?

これが私たちのために働くことを得るためにトリックは、AVAssetReaderTrackOutputにこのような何かoutputSettingskCVPixelBufferPixelFormatTypeKeyキーと値を指定するためにした

NSDictionary *outputSettings = [NSDictionary 
    dictionaryWithObject:[NSNumber numberWithInt:kCVPixelFormatType_32BGRA] 
        forKey:(id)kCVPixelBufferPixelFormatTypeKey];  
readerTrackOutput = 
    [[AVAssetReaderTrackOutput alloc] initWithTrack:src_track 
            outputSettings:outputSettings]; 

をだから、基本的に、私たちはkCVPixelBufferPixelFormatTypeKeyキーのkCVPixelFormatType_32BGRA値を使用。

しかし、明らかに、私たちが選択できる多くの可能なピクセル形式の種類があります。コードを実行すると、iOSの6.0.1 iPhoneデバイス上でTechnical Q&A QA1501: Core Video - Available Pixel Formatsに述べたように、ここでは示しサポートピクセルフォーマットの種類のリストです:

Core Video Supported Pixel Format Types: 
Core Video Pixel Format Type: 32 
Core Video Pixel Format Type: 24 
Core Video Pixel Format Type: 16 
Core Video Pixel Format Type (FourCC): L565 
Core Video Pixel Format Type (FourCC): 2vuy 
Core Video Pixel Format Type (FourCC): yuvs 
Core Video Pixel Format Type (FourCC): yuvf 
Core Video Pixel Format Type: 40 
Core Video Pixel Format Type (FourCC): L008 
Core Video Pixel Format Type (FourCC): 2C08 
Core Video Pixel Format Type (FourCC): r408 
Core Video Pixel Format Type (FourCC): v408 
Core Video Pixel Format Type (FourCC): y408 
Core Video Pixel Format Type (FourCC): y416 
Core Video Pixel Format Type (FourCC): BGRA 
Core Video Pixel Format Type (FourCC): b64a 
Core Video Pixel Format Type (FourCC): b48r 
Core Video Pixel Format Type (FourCC): b32a 
Core Video Pixel Format Type (FourCC): b16g 
Core Video Pixel Format Type (FourCC): R10k 
Core Video Pixel Format Type (FourCC): v308 
Core Video Pixel Format Type (FourCC): v216 
Core Video Pixel Format Type (FourCC): v210 
Core Video Pixel Format Type (FourCC): v410 
Core Video Pixel Format Type (FourCC): r4fl 
Core Video Pixel Format Type (FourCC): grb4 
Core Video Pixel Format Type (FourCC): rgg4 
Core Video Pixel Format Type (FourCC): bgg4 
Core Video Pixel Format Type (FourCC): gbr4 
Core Video Pixel Format Type (FourCC): 420v 
Core Video Pixel Format Type (FourCC): 420f 
Core Video Pixel Format Type (FourCC): 411v 
Core Video Pixel Format Type (FourCC): 411f 
Core Video Pixel Format Type (FourCC): 422v 
Core Video Pixel Format Type (FourCC): 422f 
Core Video Pixel Format Type (FourCC): 444v 
Core Video Pixel Format Type (FourCC): 444f 
Core Video Pixel Format Type (FourCC): y420 
Core Video Pixel Format Type (FourCC): f420 
Core Video Pixel Format Type (FourCC): a2vy 
Core Video Pixel Format Type (FourCC): L00h 
Core Video Pixel Format Type (FourCC): L00f 
Core Video Pixel Format Type (FourCC): 2C0h 
Core Video Pixel Format Type (FourCC): 2C0f 
Core Video Pixel Format Type (FourCC): RGhA 
Core Video Pixel Format Type (FourCC): RGfA 

kCVPixelFormatType_32BGRAが私たちのために(少なくとも表面上は)働いていたにもかかわらず、我々は興味があります上記のリストよりも優れた選択肢があるかどうか。私たちに正しいピクセルフォーマットタイプを選ぶにはどうすればいいですか?

+0

は、も参照してください。これは、GLおよびスクリーンカラースペースに変換するために使用されるフラグメントシェーダに引き渡すことができます。 – MrMaxP

答えて

1

異なる設定を試し、性能を比較することができます。異なるピクセルフォーマットでエンコーダにバッファを提供することは、エンコード性能の違いをもたらす可能性がある。ハードウェアアクセラレーションされたエンコーダは、しばしば "420v"を使用します。デコードされた生のビデオフレームのためのハードウェア互換性のあるテクスチャフォーマットがあった場合、あなたはその形式で取得することは、たとえばRGBに変換するよりも速くなると思うだろうQuery for optimal pixel format when capturing video on iOS?

関連する問題