How do I reverse my movies?

MPMoviePlayerController playing movies in reverse (backwards) is not smooth in iPhone App?

  • I am developing an iPhone application where I need to reverse a video playback. I am currently using XCode 4.2. I am trying to play a movie in reverse with the MPMoviePlayerController. But when it plays in reverse it is not as smooth as playing it forward. It becomes a bit choppy and is not at all smooth. The following is my code. - (void)viewDidLoad{ //code for initializing the movie player MPMoviePlayerController videoPlayer = [[MPMoviePlayerController alloc] initWithContentURL:"URL"]; self.videoPlayer = videoPlayer; [videoPlayer release]; self.videoPlayer.view.userInteractionEnabled = NO; self.videoPlayer.initialPlaybackTime = -1; self.videoPlayer.shouldAutoplay=NO; [self.videoPlayer prepareToPlay]; //code for initializing the button UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; [button setTitle:@"Reverse" forState:UIControlStateNormal]; [button addTarget:self action:@selector(reverseMovie) forControlEvents:UIControlEventTouchDown]; button.frame = CGRectMake(0, 0, 50, 40); [self.view addSubview:button]; } -(void)reverseMovie{ [self.videoPlayer setCurrentPlaybackRate:-1.0]; } What could be the possible solution to this?

  • Answer:

    I have solved this same problem in the past by using a second video file that is the movie in reverse.  When the user switches to reverse switch videos and adjust the play head time as necessary. Playing a video in reverse is more difficult due to the file's compression - you could also try using less or a different type of compression.

Bill Ho at Quora Visit the source

Was this solution helpful to you?

Other answers

This is likely a result of the encoding used. To decode a particular frame the decoder must either have immediately decoded the previous frame (asking for n+1) or it needs find the earliest /previous/ keyframe and decode from that point. So when playing forwards you are always in the situation of having decoded the previous frame (asking for n+1), and are rewarded with smooth playback. When playing backwards you are asking for a frame n-1 so the decoder must go back to the previous keyframe, decode all frames up to the previous and display. The decoder can be smart and buffer frames for n-1 ... n-k (where k is the number of frames to the previous keyframe) so you will get smooth playback for a series of frame. But eventually it has to go back and decode even further in the past and buffer another series of frames, leading to choppy playback. The only 2 solutions are: 1) use a second video as suggested by William 2) encode the video such that each frame is a keyframe so no buffering is required (and watch the filesize grow large)

Nathan Holmberg

#i have Created Demo for Same , In this User can 1.  Convert Video Reverse       2.  Convert Video into Audio       3.  Add Audio & Video Together Download code here: https://github.com/mehulparmar4ever/ConvertVideoReverse

Mehul Parmar

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.