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
android


source to share


No one has answered this question yet

Check out similar questions:

2510
How to persist android activity state by persisting instance state?
815
Android "Only the original thread that created the view hierarchy can touch its views."
782
How do I create a RecyclerView with multiple view types?
625
How do I align the view to the bottom of the screen?
572
ViewPager PagerAdapter does not update View
504
Get root view from current activity
455
Just for everyone, how to properly preserve the state of an instance of fragments on the stack?
451
Save bitmap to location
293
How to get the absolute coordinates of a view
6
Play video by texture with video aspect ratio



All Articles
Loading...
X
Show
Funny
Dev
Pics