iOS-关于GPUImage录制视频第一帧黑屏
作者:
Wayne_王 | 来源:发表于
2024-09-10 15:03 被阅读0次
使用GPUImage录制视频时第一帧会出现黑屏或者白屏,并且调用addAudioInputsAndOutputs也不好使
此时需要修改GPUImageMovieWriter.m的源码,在其中添加以下代码
static BOOL allowWriteAudio = NO;
- (void)startRecording;
{
...
allowWriteAudio = NO;
}
- (void)processAudioBuffer:(CMSampleBufferRef)audioBuffer;
{
if (!allowWriteAudio) {
return;
}
...
}
- (void)newFrameReadyAtTime:(CMTime)frameTime atIndex:(NSInteger)textureIndex;
{
...
if (![assetWriterPixelBufferInput appendPixelBuffer:pixel_buffer withPresentationTime:frameTime])
NSLog(@"Problem appending pixel buffer at time: %@", CFBridgingRelease(CMTimeCopyDescription(kCFAllocatorDefault, frameTime)));
allowWriteAudio = YES; //< add this
...
}
本文标题:iOS-关于GPUImage录制视频第一帧黑屏
本文链接:https://www.haomeiwen.com/subject/ijluljtx.html
网友评论