Here's an example code to record video with AVAssetWriter
in Swift:
main.swift2654 chars66 lines
This code creates an AVAssetWriter
, sets the video output settings, creates an AVAssetWriterInput
for the video, starts the writing session and uses the captureOutput
delegate method to append video frames to the input using the AVAssetWriterInputPixelBufferAdaptor
. You can call stopRecording
to stop the recording and finish writing the video to a file.
gistlibby LogSnag