0

I'm trying to add some transparent animation videos to my composition as a transition but in my custom compositor (AVVideoCompositing) when I try to get pixel buffer via AVAsynchronousVideoCompositionRequest.sourceFrame it returns nil. If I use non transparent H.264 (mp4) video it works. Transparent video (mov) is encoded with Timecode and Apple ProRes 4444.

Should I try with HEVC? I've seen some suggestions to use Chroma CIFilter on non-transparent video to remove the background, but I'm not sure if that's a right approach.

The desired effect for animated transitions could be seen here.

manikal
  • 953
  • 7
  • 30
  • Usually what is done here is to embed the alpha channel in the non-alpha supporting format (like h264) next to/above/above/below the colour channels, and then use the GPU to create RGBA output, suitable to return from `AVAsynchronousVideoCompositionRequest.sourceFrame`. – Rhythmic Fistman Jun 10 '21 at 14:11

1 Answers1

0

ProRes is actually not supported on iOS. However, you should be able to use CMVideoCodecType.hevcWithAlpha for your use case.

To get a list of available encoders, you can do the following:

import VideoToolbox

var encoders: CFArray?
VTCopyVideoEncoderList(nil, &encoders)
print(encoders!)
Frank Rupprecht
  • 9,191
  • 31
  • 56