You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all Thanks to the MetalPetal team, I have build an application using this awesome library.
but while testing the application I have found one memory crash which related to asset transform.
I am using MTIVideoComposition to get every frame of the video to process
in this block I am applying multiple filters on the video.
the composition I am using has max 20 video tracks
While testing I found that whenever I am applying transform on the source image as per the video the memory is getting too hight and at the end memory crash is occurring.
I have found this method to apply transform on the source image
this is the code I am using to render every frame of the video and applying transform let videoComposition = MTIVideoComposition(asset: composition, context: renderContext,
queue: DispatchQueue.main, filter: { [weak self] request in
guard let self else { return MTIImage.black }
var sourceImage = request.anySourceImage.applyingAssetTrackTransform(transform) ?? .black
return sourceImage
})
Kindly help me to fix this.
The text was updated successfully, but these errors were encountered:
First of all Thanks to the MetalPetal team, I have build an application using this awesome library.
but while testing the application I have found one memory crash which related to asset transform.
I am using MTIVideoComposition to get every frame of the video to process
in this block I am applying multiple filters on the video.
the composition I am using has max 20 video tracks
While testing I found that whenever I am applying transform on the source image as per the video the memory is getting too hight and at the end memory crash is occurring.
I have found this method to apply transform on the source image
extension MTIImage { public func applyingAssetTrackTransform(_ transform: CGAffineTransform) -> MTIImage { let transformFilter = MTITransformFilter() transformFilter.inputImage = self var transform = transform transform.tx = 0 transform.ty = 0 transformFilter.transform = CATransform3DMakeAffineTransform(transform.inverted()) transformFilter.viewport = transformFilter.minimumEnclosingViewport return transformFilter.outputImage! } }
this is the code I am using to render every frame of the video and applying transform
let videoComposition = MTIVideoComposition(asset: composition,
context: renderContext,
queue: DispatchQueue.main, filter: { [weak self] request in
guard let self else { return MTIImage.black }
})
Kindly help me to fix this.
The text was updated successfully, but these errors were encountered: