Search code examples
iosavplayerrender-to-texture

iOS AVPlayer render to texture


I'm trying to understand AVPlayer, but the samples on Apple documentation are not really straightforward and I'm having some issues.

What i need to do is to create a Render To Texture from a movie, so that in my scene i can use that to map it in an OpenGL texture (this has be done EACH frame!)

To my understanding, i think i should use AVURLAsset but i'm not really sure.

Can anybody pinpoint me in the right direction? Also, if you have any knowledge of a simple Video->RTT sample for iOS that would be great (couldn't find anything by googling)


Solution

  • I kinda found an answer in this sample (which somehow i missed the first time i was studying this problem)

    https://developer.apple.com/library/ios/samplecode/AVBasicVideoOutput/Introduction/Intro.html#//apple_ref/doc/uid/DTS40013109

    this sample loads a movie from camera roll, and then applies a shader during its playback.

    Documentation and code quality aren't the best i've read in my lifetime, but at least that's a starting point.

    Most interesting read was

    • (void)displayPixelBuffer:(CVPixelBufferRef)pixelBuffer

    in APLEAGLview.m

    hope this helps future users!