Capture and compress video into H.264 with AVFoundation/VideoToolbox in Swift 4 with Xcode 9 beta 5.
Inspired by loyinlin's and zerdzhong's great work.
This project is based on AVFoundation
to preview and capture uncompressed CMSampleBuffer
and VideoToolbox
to compress into H.264 file. You could use mpv
or IINA
to preview the generated file.
And this blog discusses the details.