kEvin kEvin - 7 months ago 92
Objective-C Question

iPhone:Create video from images

I am trying to create video from png images which has no audio file.

I have implemented following code but my images are not running smoothly.

- (void)viewDidLoad
{
totalImages = 121;
counter=1;
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
-(void)viewDidAppear:(BOOL)animated
{
levelTimer = [NSTimer scheduledTimerWithTimeInterval:0.40 target: self selector: @selector(levelTimerCallback:) userInfo: nil repeats: YES];
}

- (void)levelTimerCallback:(NSTimer *)timer
{

if(counter <= totalImages)
{
NSString *fileName = [NSString stringWithFormat:@"image_iphone_%d",counter];
NSLog(@"filenameEasy:%@",fileName);
NSString *fileLocation = [[NSBundle mainBundle] pathForResource:fileName ofType:@"png"];

UIImage *imageName = [[UIImage alloc] initWithContentsOfFile:fileLocation];
imgV.image = imageName;
counter++;
NSLog(@"counter:%d",counter);
[imageName release];
[self viewDidAppear:NO];
}

}


If you have any idea plz share it.
thanx in advance.

Answer Source

You can have a look on this topic

Make movie file with picture Array and song file, using AVAsset

It will be a bit confusing if you haven't try AVFoundation before.

It's concept is like:
1. Set up a assetwriter (helper for writing the video out).
2. Tell the writer what track you wanna input (adding the video and audio writerInput)
3. If everything is okay, try to put your image to the video track
4. Ask the writer to encode.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download