1

I'm trying to place an image over a video that is playing. There could be a face in the video and I want to plae a custom image over that face. I've tried to play the video using AVPlayer and tried to place the custom image using a scheduled NSTimer. It works good (not perfect) with the simulator. But When I tried it in couple of different devices it does not working well or same in all the devices. Seems like there should be some sort of synchronization to sync the video frame and the custom image.

Can anyone help me out of this issue with any tips or suggestion? Anything that is helpful will be appreciated. :)

Thanks in advance.

Erfan
  • 1,284
  • 1
  • 13
  • 21
  • How are you storing the timing data for where the face should move to over time? If you can provide some basic information about that, I might be able to help. Is it frame based or time based? – Clay Garrett Oct 17 '14 at 12:42
  • I have an xml file with the following information about the face image for a particular video: xPosition, yPosition, rotationValue, scaleValue, frameNumber, etc. I can parse these info and put the image over the video layer using AVPlayer. But the problem is the synchronization. It is frame based. But I couldn't make image synchronized with the video using NSTimer. – Erfan Oct 19 '14 at 09:12
  • If your timings are off try looking into CACurrentMediaTime(), and CADisplayLink. These often give much finer control over time based events. https://developer.apple.com/library/ios/documentation/QuartzCore/Reference/CADisplayLink_ClassRef/index.html – simonthumper Oct 20 '14 at 21:27
  • Hi @JoeBlow , I'm still there and actually the project has ended without success! – Erfan Jan 21 '16 at 16:41
  • Hi @JoeBlow , I'm sorry I didn't find any helpful answer yet and actually the project didn't ended successfully! :( – Erfan Jan 22 '16 at 08:03
  • CADisplayLink (also CACurrentMediaTime can help). In general for problems like this, you usually need http://stackoverflow.com/a/9300763/294884 Brad Larson's GPU image. Hope it helps! – Fattie May 01 '16 at 18:33

0 Answers0