Skip to content

Commit

Permalink
校正微信视频自身旋转矩阵
Browse files Browse the repository at this point in the history
  • Loading branch information
CoderHenry66 committed Jun 19, 2019
1 parent 7c3e5a7 commit 3d91c69
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 5 deletions.
8 changes: 4 additions & 4 deletions WAVideoBox.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -564,14 +564,14 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 55RAX8ZP36;
DEVELOPMENT_TEAM = 9U3V48REK3;
INFOPLIST_FILE = WAVideoBox/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = cn.doudle.videoBox.WAVideoBox;
PRODUCT_BUNDLE_IDENTIFIER = cn.henry.videoBox;
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = "1,2";
};
Expand All @@ -582,14 +582,14 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 55RAX8ZP36;
DEVELOPMENT_TEAM = 9U3V48REK3;
INFOPLIST_FILE = WAVideoBox/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = cn.doudle.videoBox.WAVideoBox;
PRODUCT_BUNDLE_IDENTIFIER = cn.henry.videoBox;
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = "1,2";
};
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>WAVideoBox.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
</dict>
</plist>
17 changes: 16 additions & 1 deletion WAVideoBox/WAVideoBox/WAAVSeCommand/WAAVSECommand.m
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ - (void)performVideoCompopsition{
AVAssetTrack *videoTrack = [self.composition.mutableComposition tracksWithMediaType:AVMediaTypeVideo][0];

AVMutableVideoCompositionLayerInstruction *passThroughLayer = [AVMutableVideoCompositionLayerInstruction videoCompositionLayerInstructionWithAssetTrack:videoTrack];
[passThroughLayer setTransform:self.assetVideoTrack.preferredTransform atTime:kCMTimeZero];
[passThroughLayer setTransform:[self transformFromDegress:self.trackDegress natureSize:self.assetVideoTrack.naturalSize] atTime:kCMTimeZero];
passThroughInstruction.layerInstructions = @[passThroughLayer];

[self.composition.instructions addObject:passThroughInstruction];
Expand Down Expand Up @@ -157,6 +157,21 @@ - (NSUInteger)degressFromTransform:(CGAffineTransform)transForm
return degress;
}

- (CGAffineTransform)transformFromDegress:(float)degress natureSize:(CGSize)natureSize{
/** 矩阵校正 */
// x = ax1 + cy1 + tx,y = bx1 + dy2 + ty
if (degress == 90) {
return CGAffineTransformMake(0, 1, -1, 0, natureSize.height, 0);
}else if (degress == 180){
return CGAffineTransformMake(-1, 0, 0, -1, natureSize.width , natureSize .height);
}else if (degress == 270){
return CGAffineTransformMake(0, -1, 1, 0, -natureSize.height, 2 * natureSize.width);
}else{
return CGAffineTransformIdentity;
}
}



NSString *const WAAVSEExportCommandCompletionNotification = @"WAAVSEExportCommandCompletionNotification";
NSString* const WAAVSEExportCommandError = @"WAAVSEExportCommandError";
Expand Down

0 comments on commit 3d91c69

Please sign in to comment.