Save video with texture image
I am trying to use video effect with OEPNGL using android
I'm a downlaod source project: https://www.virag.si/2014/03/playing-video-with-opengl-on-android/
apply video effect in this code. but how to store video in texture in sdcard.
video playback: code
private void startPlaying()
{
renderer = new VideoTextureRenderer(this, surface.getSurfaceTexture(), surfaceWidth, surfaceHeight);
player = new MediaPlayer();
try
{
AssetFileDescriptor afd = getAssets().openFd("big_buck_bunny.mp4");
player.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength());
player.setSurface(new Surface(renderer.getVideoTexture()));
player.setLooping(true);
player.prepare();
renderer.setVideoSize(player.getVideoWidth(), player.getVideoHeight());
player.start();
}
catch (IOException e)
{
throw new RuntimeException("Could not open input video!");
}
}
Apply effect code:
private static final String FragmentShaderCode =
"#extension GL_OES_EGL_image_external : require\n" +
"precision mediump float;" +
"varying highp vec2 v_TexCoordinate;" +
"uniform samplerExternalOES texture;" +
"uniform sampler2D chrominanceTexture;" +
"void main () {" +
"mediump vec3 yuv;" +
"lowp vec3 rgb;" +
"yuv.x = texture2D(texture, v_TexCoordinate).r;" +
"yuv.yz = texture2D(chrominanceTexture, v_TexCoordinate).rg - vec2(0.7154, 0.0721);" +
"rgb = mat3(1,1,1,0,0.2125, 0.7154, 0.0721,-.38059,0) * yuv;"+
"gl_FragColor = vec4(rgb, 1);"+
"}";
Thank.
+3
source to share
No one has answered this question yet
Check out similar questions: