0

I have used MPMoviePlayerController for my project, but suddenly I realize that I cannot jump accurately to portions of my video, by simply setting the setCurrentPlaybackTime value to 10.2 secs.

Is there a way to use seekToTime with an MPMoviePlayerController object, or will I have to rewrite my whole code using AVPlayer?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
sam.t
  • 3
  • 2
  • Try this: http://stackoverflow.com/questions/3482967/how-to-forward-mpmovieplayercontroller-to-specified-time-in-iphone-application – Sergei Nikitin May 08 '14 at 20:12
  • Thanks Sergey. Unfortunately both setCurrentPlaybackTime and setting currentPlaybackTime(which I think is the same flow) gives an error of atleast +/-5seconds. – sam.t May 08 '14 at 20:19
  • So sad. For this case I have some link too: https://twitter.com/0xced/status/212873459833909248 Sorry, really sad. – Sergei Nikitin May 08 '14 at 20:25
  • You should see this post to solve your problem. [This post for your problem](http://stackoverflow.com/a/7369740/2914941) – MB Kyle Kwon May 09 '14 at 02:02
  • yes, that is a solution, but works only with AVPlayer object and not with MPMoviePlayerController object to the best of my knowledge. Thanks for the comment though. – sam.t May 09 '14 at 02:08

1 Answers1

0

I found an interim solution to re-encode the videos with more frequent I frames.

#Check number of i frames
ffprobe -show_frames "First video.mp4" 2>/dev/null |grep  "pict_type=I"|wc -l

#encode by increasing frequency of i frames
ffmpeg -i "First video.mp4" -g 15 "First - video-1.mp4"

I am hopeful that there is some AVFoundation expert out there who will give me a code snippet to hook into seekToTime from an MPMoviePlayerController object. ;-)

sam.t
  • 3
  • 2