I am try to combine video clips together use MediaCodec API. With decoder, MediaMuxer I can combine video clips together, but the transition between each clips seem too dull. I wanna to add some transition effects between each clip, like GoPro Quik(with beautiful transitions). As far as I know, Opengl shader can make the transition effects, but I don't know how to do. Could anyone can I help me with some guidance or example ? Thanks!
1 Answers
The first step would be "playing a video on the texture" for which you may find quite a few examples on the SO.
Then you will need some math skills to position the video on the screen correctly with frames. Some scale is generally needed at least between the videos unless you can guarantee they all have the same dimensions.
Some transitions are simply done with transforms or changing the sprite positions but if you want some nice blending you may need multiple textures (video frame samples) in the same shader for which you need to take a look into the "active texture".
Then the question is if you want to play the video or you just want to create a new video using your transitions. To play it you need one video to generate samples in real time and then seek other players to give buffers at specific duration. If you want to create the video then you need to set some target FPS with which you create the sample durations and seek the video frames at that duration and draw them. The second would need a FBO (a frame buffer object) and not a surface view but in both cases I would suggest you to draw to FBO and redraw the texture (attached to the FBO) to the surface.
This is all just the video part so at some point you need to separately play the audio or in case of creating a new video you need to append the audio samples to the video which can again have some blending but that has nothing to do with openGL.

- 16,318
- 3
- 24
- 43
-
Thank you for you guidance. I am trying to use multiple texture to do some blend. And I do all these in jni layer, I don't know how to attach a texture to FBO, any examples ? – Yupeng Zhu Jun 21 '16 at 12:09