'Rendering a video with CIFilters

Desired output (pun intended)

Capture video (and audio) and then directly apply time stamp and GPS coordinates as a layer on top of the video to instantly/directly embed them in the recording. (e.g. via subview/layer or CIFilter). The text layer is dynamic, e.g. timestamp keeps changing as film is rolling.

How To Add Text to Video in Swift and AVFoundation Tutorial: Adding Overlays and Animations to Videos both describes how to do it in post production (i.e. when the file is already saved). But this adds considerable time to UX, e.g if you record a 1 min video, this would take another 30 seconds to embed after, not desired UX.

Is there a way to embed the text/CIfilter directly before saving the video?

The approach of editing each frame "manually" in capture output is slow (5-10 frames per second only).

Adding AVVideoCompositing seem like the right approach, but I don't know where to "hook it up". In the AVCaptureOutput? Or is it possible directly in the AVCaptureMovieFileOutput?

Does anyone have a GitHub repo or sample code of how to approach?

Any help appreciated. Thank you!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source