Skip to content

Instantly share code, notes, and snippets.

@simonkim
simonkim / AVFEditor.swift
Created July 7, 2017 08:43
Swift version of AVCustomEdit sample clone without Custom Compositor
import Foundation
import AVFoundation
struct AVFTransition {
let duration: CMTime = CMTime(seconds: 1.0, preferredTimescale: 1000)
/// tracks must contain 2 elements
func instruction(at startTime: CMTime, tracks: [AVAssetTrack]) -> AVMutableVideoCompositionInstruction {
let timeRange = CMTimeRangeMake(startTime, self.duration)
let instTrans = AVMutableVideoCompositionInstruction()