Skip to content

diyCamera

sunjian880928 edited this page Aug 2, 2016 · 9 revisions

积木类使用说明

用户可以自己采集音视频数据,使用金山云SDK推流模块,完成推流功能时,可以进行如下配置。

用户采集数据

原始数据:使用AVFoundation框架,提供的基本类AVCaptureDeviceInput,AVCaptureSession,AVCaptureVideoDataOutput,AVCaptureAudioDataOutput完成时音频的采集和输出,通过AVCaptureVideoDataOutputSampleBufferDelegate,AVCaptureAudioDataOutputSampleBufferDelegate代理

-(void) captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection {}来完成音视频数据输出;

推流模块

推流模块基本配置:

  • 构造推流实例
_gpuStreamer = [[KSYGPUStreamer alloc] initWithDefaultCfg];
  • 日志回调
    _gpuStreamer.streamerBase.logBlock = ^(NSString *string){
        NSLog(@"logBlock: %@", string);
};
  • 参数配置
    _gpuStreamer.streamerBase.videoCodec = KSYVideoCodec_X264;//编码方式
    _gpuStreamer.streamerBase.videoFPS   = frameRate;//视频帧率
    _gpuStreamer.streamerBase.audiokBPS  = 48;   // 音频码率
    _gpuStreamer.streamerBase.enAutoApplyEstimateBW = YES/NO;//是否开启码率自适应
    _gpuStreamer.streamerBase.videoInitBitrate  = 600; // k bit ps//初始码率
    _gpuStreamer.streamerBase.videoMaxBitrate   = 1000; // k bit ps//最大码率
    _gpuStreamer.streamerBase.videoMinBitrate   = 0;  // k bit ps//最小码率
  • 开始推流
    [_gpuStreamer.streamerBase startStream: _hostURL];//_hostURL为推流地址
    [_gpuStreamer.streamerBase stopStream];
  • 结束推流
    [_gpuStreamer.streamerBase stopStream];

1. 推流环节说明

2. 特色功能说明

2.1 采集

2.2 音频处理

2.3 视频处理

2.4 编码

2.5 推流

2.6 输入多样化

2.7 集成

3. 第三方功能

4. 技术专栏

5. 已知问题

8. FAQ

金山云计算

Clone this wiki locally