Latest 0.0.5
Homepage https://github.com/zhfeng20108/ZFScreenRecorder
License MIT
Platforms ios 8.0, requires ARC
Dependencies GPUImage
Authors

基于GPUImage实现的录屏,性能很好。

安装

target 'TargetName' do
pod 'ZFScreenRecorder'
end

核心思路

ZFScreenVideoCamera是用来采集视频和音频的信息,音频信息直接发送给GPUImageMovieWriter;视频信息传入响应链作为源头,渲染后的视频信息再写入GPUImageMovieWriter,文件保存在沙盒里。
ZFScreenVideoCamera实现灵感来源于GPUImageVideoCamera。
ZFScreenVideoCamera和GPUImageVideoCamera相似,唯一不同的是视频的采集方式。ZFScreenVideoCamera采用截屏方式,GPUImageVideoCamera采用的是摄像头。所以ZFScreenVideoCamera完美兼容GPUImage的所有功能,在视频的处理上节约了大量开发时间。

流程图

image

使用

    _movieWriter = [[GPUImageMovieWriter alloc] initWithMovieURL:movieURL size:finalSize];
    //截屏
    self.videoCamera = [[ZFScreenVideoCamera alloc] initWithView:screenView inRect:rect];
    self.videoCamera.runBenchmark = YES;
    [self.videoCamera addTarget:_movieWriter];
    //*/
    self.videoCamera.microphoneEnabled = microphoneEnabled;
    if (microphoneEnabled) {
        self.videoCamera.audioEncodingTarget = _movieWriter;
    }
    _movieWriter.encodingLiveVideo = YES;
    //开始录屏
    [self.videoCamera startScreenCapture];
    //视频写文件
    [_movieWriter startRecording];

Latest podspec

{
    "name": "ZFScreenRecorder",
    "version": "0.0.5",
    "summary": "u6027u80fdu5f88u597du7684u5f55u5c4fuff0cu652fu6301GPUImageu7684u6240u6709u64cdu4f5cu3002",
    "description": "u5f55u5c4fnn* Think: Why did you write this? What is the focus? What does it do?n* CocoaPods will be using this to generate tags, and improve search results.n* Try to keep it short, snappy and to the point.n* Finally, don't worry about the indent, CocoaPods strips it!",
    "homepage": "https://github.com/zhfeng20108/ZFScreenRecorder",
    "license": "MIT",
    "authors": {
        "zhfeng": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/zhfeng20108/ZFScreenRecorder.git",
        "tag": "0.0.5"
    },
    "source_files": "ZFScreenRecorder/*.{h,m}",
    "requires_arc": true,
    "dependencies": {
        "GPUImage": []
    }
}

Pin It on Pinterest

Share This