Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

视频加水印有些视频会报错Error Domain=AVFoundationErrorDomain Code=-11841 "Operation Stopped" UserInfo=0x1625b960 {NSLocalizedDescription=Operation Stopped, NSLocalizedFailureReason=The video could not be composed.} #314

Closed
Ming79432303 opened this issue Oct 11, 2018 · 6 comments

Comments

@Ming79432303
Copy link

#warning 修改 原为 assetVideoTrack 后改为videoTrack 发现可以解决 error code=-11841
AVMutableVideoCompositionLayerInstruction *layerInstruction = [AVMutableVideoCompositionLayerInstruction videoCompositionLayerInstructionWithAssetTrack:videoTrack];

@longitachi
Copy link
Owner

改过之后没出现过错误了吗

@Ming79432303
Copy link
Author

改过之后没出现过错误了吗

是的目前没发现有啥问题

@xxxIxxxx
Copy link

xxxIxxxx commented Oct 26, 2018

因为我的视频不是来自相册,所以我将此方法暴露出来。
调用发现水印添加不成功。没有报错,输出的有地址。

+ (void)export:(AVAsset *)asset range:(CMTimeRange)range type:(ZLExportVideoType)type presetName:(NSString *)presetName renderSize:(CGSize)renderSize watermarkImage:(UIImage *)watermarkImage watermarkLocation:(ZLWatermarkLocation)location imageSize:(CGSize)imageSize effectImage:(UIImage *)effectImage birthRate:(NSInteger)birthRate velocity:(CGFloat)velocity complete:(void (^)(NSString *exportFilePath, NSError *error))complete;

调用方法参数如下


[ZLPhotoManager export:fileAsset range:CMTimeRangeMake(kCMTimeZero, kCMTimePositiveInfinity) type:ZLExportVideoTypeMp4 presetName:AVAssetExportPresetPassthrough renderSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX) watermarkImage:[UIImage imageNamed:@"plc_12"] watermarkLocation:ZLWatermarkLocationTopLeft imageSize:CGSizeMake(100, 100) effectImage:nil birthRate:0 velocity:0 complete:^(NSString *exportFilePath, NSError *error) {
NSSLog(@"exportFilePath == %@",exportFilePath);
    }];

@longitachi

@Ming79432303
Copy link
Author

因为我的视频不是来自相册,所以我将此方法暴露出来。
调用发现水印添加不成功。没有报错,输出的有地址。

+ (void)export:(AVAsset *)asset range:(CMTimeRange)range type:(ZLExportVideoType)type presetName:(NSString *)presetName renderSize:(CGSize)renderSize watermarkImage:(UIImage *)watermarkImage watermarkLocation:(ZLWatermarkLocation)location imageSize:(CGSize)imageSize effectImage:(UIImage *)effectImage birthRate:(NSInteger)birthRate velocity:(CGFloat)velocity complete:(void (^)(NSString *exportFilePath, NSError *error))complete;

调用方法参数如下


[ZLPhotoManager export:fileAsset range:CMTimeRangeMake(kCMTimeZero, kCMTimePositiveInfinity) type:ZLExportVideoTypeMp4 presetName:AVAssetExportPresetPassthrough renderSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX) watermarkImage:[UIImage imageNamed:@"plc_12"] watermarkLocation:ZLWatermarkLocationTopLeft imageSize:CGSizeMake(100, 100) effectImage:nil birthRate:0 velocity:0 complete:^(NSString *exportFilePath, NSError *error) {
NSSLog(@"exportFilePath == %@",exportFilePath);
    }];

@longitachi
水印图片要用.jpg格式的

@xxxIxxxx
Copy link

因为我的视频不是来自相册,所以我将此方法暴露出来。
调用发现水印添加不成功。没有报错,输出的有地址。

+ (void)export:(AVAsset *)asset range:(CMTimeRange)range type:(ZLExportVideoType)type presetName:(NSString *)presetName renderSize:(CGSize)renderSize watermarkImage:(UIImage *)watermarkImage watermarkLocation:(ZLWatermarkLocation)location imageSize:(CGSize)imageSize effectImage:(UIImage *)effectImage birthRate:(NSInteger)birthRate velocity:(CGFloat)velocity complete:(void (^)(NSString *exportFilePath, NSError *error))complete;

调用方法参数如下


[ZLPhotoManager export:fileAsset range:CMTimeRangeMake(kCMTimeZero, kCMTimePositiveInfinity) type:ZLExportVideoTypeMp4 presetName:AVAssetExportPresetPassthrough renderSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX) watermarkImage:[UIImage imageNamed:@"plc_12"] watermarkLocation:ZLWatermarkLocationTopLeft imageSize:CGSizeMake(100, 100) effectImage:nil birthRate:0 velocity:0 complete:^(NSString *exportFilePath, NSError *error) {
NSSLog(@"exportFilePath == %@",exportFilePath);
    }];

@longitachi
水印图片要用.jpg格式的

不行。。

@longitachi
Copy link
Owner

因为我的视频不是来自相册,所以我将此方法暴露出来。
调用发现水印添加不成功。没有报错,输出的有地址。

+ (void)export:(AVAsset *)asset range:(CMTimeRange)range type:(ZLExportVideoType)type presetName:(NSString *)presetName renderSize:(CGSize)renderSize watermarkImage:(UIImage *)watermarkImage watermarkLocation:(ZLWatermarkLocation)location imageSize:(CGSize)imageSize effectImage:(UIImage *)effectImage birthRate:(NSInteger)birthRate velocity:(CGFloat)velocity complete:(void (^)(NSString *exportFilePath, NSError *error))complete;

调用方法参数如下


[ZLPhotoManager export:fileAsset range:CMTimeRangeMake(kCMTimeZero, kCMTimePositiveInfinity) type:ZLExportVideoTypeMp4 presetName:AVAssetExportPresetPassthrough renderSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX) watermarkImage:[UIImage imageNamed:@"plc_12"] watermarkLocation:ZLWatermarkLocationTopLeft imageSize:CGSizeMake(100, 100) effectImage:nil birthRate:0 velocity:0 complete:^(NSString *exportFilePath, NSError *error) {
NSSLog(@"exportFilePath == %@",exportFilePath);
    }];

@longitachi
水印图片要用.jpg格式的

不行。。

@xxxIxxxx 你把视频导入相册,然后用demo试一下看是否能成功添加水印,图片格式jpg和png应该都行

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants