TakeVideo
No description available
Install / Use
/learn @cl0ver012/TakeVideoREADME
TakeVideo
An iOS project that takes video with customized User Interfaces and water mark and compression by AVFoundation.framework , AVCaptureSession, AVAssetWriter, AVCaptureOutput and AVCaptureDeviceInput, AVVideoCompositionInstruction, AVVideoComposition etc.
Effect Picture

Let's get started
There're Four ways to call. I'm going to show you on how do you call it. 中文博客地址
First way
Importing this header file
#import "ZRMediaCaptureController.h"
Then calling the code as shown below. This way is using the default User Interface which means that has done by System Defined
ZRMediaCaptureController *manager = [[ZRMediaCaptureController alloc] init];
[manager setVideoCaptureType:ZRMediaCaptureTypeDefault completion:^(int statusCode, NSString *errorMessage, NSURL *videoURL, NSTimeInterval videoInterval) {
NSLog(@"视频地址:%@", videoURL.absoluteString);
if (errorMessage.length) {
NSLog(@"拍摄视频失败 %@", errorMessage);
} else {
//to do so
//[self previewVideo:videoURL interval:videoInterval useFirstCompression:YES];
}
}];
[self presentViewController:manager animated:YES completion:nil];
Second way
Importing this header file
#import "ZRMediaCaptureController.h"
Then calling the code as shown below. The only difference is CaptureType. This way is customized User Interface, and the tailored UI is popular at present, most of apps are using this way.
ZRMediaCaptureController *manager = [[ZRMediaCaptureController alloc] init];
[manager setVideoCaptureType:ZRMediaCaptureTypeCustomizedUI completion:^(int statusCode, NSString *errorMessage, NSURL *videoURL, NSTimeInterval videoInterval) {
NSLog(@"视频地址:%@", videoURL.absoluteString);
if (errorMessage.length) {
NSLog(@"拍摄视频失败 %@", errorMessage);
} else {
//to do so
//[self previewVideo:videoURL interval:videoInterval useFirstCompression:YES];
}
}];
[self presentViewController:manager animated:YES completion:nil];
Third way
Importing this header file
#import "ZRVideoCaptureViewController.h"
Then calling the code as shown below. This is third way to call. The tailored UI(User Interface) that are fitted for the most of apps that is prevalent on WeChat, Snapchat, Instagram, etc. If you want to get deeply tailored UI, you can add some views in this way. This way has been done by AVCaptureSession.
ZRVideoCaptureViewController * videoCapture = [[ZRVideoCaptureViewController alloc] init];
[videoCapture setCaptureCompletion:^(int statusCode, NSString *errorMessage, NSURL *videoURL, NSTimeInterval videoInterval) {
NSLog(@"视频地址:%@", videoURL.absoluteString);
if (errorMessage.length) {
NSLog(@"拍摄视频失败 %@", errorMessage);
} else {
//to do so
//[self previewVideo:videoURL interval:videoInterval useFirstCompression:YES];
}
}];
[self presentViewController:videoCapture animated:YES completion:nil];
Fourth way
Importing this header file
#import "ZRTakeVideoViewController.h"
Then calling the code as shown below. This is fourth way to call. The tailored UI(User Interface) that are fitted for the most of apps that is prevalent on WeChat, Snapchat, Instagram, etc. If you want to get deeply tailored UI, you can add some views in this way. This way has been done by AVCaptureSession and AVAssetWriter.
ZRTakeVideoViewController *takeVideo = [[ZRTakeVideoViewController alloc] init];
takeVideo.averageBitRate = 4.0;
[takeVideo setCaptureCompletion:^(int statusCode, NSString *errorMessage, NSURL *videoURL, NSTimeInterval videoInterval) {
NSLog(@"视频地址:%@", videoURL.absoluteString);
if (errorMessage.length) {
NSLog(@"拍摄视频失败 %@", errorMessage);
} else {
//[self previewVideo:videoURL interval:videoInterval useFirstCompression:NO];
//to do so
}
}];
[self presentViewController:takeVideo animated:YES completion:nil];
Pay Attention to This compression video file
If you want to compress your video file, you must call one of these snippet code.
[ZRMediaCaptureController videoCompressWithSourceURL:videoURL completion:^(int statusCode, NSString *outputVideoURL) {
}];
or using the following way
NSURL *outputFileURL = [NSURL fileURLWithPath:[ZRAssetExportSession generateAVAssetTmpPath]];
ZRAssetExportSession *encoder = [ZRAssetExportSession.alloc initWithAsset:[AVAsset assetWithURL:self.originalURL]];
encoder.outputFileType = AVFileTypeMPEG4;
encoder.outputURL = outputFileURL;
[encoder exportAsynchronouslyWithCompletionHandler:^
{
if (encoder.status == AVAssetExportSessionStatusCompleted)
{
}
else if (encoder.status == AVAssetExportSessionStatusCancelled)
{
}
else
{
}
}];
Pay Attention to This water print video
Importing the header file
#import "ZRWaterPrintComposition.h"
Then, call the following code
[[ZRWaterPrintComposition new] addVideoWaterprintAtURL:self.playURL WithWaterprintImage:[UIImage imageNamed:@"Icon"] withTitleText:@"Victor" iconSize:CGSizeMake(120, 120) completionHandler:^(int status, NSString *errorMsg, NSURL *finishedVideoURL) {
if (status == 0) {
self.playURL = finishedVideoURL;
} else {
NSLog(@"%@", errorMsg);
}
}];
Related Skills
qqbot-channel
347.6kQQ 频道管理技能。查询频道列表、子频道、成员、发帖、公告、日程等操作。使用 qqbot_channel_api 工具代理 QQ 开放平台 HTTP 接口,自动处理 Token 鉴权。当用户需要查看频道、管理子频道、查询成员、发布帖子/公告/日程时使用。
docs-writer
100.2k`docs-writer` skill instructions As an expert technical writer and editor for the Gemini CLI project, you produce accurate, clear, and consistent documentation. When asked to write, edit, or revie
model-usage
347.6kUse CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.
cursor-agent-tracking
134A repository that provides a structured system for maintaining context and tracking changes in Cursor's AGENT mode conversations through template files, enabling better continuity and organization of AI interactions.
