|
@@ -146,9 +146,9 @@ class PQMovieFilter: PQBaseFilter {
|
|
do {
|
|
do {
|
|
// 测试代码
|
|
// 测试代码
|
|
// try loadAsset(url:URL(fileURLWithPath:"22222.MP4", relativeTo:Bundle.main.resourceURL!), videoComposition: nil)
|
|
// try loadAsset(url:URL(fileURLWithPath:"22222.MP4", relativeTo:Bundle.main.resourceURL!), videoComposition: nil)
|
|
- // locationPath 有可能直接使用系统相册地址 e.g.视频地址 var/mobile/Media/DCIM/125APPLE/IMG_5189.MOV 就不用拼接沙盒地址了
|
|
|
|
|
|
+ // locationPath 有可能直接使用系统相册地址 处理不同 IOS 版本 路径有所区别 e.g.视频地址 var/mobile/Media/DCIM/125APPLE/IMG_5189.MOV 就不用拼接沙盒地址了
|
|
var videoFilePath = movieSticker.locationPath
|
|
var videoFilePath = movieSticker.locationPath
|
|
- if !videoFilePath.contains("var/mobile/Media/DCIM/") {
|
|
|
|
|
|
+ if !videoFilePath.contains("var/mobile/Media") {
|
|
videoFilePath = documensDirectory + videoFilePath
|
|
videoFilePath = documensDirectory + videoFilePath
|
|
}
|
|
}
|
|
FilterLog(message: "视频地址 \(String(describing: videoFilePath))")
|
|
FilterLog(message: "视频地址 \(String(describing: videoFilePath))")
|
|
@@ -347,6 +347,7 @@ class PQMovieFilter: PQBaseFilter {
|
|
|
|
|
|
BFLog(message: "查找的帧时间为:\(CMTimeGetSeconds(showTimeStamp))")
|
|
BFLog(message: "查找的帧时间为:\(CMTimeGetSeconds(showTimeStamp))")
|
|
|
|
|
|
|
|
+ let beginDecoderTime: TimeInterval = Date().timeIntervalSince1970
|
|
if assetReader == nil {
|
|
if assetReader == nil {
|
|
FilterLog(message: "assetReader is error 出现严重错误!!!!!!!!!!!!!!")
|
|
FilterLog(message: "assetReader is error 出现严重错误!!!!!!!!!!!!!!")
|
|
return nil
|
|
return nil
|
|
@@ -362,7 +363,6 @@ class PQMovieFilter: PQBaseFilter {
|
|
|
|
|
|
while assetReader?.status == .reading {
|
|
while assetReader?.status == .reading {
|
|
|
|
|
|
- let beginDecoderTime: TimeInterval = Date().timeIntervalSince1970
|
|
|
|
targetSampleBuffer = videoTrackOutput!.copyNextSampleBuffer()
|
|
targetSampleBuffer = videoTrackOutput!.copyNextSampleBuffer()
|
|
if(targetSampleBuffer == nil){
|
|
if(targetSampleBuffer == nil){
|
|
BFLog(message: " copyNextSampleBuffer is nil error!!!")
|
|
BFLog(message: " copyNextSampleBuffer is nil error!!!")
|
|
@@ -372,13 +372,13 @@ class PQMovieFilter: PQBaseFilter {
|
|
|
|
|
|
//目标帧 时间
|
|
//目标帧 时间
|
|
if targetSampleBuffer != nil && CMTimeGetSeconds(targetTimeStamp) > CMTimeGetSeconds(showTimeStamp){
|
|
if targetSampleBuffer != nil && CMTimeGetSeconds(targetTimeStamp) > CMTimeGetSeconds(showTimeStamp){
|
|
- FilterLog(message: "查找的帧时间为:\(CMTimeGetSeconds(showTimeStamp)) 命中时间为: \(CMTimeGetSeconds(targetTimeStamp))")
|
|
|
|
-
|
|
|
|
|
|
+ let endDecoderTime: TimeInterval = Date().timeIntervalSince1970
|
|
|
|
+ FilterLog(message: "查找的帧时间为:\(CMTimeGetSeconds(showTimeStamp)) 命中时间为: \(CMTimeGetSeconds(targetTimeStamp)) 查找时长为\(TimeInterval(endDecoderTime - beginDecoderTime)))")
|
|
|
|
+
|
|
return targetSampleBuffer
|
|
return targetSampleBuffer
|
|
|
|
|
|
}
|
|
}
|
|
- let endDecoderTime: TimeInterval = Date().timeIntervalSince1970
|
|
|
|
- FilterLog(message: "\(beginDecoderTime) \(endDecoderTime)解帧时长 \(TimeInterval(endDecoderTime - beginDecoderTime))")
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
return nil
|
|
return nil
|