AVCaptureVideoDataOutput
概要
ビデオデータのキャプチャに利用できる
設定項目
alwaysDiscardsLateVideoFrames
AVCaptureVideoDataOutput では、ビデオのフレームは delegate メソッド経由で受け取る。true の場合、この delegate メソッドによって queue がブロッキングされている間... すなわち届いたフレームを処理している間に届いたフレームは即座に破棄する。false の場合、フレーム群を処理するためにより多くの時間が必要となり、メモリ使用量が大幅に増える可能性がある。デフォルトでは true。
videoSettings
映像の圧縮関連の設定が行える。設定可能な項目は下記。また、kCVPixelBufferPixelFormatTypeKey もサポートしている。
https://developer.apple.com/documentation/avfoundation/avassetwriterinput/video_settings_dictionaries
kCVPixelBufferPixelFormatTypeKey
Pixel Format の種類を指定する。指定可能な値は下記。
https://developer.apple.com/documentation/corevideo/1563591-pixel_format_identifiers
kCVPixelBufferMetalCompatibilityKey
doc では、CVPixelBuffer で定義された attribute key は CVPixelBufferPixelFormatTypeKey のみと記載されているが、どうやら Metal Compatibility Key もみられているようだ。キャプチャしたバッファーを Metal で利用できるか?のフラグとなっている。
https://stackoverflow.com/questions/46549906/cvmetaltexturecachecreatetexturefromimage-returns-6660-on-macos-10-13
AVVideoCodecKey
iOS の場合、キャプチャした映像のフォーマットはデフォルトでは HEVC である。これを別のコーデックに変更することができる。
https://developer.apple.com/documentation/avfoundation/cameras_and_media_capture/capturing_video_in_alternative_formats
コーデックの一覧は下記。
https://developer.apple.com/documentation/avfoundation/avvideocodectype