Split videos to frames/images - iphone

I have a requirement to split a 5 sec video to images /frames from my iphone.
Is it possible using objective C.Any libraries available for this?
Help is highly appreciable.
Thanks,

there are many ways by which you can get images from a video. Some of them are :-
NSURL *videoURL = [NSURL fileURLWithPath:url];
MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:videoURL];
UIImage *thumbnail = [player thumbnailImageAtTime:1.0 timeOption:MPMovieTimeOptionNearestKeyFrame];
//Player autoplays audio on init
[player stop];
[player release];
You can also check these links:-
Is there any way other than thumbnail method to take a screenshot of an video in Iphone?
How to take a screenshot from an video playing through MPMediaPlayerController in iPhone?
It may help you :)
Thanks :)

Related

Iphone Videoplayer

I am creating video based ios application.I am using MPMoviePlayerController for playing video. It is working correctly for local video files but I am not able to play the video for the server link please give me some idea
Here is my code
MPMoviePlayerController * player = [[MPMoviePlayerController alloc] init];
NSURL *url = [NSURL URLWithString:imageName];
player.scalingMode = MPMovieScalingModeFill;
[player setContentURL:url];
[player prepareToPlay];
[player play];
if you want using a MPMoviePlayerController implement that server links or streaming.
refer a this sample code. Will help you a lot: MoviePlayer

how to set thumbnail image of video?

I have a custom button in my application on click of which I present a UIImagePickerControllerSourceTypeCamera to take a video.
Now, after capturing the video I want to set a thumbnail of it to this custom button.
How to take 1st frame of that video to set thumbnail ?
refer the following links. You can get some ideas regarding creating thumbnails for videos.
Getting a thumbnail from a video url or data in iPhone SDK
stackoverflow.com/questions/1259316/iphone-sdk-3-0-video-thumbnail
Check This.
NSString *videoLink=[info objectForKey:#"UIImagePickerControllerMediaURL"];
MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:(NSURL*)videoLink];
UIImage *imageSel = [player thumbnailImageAtTime:1.0 timeOption:MPMovieTimeOptionNearestKeyFrame];
[player stop];
[player release];

Live Video player

i want to create a Live Video Player.. can any one suggest how to make or any SDk available for live Streaming Video Player
Try this...
Live Streaming to iPhone
http://geobray.com/2010/03/26/live-tv-streaming-to-iphone-with-http/
or this
http://www.google.com/search?sourceid=chrome&ie=UTF-8&q=live+streaming+to+iphone
The native iOS MPMoviePlayerController also supports streaming.
There's plenty of information about it on Google and particularly on Apple's Multimedia Programming Guide
As Hagai said,
You can play the lie streaming using MPMoviePlayerController
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:#"LIVE STREAM LINK"]];
// video player
MPMoviePlayerController *playerViewController = [[MPMoviePlayerController alloc] init];
playerViewController.contentURL = url;
playerViewController.view.frame = CGRectMake(0, 0, 320, 480);
[self.view addSubview:playerViewController.view];
[playerViewController play];
Thats all you need to perform

iPhone:Streaming feed URL sample?

I have a media streaming code like below for playing streaming video. I want to test it with some working streaming url feed on iOS 4 devices. Could someone provide me the exact sample streaming video feed if anything is available for iPhone supported? So that, i can test this code and make sure it works well, though it could be correct. I want a real streaming video url link.
NSString *strUrl = #"http://????????????"
NSURL *url = [NSURL URLWithString:strUrl];
MPMoviePlayerController *mPlayer = [[MPMoviePlayerController alloc]initWithContentURL:url];
mPlayer.view.frame = self.view.frame;
[self.view addSubview:mPlayer.view];
[mPlayer setFullscreen:YES animated:YES];
[mPlayer play];
Thanks.
I don't have a URL for you, but your code looks correct, except that you should turn auto-play off before setting full screen with animation. In my experience, the app could crash on setFullscreen:animated: if you use the player more than once. You might also want to observe the MPMoviePlayerPlaybackDidFinishNotification notification in case of playback error so that you can inform the user that there was a playback error.
NSURL *url = [NSURL URLWithString:strUrl];
MPMoviePlayerController *mPlayer = [[MPMoviePlayerController alloc]initWithContentURL:url]; mPlayer.view.frame = self.view.frame;
mPlayer.shouldAutoplay = NO;
[self.view addSubview:mPlayer.view];
[mPlayer setFullscreen:YES animated:YES];
[mPlayer play];
You can use below urls for testing purpose,
http://a1408.g.akamai.net/5/1408/1388/2005110405/1a1a1ad948be278cff2d96046ad90768d848b41947aa1986/sample_mpeg4.mp4
I have not tested it, but it should work well...

Video not playing in ios4?

I am playing an video from url using MPMoviePlayerViewController class and it is working fine in all version of 3.(3.0,3.1,3.1.2,3.1.3)but in iOS4 video is not playing ? Have any one track this issue ?
thanks
After struggling 3 to 4 hrs. i Found out the solution of the issue. Here is the solution:
MPMoviePlayerViewController *mpViewController = [[MPMoviePlayerViewController alloc] initWithContentURL:videoUrl];
[self presentMoviePlayerViewControllerAnimated:mpViewController];
[mpViewController.view setCenter:yourView.center];
[mpViewController release];
Cheers !!!!