Is it possible to do video file “chunking”/segmenting while still recording using AVFoundation?

删除回忆录丶 提交于 2019-12-21 02:05:34

问题


I am attempting to use AVFoundation to record video on OS X but it waits till then end of the recording to save the file. I want to be able to have it save whatever it has captured every 5/10/X seconds.

I need to do this so that as it saves off the video files I can stream the segments to a server while the video is still recording so I can server up "almost live" video off the server.

Thanks for any help you may be able to provide!


回答1:


You can ask AVFoundation to vend the frames to you as it is recording, then just pass a set number of frames to the server. But what you are asking about is extremely complicated to get right, since bandwidth or temporary network blips can cause delays/skips, etc.

We had a discussion about doing this exact thing over here, by using AVCaptureSession with AVCaptureVideoDataOutput to vend the MPEG frames: Near Real Time Video Upload from iPhone

If you want the individual chunks to be playable, you'll have to wrap them in a MOV or MPEG container, but it doesn't sound like you need that in your scenario.



来源:https://stackoverflow.com/questions/11473360/is-it-possible-to-do-video-file-chunking-segmenting-while-still-recording-usin

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