tags:

views:

572

answers:

3
+2  Q: 

FFmpeg on iPhone

Hello, I have downloaded ffmpeg libraries for iPhone and compiled them. My objective is to create a movie file from a series of images using ffmpeg libraries.The amount of documentation for ffmpeg on iphone is very less. I checked an app called iFrameExtractor, which does the opposite of what i want, it extracts frames from a video.

On the command line there is a command called

ffmpeg -f image2 -i image%d.jpg video.mov 

This turns a series of images into a video. I actually checked it on my mac and it works fine. What i wanted to know was how do we get the equivalent in iPhone. Or rather which class/api or method to call. There are a couple of examples of apps doing this on iPhone. Not sure whether they do it through ffmpeg though. Anyways, for reference "Time lapser" and "reel moments"

Thanks in advance

+2  A: 

Do you need sound ? If you do not need sound, you can try to use openCv. I think it is easier to use. You just call a method to append a picture to the movie: http://opencv.willowgarage.com/documentation/c/reading_and_writing_images_and_video.html

olipion
Hello olipion, thanks for this info...I will check it out. Does this work for iPhone though? And i dont need sound, just the video will do
I think so. I did not used opencv to do that, but I used opencv to do face detection on iphone. I think it should work.
olipion
I downloaded openCv static libraries for arm(iPhones native instruction architecture) and the libraries were generated just fine. There were no problems linking to them libraries.As a first step, i was trying to create a .avi file using one image, to see if it works. But cvCreateVideoWriter always returns me a NULL value. I did some searchin and i believe its due to the codec not being present. I am trying this on the iPhone simulator. this is what i do...
- (void)viewDidLoad { [super viewDidLoad]; UIImage *anImage = [UIImage imageNamed:@"1.jpg"]; IplImage *img_color = [self CreateIplImageFromUIImage:anImage]; //The image gets created just fine CvVideoWriter *writer = cvCreateVideoWriter("out.avi",CV_FOURCC('P','I','M','1'), 25,cvSize(320,480),1); //writer is always null int result = cvWriteFrame(writer, img_color); NSLog(@"\n%d",result); //hence this is also 0 all the time cvReleaseVideoWriter(}
I am not sure about the the second parameter. What sort of codec or what exactly it does...I am a n00B in this. Any suggestions?
A: 

Someone please correct me if I'm wrong, but I don't believe iPhone apps can call external executables (which makes sense, that would be multitasking). You'll have to use libav* to accomplish what you're after. Compile ffmpeg for the iPhone:

http://github.com/gabriel/ffmpeg-iphone-build

then read the API docs at ffmpeg.org. For each library there should be an example file in the ffmpeg source that displays usage of that libraries core functions. i.e. in libavcodec, there is a file called api-example.c and in libavformat, there's one called output-example.c.

jtrim
Hi jtrim, thanks for this info. Will check harder in the docs.
A: 

how to convert array of UIImages into a movie file ....preferably mp4 format by using ffmpeg ....please if there are any tutorial give me the link

Ramkumar