Recording locations in time domain with AVFoundation

喜夏-厌秋 提交于 2019-12-11 06:14:18

问题


I followed a lot of tutorials and every tutorials about recording in AVFoundation covers only recording Video or Audio or both of this things.

I would like to record some location in the same time domain like Video/Audio on separate track. This location waypoints is described with 5 properties only - latitude, longitude, altitude, startTime, duration and it'll be changing no often that 5 seconds of the recording. This recording is for presentation purposes and I need functionality such as streaming, play forward, skipping, pause.

Anybody have some idea how to do it with AVFoundation framework?


回答1:


Sure, this is possible.

AVFoundation is a collection of higher and lower level libraries with lots of options to tap into the processing pipeline at various stages. Assuming you want to capture from the Camera, then you're going to be using some combination of AVCaptureSession, its delegate https://developer.apple.com/reference/avfoundation/avcapturevideodataoutputsamplebufferdelegate and an AVAssetWriter.

The AVCaptureVideoDataOutputSampleBufferDelegate is capturing vended CMSampleBuffers (which combine a frame of video data with timing information), at the point you receive it, you typically just "write out" the CMSampleBuffer to record the video, but you can also further process it to filter it in realtime or, as you want to do, record additional information with timing data (e.g. at this point in the video, I had these coordinates).

Research how to write video from the camera on iOS to get started and using the Delegate, you'll soon see where to hook into the code to achieve what you're after.



来源:https://stackoverflow.com/questions/40082670/recording-locations-in-time-domain-with-avfoundation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!