RDVECore features Overview
RDVECore is a uI-free, highly abstract API video editing SDK launched by Rui Rui. It supports the following functions:
1.1 Rich editing functions
RDVECore contains a wealth of basic functions, for the editing of video, pictures, music has a variety of processing methods, and can be combined according to the actual business needs, all processing can be accurate to the millisecond level, to achieve the most professional requirements, the main functions are as follows: The RDVEUISDK itself provides a variety of filter effects for developers to choose from, while allowing users to extend the filters according to their own needs. According to the Principle of principle, subtitles can be displayed at a certain location during a certain period of time. Soundtrack and dubbing can be added during a specified period of time. Support dubbing, soundtrack and video audio ratio adjustment; Add more music to the local system according to the Bill. Intercept and split video at the millisecond level. Supports quick preview, clip, and segmentation, and adjusts the playing speed of a video by playing it either fast or slow, supporting multiple transitions. Extended Settings such as random transition and specified transition duration are supported. Other editing functions support multiple proportional clipping. Support 90, 180, 270 degree rotation video picture; Supports left and right mirroring and upper and lower mirroring. Support output ratio adjustment;
1.2 Perfect video shooting function
real-time facial Can real-time facial skin in the process of filming, brighten and whiten skin effect, achieve facial beautification, at the same time, the adjustment of the support degree of beautification face stickers/hang support face recognition and stickers/widgets display shooting freedom definition RDVECore during filming, can according to the specific record demand, for liberalisation of the Settings, Have better and excellent shooting and recording effect. Multiple shooting A video can be divided into multiple shooting sessions. The cameras can switch freely before and after camera switching, and there is no lag in the middle. Multiple ratios 1:1, 9:16 and 16:9 zoom recording and focusing. Filters can also be added in real time, and the RDVEUISDK itself provides a rich selection of filters for developers to choose from, while users can also extend filters to suit their own needs. Save the current camera screen to the RDVECore architecture diagram:
RDVECore brief flowchart:
2.1 Operating Environment
The SDK supports iOS7.0 and later devices, compatible with iPhone, iPad, and iPod touch
2.2 Registering and applying for AppKey and APPSecret 2.2.1 Open www.rdsdk.com/ and choose login or registration on the homepage of Ruizun official website. New users register first and old users log in directly. 2.2.2 After login, enter the video cloud management, click “+ Add”, fill in the name you should use, and click “Submit” to complete the application creation. 2.2.3 After creating an application, the system automatically jumps to the personal center page and obtains the AppKey and AppSecret of the application.
2.3 Downloading and Importing the SDK
2.3.1 Add static library Librdvcore. a and header file
Add RDVECore 2.3.2. Bundle
2.3.3 Project Setup Scenography TARGETS Deployment Info is selected only for Portrait and unlandscapeleft:
IOS10 adaptation in the Info. Add NSCameraUsageDescription, NSMicrophoneUsageDescription, NSPhotoLibraryUsageDescription plist.
Buy a way to add a reference to apple’s official library
Log in to the TARGETS->Build Settings->Other Linker Flags to add -objc.
2.4 Editing a Video
2.4.1 Importing header files and Initialization
#import “rdvcore. h” /* Initializes the object
- @param AppKey Application Key registered in the official website of Ruizhi SDK (www.rdsdk.com/).
- @param AppSecret Application secret registered in the official website of Ruizun SDK (www.rdsdk.com/).
- @param size Video resolution
- @param FPS video frame rate (1-30)
- @param resultFailBlock callback for initialization failure [error: error code for initialization failure]
* /- (instancetype) initWithAPPKey:(NSString *)appkey
APPSecret:(NSString *)appsecret videoSize:(CGSize)size fps:(int)fps resultFail:(void (^)(NSError *error))resultFailBlock;Copy the code
- (instancetype) initWithAPPKey:(NSString *)appkey
NSMutableArray scenes = [NSMutableArray new]; RDScene scene = [[RDScene alloc] init]; [scenes addObject:scene]; AddScenes to the player [_videoCoreSDK addScenes:scenes]. _VideoCoresdk. frame = CGRectMake(0, 0, [UIScreen mainScreen].bound.size. Width, [UIScreen mainScreen].bounds.size.width); _videoCoreSDK.delegate = self; _videoCoreSDK.shouldRepeat = YES; 4. Construct virtual video [_videoCoreSDK build]; 5, Add player to view [self.view addSubview: _videoCoresdk.view]; 1. Initialize MV NSMutableArray selectMVEffects = [NSMutableArray array]; VVMovieEffect mvEffect = [[VVMovieEffect alloc] init]; [selectMVEffects addObject:mvEffect]; @property (nonatomic,strong) NSURL* _Nullable URL;
@property (nonatomic,assign) CMTimeRange timeRange;
//MV type @property (nonatomic,assign) RDVideoMVEffectType type; 3, add video to the player, or will be removed from the player 1 MV) add [_videoCoreSDK addMVEffect: selectMVEffects]; 2) Remove [_videoCoreSDK addMVEffect:nil]; 4. Reconstruct virtual video [_videoCoreSDK build];
RDMusic = [[RDMusic alloc] init]; /** music timeRange / @property (nonatomic, assign) CMTimeRange timeRange
/ @property (nonatomic, assign) CMTimeRange clipTimeRange;
/ / @property (nonatomic, strong) NSString *_Nullable name;
/* Volume (0.0-1.0), default 1.0 / @property (nonatomic, assign) float Volume;
/ @property (nonatomic, assign) BOOL isRepeat; 1) Add: [_videoCoreSDK addMusic:music]; Remove: [_videoCoreSDK addMusic:nil]; 4. Reconstruct virtual video [_videoCoreSDK build];
1. Initialize dubbing. NSMutableArray dubbingArr = [NSMutableArray array]; RDMusic music = [[RDMusic alloc] init]; [dubbingArr addObject:music]; 2, set the voice properties: with score 3, add the voice to the player, or add dubbing removed from the player 1) : [_videoCoreSDK addDubbingMusics: dubbingArr]; Remove: [_videoCoreSDK addDubbingMusics:nil]; 4. Reconstruct virtual video [_videoCoreSDK build]; 2.4.6 subtitles, special effects, when initializing player 1 set _videoCoreSDK. FrameLayerBlock = ^ (CMTime currentTime, CALayer layer) { [weakSelf addSubLayerToFront:layer time:currentTime]; }; NSMutableArray Effects = [NSMutableArray Array]; RDCaption caption = [[RDCaption alloc] init]; [effects addObject:caption]; Assign CGPoint captionCenter / @property (nonatomic,assign) CGPoint captionCenter; /* Subtitle width point ratio / @property (nonatomic,assign) CGFloat widthProportion;
/* Subtitle frame rate / @property (nonatomic,assign) CGFloat FPS;
/* subtitle timeRange / @property (nonatomic,assign) CMTimeRange;
/ @property (nonatomic,assign) float Angle;
/* subtitle size / @property (nonatomic,assign) float scale;
/*id /
@property (nonatomic ,assign) NSInteger pid;
/* Map type 0 with text,1 without text / @property (nonatomic,assign) NSInteger type;
/ @property (nonatomic,copy) NSString *_Nullable path;
/ @property (nonatomic,copy) NSString *_Nullable name;
/* Duration / @property (nonatomic,assign) float duration;
/ / @property (nonatomic,assign) NSInteger count;
/* Image area / @property (nonatomic,assign) CGRect frame;
/* Original image size / @property (nonatomic,assign) CGSize size;
@property (nonatomic,copy) NSString *_Nullable pText;
@property (nonatomic,strong) UIImage *_Nullable tImage;
/ @property (nonatomic,copy) NSString _Nullable tFontName; / @property (nonatomic,assign) float tFontSize;
/* Text rotation degree / @property (nonatomic,assign) float tAngle;
@property (nonatomic,strong) UIColor *_Nullable tColor;
@property (nonatomic,strong) UIColor * _Nullable strokeColor;
/* Text strokeWidth / @property (nonatomic,assign) float strokeWidth;
/* Text area / @property (nonatomic,assign) CGRect tFrame;
/* Text start time / @property (nonatomic,assign) float tBegin;
/* End time / @property (nonatomic,assign) float tEnd;
/ @property (nonatomic,strong) NSArray *_Nullable frames;
@property (nonatomic,strong) NSArray *_Nullable times;
/ @property (nonatomic, assign) BOOL tStretching;
/ @property (nonatomic) UIEdgeInsets;
/ @property (nonatomic) CGRect contentsCenter;
/* @property (nonatomic, strong) RDMusic _Nullable music; CaptionLayer CaptionLayer CaptionLayer = [[CaptionLayer alloc] initWithCaption: Caption videoSize:videoSize];
- 5. Within the timeRange display range of subtitles (effects), add the captionLayer to the layer in 1 and. For details, see RDVEUISDK.
Add all filters NSMutableArray globalFilters = [NSMutableArray array]; 1) Initialize filter RDFilter = [RDFilter new]; [globalFilters addObject:filter]; /* Filter type / @property (nonatomic,assign)NSInteger type;
/ @property (nonatomic,copy)NSString *name;
/* Filter acv address / @property (nonatomic,copy)NSString *acvPath; 3) add all filters [_videoCoreSDK addGlobalFilters: globalFilters]; 2, set up filters [_videoCoreSDK setGlobalFilter: selectFilterIndex];
Params: url video source address params: outputUrl output path params: timeRange timeRange in reverse order params: videoSpeed videoSpeed params: ProgressBlock Reverse Progress Callback Params: finishBlock Ends Callback params: failBlock fails Callback params: Cancel Whether to cancel /
- (void)exportReverseVideo:(NSURL *)url
outputUrl:(NSURL *)outputUrl timeRange:(CMTimeRange)timeRange videoSpeed:(float)speed progressBlock:(void (^)(NSNumber *prencent))progressBlock callbackBlock:(void (^)())finishBlock fail:(void (^)())failBlockCopy the code
cancel:(BOOL *)cancel;
2.4.9 Watermark /** Add a Watermark
- @param image Watermark image
- The position of the @param point watermark in the video relative to the upper left corner (value: 0.0~1.0)
- @param Scale Scale of watermark, default is 1(original size of image)
* /- (void) addWaterMark:(UIImage *)image withPoint:(CGPoint)point scale:(CGFloat)scale;
/** Add text watermark
- @param waterText Watermark text
- @param waterColor Specifies the color of the watermarked text
- @param waterFont Font for watermarking text
- The position of the @param point watermark in the video relative to the upper left corner (value: 0.0~1.0)
* /- (void) addWaterMark:(NSString )waterText color:(UIColor )waterColor font:(UIFont *)waterFont withPoint:(CGPoint)point;
/* Remove watermark /
- (void)removeWaterMark;
/** Add the ending LOGO
- @param logoImage LOGO image
- @param userName indicates the userName
- @param showDuration Display duration
- @param fadeDuration fadeDuration
* /- (void) addEndLogoMark:(UIImage )logoImage userName:(NSString )userName showDuration:(float)showDuration fadeDuration:(float)fadeDuration;
/* Remove the ending LOGO /
- (void)removeEndLogoMark;
2.4.10 Get thumbnail /* Get thumbnail at a point in time /
- (UIImage*)getImageAtTime:(CMTime) outputTime scale:(float) scale;
2.4.11 exporting a video /* exporting a video params: movieURL output path params: size resolution size params: bitrate bitrate (for example, set it to 5M bitrate and upload value to 5) params: FPS frame rate params: Params: progress Indicates the export progress. Params: success Indicates that the configuration succeeds. Params: Fail Indicates that the configuration fails
- (void)exportMovieURL:(NSURL*) movieURL
size:(CGSize) size bitrate:(int)bitrate fps:(int)fpsCopy the code
maxExportVideoDuration:(float)maxExportVideoDuration
progress:(void(^)(float))progress success:(void(^)())success fail:(void(^)(NSError*))fail;Copy the code
/* Cancel export /
- (void)cancelExportMovie:(void(^)())cancelBlock;
2.4.12 Release [_videoCoreSDK stop] after editing; _videoCoreSDK.delegate = nil; _videoCoreSDK = nil;
2.5 Video Recording
2.5.1 Importing header files and Initialization
#import “rdCameramanager.h” /* Initializes the object
- @param AppKey Application Key registered in the official website of Ruizhi SDK (www.rdsdk.com/).
- @param AppSecret Application secret registered in the official website of Ruizun SDK (www.rdsdk.com/).
- @param resultFailBlock callback for initialization failure [error: error code for initialization failure]
* /- (instancetype) initWithAPPKey:(NSString *)appkey
APPSecret:(NSString *)appsecretCopy the code
resultFail:(void (^)(NSError *error))resultFailBlock;
- (instancetype) initWithAPPKey:(NSString *)appkey
2.5.2 Setting Recording Parameters /** Set recording parameters before recording.
- @param frame Record the size of the preview view position
- @param superview Source view controller
- @param bitrate record bitrate
- @param FPS record frame rate
- @param mode Video recording mode: YES: square NO: full screen
- @param size Record video resolution
- @param isFront Whether to record with front camera
- @param faceU Whether to use faceU
* /- (void) prepareRecordWithFrame:(CGRect)frame
superview:(UIView *)superview bitrate: (int) bitrate fps: (int) fps mode: (BOOL) mode writerSize: (CGSize) size isFront:(BOOL) isFront faceU:(BOOL) faceU;Copy the code
- (void) prepareRecordWithFrame:(CGRect)frame
// Whether to switch filters when you swipe left or right to record a preview view. Defaults to YES (switch) @ property (nonatomic, assign) BOOL swipeScreenIsChangeFilter;
@property (nonatomic, assign) BeautifyState BeautifyState;
/* Set the focus image /
- (void) setfocus;
2.5.3 Record /* Enable Preview /
- (void) startCamera;
/* Close preview /
- (void) stopCamera;
/* Start recording /
- (void) beginRecording;
/* Stop recording /
- (void) stopRecording;
/ * / taking pictures
- (void) takePhoto:(int)orientation block:(void(^)(UIImage* image)) func;
Focus / / *
- (void) focus:(UITapGestureRecognizer *)tap;
/** Switch the video recording mode
- @parma mode:YES: square NO: full screen
- Parma Frame: Record the size of the preview view position
* /- (void) changeMode:(BOOL) mode cameraScreenFrame:(CGRect)frame;
2.5.4 Record callback /* Slide to current filter Index /
- (void) sendFilterIndex:(NSInteger) index;
/* Focus callback /
- (void) tapTheScreenFocus;
/** Callback after enabling preview (startCamera).
- Can be used until this callback is received, the record related buttons on the interface are not available.
* /- (void) cameraScreenDid;
/* Current recording time /
- (void) currentTime:(float) time;
/** Slide record preview view to start
- @params swipDirection (0: left swipe 1: right swipe)
* /- (void) swipeScreenBegin:(NSInteger)swipDirection;
/** Slide record in preview view
- @Param Percent Swipes the location in the preview view
- @param swipDirection (0: left swipe 1: right swipe)
* /- (void) swipeScreenChanging:(float)percent swipDirection:(NSInteger)swipDirection;
/** Slide record preview view to end
- @params swipDirection (0: left swipe 1: right swipe)
* /- (void) swipeScreenChangeEnd:(NSInteger)swipDirection;
/* Start recording /
- (void) movieRecordBegin;
/* Cancel recording /
- (void) movieRecordCancel;
/* End recording /
- (void) movieRecordingCompletion:(NSURL *) videoUrl;
2.5.5faceU // Face Prop Sticker certificate @Property (Nonatomic, assign) void* faceUAuth;
@property (nonatomic, assign) unsigned int faceUAuthlength;
@property (nonatomic, assign) float Cheekclimbing;
@property (nonatomic, assign) float eyeEnlarging;
@property (nonatomic, assign) float colorLevel;
@property (nonatomic, assign) float blurLevel;
@property (nonatomic, assign) float faceShapeLevel;
@property (nonatomic, assign) float faceShape;
/* Toggle FaceUItem /
- (void) changeFaceUItem:(NSString) itemString withName:(NSString)name;
2.5.6 Playing Music during Recording /* Use the music path /
- (void)setMusic:(NSURL *)musicUrl;
/ * play music rate (slow extremely slow: 1.0/3.0-1.0/2.0 – normal: 1.0 fast: 2.0 fast: 3.0) /
- (void)playMusic:(float)rate;
/* Pause the music /
- (void)pauseMusic;
/* Stop playing music /
- (void)stopMusic;
2.5.7 Filter /* Add filter Group /
- (void) addFilters:(NSArray *) filters;
/* Set the filter
- (void) setFilterAtIndex:(NSInteger ) index;
/* Remove filter group /
- (void) removeFilters;
2.5.8 Merge and Reverse order /* Merge recorded Files /
- (void)mergeAndExportVideosAtFileURLs:(NSArray *)fileArray
progress:(void(^)(NSNumber *progress))progressBlock finish:(void(^)(NSURL *videourl))finish fail:(void(^)(NSError *error))fail cancel:(void(^)())cancel;Copy the code
/* Cancel merge /
- (void)cancelMerge;
/* reverse order params: url video source address params: outputUrl output path params: timeRange reverse order timeRange params: progressBlock reverse order progress callback params: CallbackBlock End callback params: Callback of failBlock failure /
- (void)exportReverseVideo:(NSURL *)url
outputUrl:(NSURL *)outputUrl timeRange:(CMTimeRange)timeRange progressBlock:(void (^)(NSNumber *prencent))progressBlock callbackBlock:(void (^)())callbackBlockCopy the code
fail:(void (^)())failBlock;
2.5.9 obtaining a screenshot with Filter /* obtaining a thumbnail with Filter / +(void) returnImageWith:(UIImage)inputImage Filter:(RDFilter)obj withCompletionHandler:(void (^)(UIImage *processedImage))block;
2.5.10 Releasing [_cameraManager stopCamera] after Recording Is Complete; [_cameraManager deleteItems]; _cameraManager.delegate = nil; _cameraManager = nil;