PryntTrimmerView
PryntTrimmerView copied to clipboard
Trim video issue.
I'm trim video using this PryntTrimmerView lib. I have set min 15 second & max 60 second but save video total duration is 52 second.
Can you provide an example (video asset included) to reproduce please ? What was the duration of the original asset ?
This is export trim video code....
do { let asset = AVURLAsset(url: asset_url) let trimmedAsset = try asset .assetByTrimming(startTime: trimmerView.startTime ?? kCMTimeZero, endTime: trimmerView.endTime ?? url_AVURLAsset.duration)
let destinationURL = URL(fileURLWithPath: NSTemporaryDirectory())
.appendingUniquePathComponent(pathExtension: "mov")
print(destinationURL)
try trimmedAsset.export(to: destinationURL) { [weak self] in
//guard let strongSelf = self else { return }
print("save \(destinationURL)")
DispatchQueue.global(qos: .background).async {
let data = NSData(contentsOf: destinationURL)
print("File size before compression: \(Double((data?.length)! / 1048576)) mb")
self?.compressVideoOutput(videoURL: destinationURL)
}
}
} catch let error {
print("💩 \(error)")
}
I'm set max 1 minit video allow otherwise is automatically trim.