iOSMp4Cameravideo,mp4,camera,视频,录制,拍摄录制视频,并且将视频转换成mp4格式

来源:互联网 发布:hbo网络词是什么意思 编辑:程序博客网 时间:2024/06/02 09:14

iOSMp4Camera

介绍: 录制视频,并且将视频转换成mp4格式。

链接地址:http://code4app.com/ios/iOSMp4Camera/50cb35ef6803fafc1c000000

测试环境:
    [Code4App]编译测试,测试环境:Xcode 4.5 iOS 5.0 以上。

SBVideoCaptureDemo

介绍:SBVideoCaptureDemo仿照“微视”,录制多段视频,然后合并成一个正方形的视频文件。用AVFoundation自定义界面的视频录制demo。

链接地址:http://code4app.com/ios/SBVideoCaptureDemo/53f56db9933bf0650b8b4b34

测试环境:
    [Code4App]编译测试,测试环境:Xcode 5.1.1, iOS 7.1。

使用方法:

把SBVideoCapture目录添加到工程。

初始化方法:
- (void)initRecorder
{
    self.recorder = [[SBVideoRecorder alloc] init];
    _recorder.delegate = self;
    _recorder.preViewLayer.frame = CGRectMake(0, 0, DEVICE_SIZE.width, DEVICE_SIZE.width);
    [self.preview.layer addSublayer:_recorder.preViewLayer];
}


PBJVision

介绍:按住屏幕录制视频,松开屏幕停止视频录制,并且可以将多个视频拼接在一起保存到相册中。可以很方便制作视频拼接以及逐格动画(stop motion)视频。逐格动画的效果见第二张gif效果图。测试方法(只能在真机中测试)如下:

    1. 多段视频拍摄和拼接:手指按住屏幕,将开始拍照;一会之后松开手指;转移拍摄场景,再按住屏幕,拍摄一会之后再松开手指。可以连续这样拍多个场景。所有场景拍完之后,点击屏幕右上角的对勾按钮,所有录制的这几段视频自动进行拼接,并且保存到相册中。

    1. 逐格动画(stop motion)录制:拍摄时,手指快速点击屏幕(也不要太快了,否则录制不了),也就是每次拍摄时长尽量短一点,结束之后,点击屏幕右上角的对勾按钮,这样录制的视频将有逐格动画效果。

测试环境:
    [Code4App]编译测试,测试环境:Xcode 4.5, iOS 5.0 以上。


使用方法:

#import "PBJVision.h"
//设置相机属性
- (void)_setup
{
    _longPressGestureRecognizer.enabled = YES;

    PBJVision *vision = [PBJVision sharedInstance];
    vision.delegate = self;
    [vision setCameraMode:PBJCameraModeVideo];
    [vision setCameraDevice:PBJCameraDeviceBack];
    [vision setCameraOrientation:PBJCameraOrientationPortrait];
    [vision setFocusMode:PBJFocusModeAutoFocus];

    [vision startPreview];
}
//给屏幕添加支持长按拍摄功能
- (void)_handleLongPressGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer
{
    switch (gestureRecognizer.state) {
      case UIGestureRecognizerStateBegan:
        {
            if (!_recording)
                [[PBJVision sharedInstance] startVideoCapture];
            else
                [[PBJVision sharedInstance] resumeVideoCapture];
            break;
        }
      case UIGestureRecognizerStateEnded:
      case UIGestureRecognizerStateCancelled:
      case UIGestureRecognizerStateFailed:
        {
            [[PBJVision sharedInstance] pauseVideoCapture];
            break;
        }
      default:
        break;
    }
}
//拍摄完成
- (void)_handleDoneButton:(UIButton *)button
{
    [self _endCapture];
}
//保存视频
- (void)vision:(PBJVision *)vision capturedVideo:(NSDictionary *)videoDict error:(NSError *)error
{   
    NSString *videoPath = [_currentVideo  objectForKey:PBJVisionVideoPathKey];
    [_assetLibrary writeVideoAtPathToSavedPhotosAlbum:[NSURL URLWithString:videoPath] completionBlock:^(NSURL *assetURL, NSError *error1) {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle: @"Saved!" message: @"Saved to the camera roll."
                                                       delegate:self
                                              cancelButtonTitle:nil
                                              otherButtonTitles:@"OK", nil];
        [alert show];
    }];
}

IOS 视频录制、合并

链接地址:http://download.csdn.net/detail/eduask_xia/7109553


0 0
原创粉丝点击