views:

208

answers:

3

Hello,

I want to develop a program in with user can capture and save only last 30 sec of video after stop button pressed.

1) Do we have control over video recording?

2) how can we get only last 30 sec of video?

A: 

About UIImagePickerController

The UIImagePickerController class manages the system-supplied user interfaces for choosing and taking pictures and movies on supported devices. Use this class to obtain one of these media types from the user. The class manages user interactions and reports the results of those interactions to the associated delegate object.

and

In addition to the default camera interface, in iPhone OS 3.1 and later you can manage the camera interactions yourself, if desired. You can provide a custom overlay view to display a custom picture-taking interface and you can initiate the taking of pictures from your code. Your custom overlay view can be displayed in addition to, or instead of, the default controls provided by the image picker interface.

But my question is still there, How can we manage capture duration of the video?

Mitul Nakum
A: 

One technique is to save the video frames into a ringbuffer. Make the ringbuffer large enough to store 30 seconds of video. With a ringbuffer you have a fill pointer that simultaneously defines that start and end of the stream. When you add to the buffer you increment the pointer accordingly. When you user presses "stop", you rewrite the buffer so that the data at your fill pointer is at the beginning of the buffer (basically you are rotating all the data in the buffer so that the right point is at the beginning). That is your raw video data, representing the last 30 seconds. You probably want a counter representing how many seconds have been filled, in case they press stop after fewer than 30 seconds.

Justin Smith
+4  A: 

If we can manage to get images at rate of 15/fps using UIImagePickerController.

Then make buffer of size 15*30.

Make a queue NSMutableArray remove first frame as you get new frame and add new frame at the end of queue.

At the end when user press stop button. Create a video(Using Custom codac).

I am not sure but it can helpful.

Kanak Vaghela