|
@@ -51,16 +51,29 @@ class BFRecordAvatarView: UIView {
|
|
closedBtn.frame = CGRect.init(x: frame.maxX - 68, y: frame.maxY - 68, width: 68, height: 68)
|
|
closedBtn.frame = CGRect.init(x: frame.maxX - 68, y: frame.maxY - 68, width: 68, height: 68)
|
|
do {
|
|
do {
|
|
camera = try Camera(sessionPreset:.high,location: .frontFacing,captureAsYUV: true)
|
|
camera = try Camera(sessionPreset:.high,location: .frontFacing,captureAsYUV: true)
|
|
- // camera.runBenchmark = true
|
|
|
|
|
|
+ //camera.runBenchmark = true
|
|
|
|
|
|
let conertFilter = PQCornerFilter.init()
|
|
let conertFilter = PQCornerFilter.init()
|
|
let cropFilter = Crop.init()
|
|
let cropFilter = Crop.init()
|
|
cropFilter.cropSizeInPixels = videoPixelsSize
|
|
cropFilter.cropSizeInPixels = videoPixelsSize
|
|
cropFilter.cropSizeInPixels = Size(width: 1080, height:1080)
|
|
cropFilter.cropSizeInPixels = Size(width: 1080, height:1080)
|
|
cropFilter.locationOfCropInPixels = Position.init(0, (1920 - 1080) / 2)
|
|
cropFilter.locationOfCropInPixels = Position.init(0, (1920 - 1080) / 2)
|
|
-
|
|
|
|
|
|
+
|
|
// camera --> cropFilter --> conertFilter --> renderView
|
|
// camera --> cropFilter --> conertFilter --> renderView
|
|
- camera --> cropFilter --> conertFilter --> renderView
|
|
|
|
|
|
+
|
|
|
|
+ //创建水印filter
|
|
|
|
+ let weatMaskSticker:PQEditVisionTrackMaterialsModel = PQEditVisionTrackMaterialsModel.init()
|
|
|
|
+ weatMaskSticker.locationPath = "mask"
|
|
|
|
+ weatMaskSticker.timelineIn = 0
|
|
|
|
+ weatMaskSticker.timelineOut = 10000 * 100000
|
|
|
|
+
|
|
|
|
+ let weatMaskFilter = PQImageFilter(sticker: weatMaskSticker, isExport: true,showUISize: CGSize.init(width: 1080, height: 1080))
|
|
|
|
+
|
|
|
|
+ let alphaBlend = AlphaBlend.init()
|
|
|
|
+// camera --> alphaBlend
|
|
|
|
+ camera --> renderView
|
|
|
|
+
|
|
|
|
+// alphaBlend --> renderView
|
|
} catch {
|
|
} catch {
|
|
fatalError("Could not initialize rendering pipeline: \(error)")
|
|
fatalError("Could not initialize rendering pipeline: \(error)")
|
|
}
|
|
}
|
|
@@ -119,6 +132,7 @@ class BFRecordAvatarView: UIView {
|
|
cropFilter.cropSizeInPixels = videoPixelsSize
|
|
cropFilter.cropSizeInPixels = videoPixelsSize
|
|
cropFilter.locationOfCropInPixels = Position.init(0, 0)
|
|
cropFilter.locationOfCropInPixels = Position.init(0, 0)
|
|
|
|
|
|
|
|
+
|
|
camera --> cropFilter --> conertFilter --> movieOutput!
|
|
camera --> cropFilter --> conertFilter --> movieOutput!
|
|
|
|
|
|
camera.audioEncodingTarget = movieOutput
|
|
camera.audioEncodingTarget = movieOutput
|