Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There is a Easiest way to do this without using GPUImageCropFilter</p> <p>gpuimagevideocamera.m</p> <pre><code> -(void)processVideoSampleBuffer:(CMSampleBufferRef)sampleBuffer{ if (capturePaused)return; CFAbsoluteTime startTime = CFAbsoluteTimeGetCurrent(); CVImageBufferRef cameraFrame = CMSampleBufferGetImageBuffer(sampleBuffer); int bufferWidth ; int bufferHeight; bufferHeight=480; bufferWidth=480; CMTime currentTime = CMSampleBufferGetPresentationTimeStamp(sampleBuffer);----etc} </code></pre> <p>your .m file</p> <pre><code> GPUImageVideoCamera *videoCamera = [[GPUImageVideoCamera alloc] initWithSessionPreset:AVCaptureSessionPreset640x480 cameraPosition:AVCaptureDevicePositionBack]; </code></pre> <p>GpuimageMovieWriter.m</p> <pre><code>outputSettings = [NSDictionary dictionaryWithObjectsAndKeys: AVVideoCodecH264, AVVideoCodecKey, [NSNumber numberWithInt:640.0], AVVideoWidthKey, [NSNumber numberWithInt:640.0], AVVideoHeightKey, AVVideoScalingModeResizeAspectFill,AVVideoScalingModeKey,nil]; assetWriterVideoInput = [AVAssetWriterInput assetWriterInputWithMediaType:AVMediaTypeVideo outputSettings:outputSettings]; assetWriterVideoInput.expectsMediaDataInRealTime = _encodingLiveVideo; // You need to use BGRA for the video in order to get realtime encoding. I use a color-swizzling shader to line up glReadPixels' normal RGBA output with the movie input's BGRA. NSDictionary *sourcePixelBufferAttributesDictionary = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt:kCVPixelFormatType_32BGRA], kCVPixelBufferPixelFormatTypeKey, [NSNumber numberWithInt:640], kCVPixelBufferWidthKey, [NSNumber numberWithInt:640], kCVPixelBufferHeightKey, nil]; // NSDictionary *sourcePixelBufferAttributesDictionary = [NSDictiona ry dictionaryWithObjectsAndKeys: [NSNumber numberWithInt:kCVPixelFormatType_32ARGB], kCVPixelBufferPixelFormatTypeKey, // nil]; assetWriterPixelBufferInput = [AVAssetWriterInputPixelBufferAdaptor assetWriterInputPixelBufferAdaptorWithAssetWriterInput:assetWriterVideoInput sourcePixelBufferAttributes:sourcePixelBufferAttributesDictionary]; [assetWriter addInput:assetWriterVideoInput]; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload