Skip to content

Instantly share code, notes, and snippets.

@xcadaverx
Created January 20, 2017 23:37
Show Gist options
  • Save xcadaverx/4ed43cf209cdef4e138569ab1334fb92 to your computer and use it in GitHub Desktop.
Save xcadaverx/4ed43cf209cdef4e138569ab1334fb92 to your computer and use it in GitHub Desktop.
let fullRange = CMTimeRange(start: kCMTimeZero, duration: CMTime(value: 30, timescale: 1))
let emptyComposition = AVMutableComposition()
let track = emptyComposition.addMutableTrack(withMediaType: AVMediaTypeVideo, preferredTrackID: 1)
let initialSegment = AVCompositionTrackSegment(url: sourceURL, trackID: 1, sourceTimeRange: fullRange, targetTimeRange: fullRange)
track.segments = [initialSegment]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment