How to iterate over all videos stored in camera roll? - iphone

Is there a way to iterate over all videos stored in camera roll? I want to list them in a table view, and when you tap one you see the metadata.
Where would I start?

If you want to list them in a table view, it sounds like you don't want to use Apple's UIImagePickerController.
In that case, you need to go down to the lower-level API's.
For example, you can use ALAssetsLibrary's [enumerateGroupsWithTypes: usingBlock: failureBlock:] to get at all of your ALAsset objects in your camera roll. As your app looks at each ALAsset, you need to make certain the ALAsset url is a video (and this related question shows you how).

Related

Recording video with option of manipulating the pixels before writing to file

I know that I can access raw video images from the iPhone's camera with AVCaptureVideoDataOutput. I also know that I can record video to a file with AVCaptureMovieFileOutput. But how can I first access the raw video images, manipulate them and then write the manipulated ones into the video file? I've already seen apps in the app store, which do this, so it must be possible.
Ok, I now know, that it's done with AVAssetWriter.

Can we know how many albums there are in the iphone's camera library?

I have a small question. We want the user to the able to choose an image from his device's library. If he has more albums apart from the camera roll, we use UIImagePickerControllerSourceTypePhotoLibrary, so he could browse all the albums. The problem comes when he only has the camera roll. In that case we want him to go directly to the camera roll screen, instead of showing an albums table with the camera roll as only choice. It is an useful step.
The question: Is there way to know that there is only one album (camera roll) in the device, so we use UIImagePickerControllerSourceTypeSavedPhotosAlbum and skip that intermediate case?
Is there any other solution?
Thanks a lot.
You can use the ALAssetsLibrary method enumerateGroupsWithTypes:usingBlock:failureBlock: to iterate over all albums in the photo library. It doesn't give you the count directly so you would have to increment your own counter but it should give you the desired result.
Check the documentation for enumerateGroupsWithTypes:usingBlock:failureBlock: for more info on the method.

Record Camera from iPhone and use as overlay in another video

I know how to record a video from the camera on the iPhone, my question, is it possible to take the recording and overlay it on a saved video and save it out as another file?
No, I don't think so. Not using an standard framework. You could probably do something involving screen capture and combing a load of images to make a video. But it would be complicated.

can I create movie manually?

I want to create a movie using objective-c, is it possible? or have to use the camera related things?
[Edit]In fact, I want to know is there any API to create a movie, I want to show some pictures in the movie, so I cannot use camera related things.
Take a look at AVAssetWriter and AVAssetWriterInput in the AVFoundation documentation.

Is there a way to get paths of all the images of CAmera roll

Is there any way to create an array or something
having paths of all the images stored in camera roll.
Please enlighten me on this.
Thnx in advance
SpyPhone uses a direct path to the users photo library:
http://github.com/nst/spyphone/
It seems that any application can read it. However, this seems like falls under the area of "undocumented API" and could well be rejected in a real application.
I don't think there is. As far as the API is concerned for the UIImagePickerController you can only get a single path for a Movie that was recorded by the user (if running 3.0 on a 3GS). And even that path is a file URL to the temporary folder where the movie is stored before being written to the library.
You can't get paths for any images in the photo library or the camera roll.
When you pick an image using the UIImagePickerController the controller returns the Original Image and an "Edited Image" if the image was edited before being chosen.