I'm made a record video app, but the first frame always be black.
I use:
- (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection
and assetWriter to write sample buffer.
I found that the first sample buffer is mediaType:'soun', does it is the problem.
How should I do
I had the same problem. And I think first sample buffer being "sound" should be the problem. What I tried to do is to ignore the first sample buffer if it's sound. Wait until the first "video" sample buffer comes in and then do the AVAssetWriter startWriting thing. I solved my problem by doing this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With