Search code examples
iosobjective-cgpuimagevideo-recording

Pausing Video using GPUImage framework


I have been trying to implement "Pause/Resume" option in one of GPUImage project examples "SimpleVideoFilter" and so far, its going good except the issue of "pausing" video. I'm using the below mentioned code to pause video

- (void)pauseCameraCapture;
{
    capturePaused = YES; }

- (void)resumeCameraCapture;
{
    capturePaused = NO; }

The issue is that the video gets stuck on the last frame and the "pause" duration also gets in total video duration,..

so for example, if i record for 5sec and pause it for 10sec and resume recording again for 5sec, that SHOULD be 10sec of total recording HOWEVER, when i play the video, it plays for 5sec and then gets stuck on the last frame for next 10sec "pause time" and then plays again the last 5sec..

What i want is simple, if i record for 5sec and pause it for 10sec and resume recording again for 5sec, it should only record 10min of recording in total.

I searched this issue but couldn't find anything that solves this problem.


Solution

  • i know the question is old but i was working on similar task and found a nice solution using GPUImage. I found this project forked from GPUimage . Here movieWriter class has been changed in a way that video can be paused in excat way as described in question.

    All you need to do is set movieWriter.paused=YES when you pause the video and set movieWriter.paused=NO when you resume the video recording . Where movieWriter is object of class GPUImageMovieWriter

    Worked perfectly for me .Hope this will help someone in future.