ios - Get current video duration from CMSampleBufferRef -
how can current recorded video duration cmsamplebufferref in delegate method
- (void)captureoutput:(avcaptureoutput *)captureoutput didoutputsamplebuffer:(cmsamplebufferref)samplebuffer fromconnection:(avcaptureconnection *)connection; please guide sample code
the details need in video meta data. video meta data may need convert cmsamplebuffer cvpixelbuffer.
cmsamplebuffer core foundation-style opaque type; instance contains sample buffer frame of video data. cvpixelbuffer core video pixels sample buffer.
you can pixel buffer sample buffer using below cmsamplebuffergetimagebuffer:
cvpixelbufferref pixelbuffer = cmsamplebuffergetimagebuffer(<#a cmsamplebuffer#>);
once got pixel buffer can video meta datas timing , format informations.
to timing informations use cmsamplebuffergetpresentationtimestamp , cmsamplebuffergetdecodetimestamp respectively.
for more info read representations of media
Comments
Post a Comment