Anaglyph 3d Video Player For Android Today

Rating: 4.5/5 | Price: Free / $5.99 Pro

Technically, MX Player is not an anaglyph app out of the box. However, it is the most stable video engine on Android. To turn it into an anaglyph player, you must install a custom codec.

  • Why use it? MX Player handles 10-bit HEVC files and AC3 audio (Dolby Digital) better than any dedicated 3D app. If your 3D movie is 4GB or larger, use MX Player.
  • private void recordAnaglyphVideo() 
        MediaCodec encoder = MediaCodec.createEncoderByType("video/avc");
        // Configure encoder with anaglyph frames from GLSurfaceView
        // Save to MP4 file
    

    public class FrameProcessor 
    
    public static Bitmap[] extractSBSFrames(Bitmap fullFrame, int format) 
        int width = fullFrame.getWidth();
        int height = fullFrame.getHeight();
    Bitmap leftFrame, rightFrame;
    switch (format) 
            case FORMAT_SBS:
                // Side-by-side: each eye gets half width
                leftFrame = Bitmap.createBitmap(fullFrame, 0, 0, width/2, height);
                rightFrame = Bitmap.createBitmap(fullFrame, width/2, 0, width/2, height);
                break;
    case FORMAT_TB:
                // Top-bottom: each eye gets half height
                leftFrame = Bitmap.createBitmap(fullFrame, 0, 0, width, height/2);
                rightFrame = Bitmap.createBitmap(fullFrame, 0, height/2, width, height/2);
                break;
    default:
                leftFrame = rightFrame = fullFrame;
    // Resize both frames to full display resolution
        leftFrame = Bitmap.createScaledBitmap(leftFrame, width, height, true);
        rightFrame = Bitmap.createScaledBitmap(rightFrame, width, height, true);
    return new Bitmap[]leftFrame, rightFrame;
    

    package com.example.anaglyph3d
    

    import android.content.Context import android.graphics.SurfaceTexture import android.opengl.GLES20 import android.opengl.GLSurfaceView import android.opengl.Matrix import javax.microedition.khronos.egl.EGLConfig import javax.microedition.khronos.opengles.GL10

    class AnaglyphRenderer(private val context: Context) : GLSurfaceView.Renderer anaglyph 3d video player for android

    private var program: Int = -1
    private var videoTextureId: Int = -1
    private var surfaceTexture: SurfaceTexture? = null
    private var videoWidth = 640
    private var videoHeight = 480
    private var screenWidth = 1
    private var screenHeight = 1
    private val vertexBuffer = java.nio.ByteBuffer.allocateDirect(4 * 4 * 4).order(java.nio.ByteOrder.nativeOrder()).asFloatBuffer()
    private val texCoordBuffer = java.nio.ByteBuffer.allocateDirect(4 * 2 * 4).order(java.nio.ByteOrder.nativeOrder()).asFloatBuffer()
    val surfaceTexture: SurfaceTexture
        get() = surfaceTexture!!
    fun setVideoSize(width: Int, height: Int) 
        videoWidth = width
        videoHeight = height
    override fun onSurfaceCreated(gl: GL10?, config: EGLConfig?) 
        GLES20.glClearColor(0f, 0f, 0f, 1f)
    // Vertex shader
        val vertexShaderCode = """
            attribute vec4 vPosition;
            attribute vec2 aTexCoord;
            varying vec2 vTexCoord;
            void main() 
                gl_Position = vPosition;
                vTexCoord = aTexCoord;
    """.trimIndent()
    // Fragment shader – Anaglyph (Red-Cyan)
        val fragmentShaderCode = """
            precision mediump float;
            varying vec2 vTexCoord;
            uniform sampler2D uTexture;
            void main() 
                vec2 leftTex = vec2(vTexCoord.x * 0.5, vTexCoord.y);
                vec2 rightTex = vec2(vTexCoord.x * 0.5 + 0.5, vTexCoord.y);
    vec4 leftColor = texture2D(uTexture, leftTex);
                vec4 rightColor = texture2D(uTexture, rightTex);
    // Red channel from left eye, Cyan (Green+Blue) from right eye
                float r = leftColor.r;
                float g = rightColor.g;
                float b = rightColor.b;
    gl_FragColor = vec4(r, g, b, 1.0);
    """.trimIndent()
    program = createProgram(vertexShaderCode, fragmentShaderCode)
        GLES20.glUseProgram(program)
    // Full-screen quad vertices (x, y)
        val vertices = floatArrayOf(
            -1f, -1f,
             1f, -1f,
            -1f,  1f,
             1f,  1f
        )
        vertexBuffer.put(vertices).position(0)
    // Texture coordinates for side-by-side 3D video
        val texCoords = floatArrayOf(
            0f, 1f,
            1f, 1f,
            0f, 0f,
            1f, 0f
        )
        texCoordBuffer.put(texCoords).position(0)
    val positionHandle = GLES20.glGetAttribLocation(program, "vPosition")
        GLES20.glEnableVertexAttribArray(positionHandle)
        GLES20.glVertexAttribPointer(positionHandle, 2, GLES20.GL_FLOAT, false, 8, vertexBuffer)
    val texCoordHandle = GLES20.glGetAttribLocation(program, "aTexCoord")
        GLES20.glEnableVertexAttribArray(texCoordHandle)
        GLES20.glVertexAttribPointer(texCoordHandle, 2, GLES20.GL_FLOAT, false, 8, texCoordBuffer)
    // Create texture
        val textures = IntArray(1)
        GLES20.glGenTextures(1, textures, 0)
        videoTextureId = textures[0]
        GLES20.glBindTexture(GLES20.GL_TEXTURE_EXTERNAL_OES, videoTextureId)
        GLES20.glTexParameteri(GLES20.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR)
        GLES20.glTexParameteri(GLES20.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR)
    surfaceTexture = SurfaceTexture(videoTextureId)
        surfaceTexture?.setOnFrameAvailableListener 
            glSurfaceView.requestRender()
    override fun onSurfaceChanged(gl: GL10?, width: Int, height: Int) 
        screenWidth = width
        screenHeight = height
        GLES20.glViewport(0, 0, width, height)
    override fun onDrawFrame(gl: GL10?) 
        GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT)
        surfaceTexture?.updateTexImage()
    GLES20.glUseProgram(program)
        GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, videoTextureId)
    val textureHandle = GLES20.glGetUniformLocation(program, "uTexture")
        GLES20.glUniform1i(textureHandle, 0)
    GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4)
    private fun createProgram(vertexSource: String, fragmentSource: String): Int 
        val vertexShader = loadShader(GLES20.GL_VERTEX_SHADER, vertexSource)
        val fragmentShader = loadShader(GLES20.GL_FRAGMENT_SHADER, fragmentSource)
        val program = GLES20.glCreateProgram()
        GLES20.glAttachShader(program, vertexShader)
        GLES20.glAttachShader(program, fragmentShader)
        GLES20.glLinkProgram(program)
        return program
    private fun loadShader(type: Int, source: String): Int 
        val shader = GLES20.glCreateShader(type)
        GLES20.glShaderSource(shader, source)
        GLES20.glCompileShader(shader)
        return shader
    


    An anaglyph image superimposes two images. To isolate these images for the appropriate eye, the viewer wears glasses with colored filters, typically Red/Cyan.

    Let’s be realistic. A dedicated anaglyph 3D video player for Android will not give you the "pop-out" magic of a 3D cinema projector. The colors will be washed out, and you will look slightly silly holding a piece of red plastic to your face.

    However, for the hobbyist, the retro gamer, or the parent wanting to show a kid "old school 3D," it is magical. The barrier to entry is zero. Rating: 4

    Our final verdict:

    Go dig out those old red-cyan glasses, download a test file, and turn your Android phone into a retro 3D time machine. The third dimension is waiting.


    Keywords used organically: anaglyph 3d video player for android, SBS video player, red cyan anaglyph, 3D movie playback Android, best anaglyph app, stereoscopic video conversion.

    To watch 3D content on your Android device using red-cyan anaglyph glasses

    , you can use several specialized media players. These apps typically convert standard Side-by-Side (SBS) or Over-Under (OU) 3D video files into an anaglyph format that works with colored glasses. inairspace Top Anaglyph 3D Video Players for Android Why use it

    Watching 3D content on Android via anaglyph mode allows you to experience stereoscopic depth using standard red-cyan or red-blue glasses, even on a regular 2D screen. Top Anaglyph 3D Video Players for Android VLC media player

    Or VLC Media Player. It plays practically every major video format and is on Windows, Linux, OS X, and even Android. VLC media player

    MX Player (Android): A capable Android video player that has an intuitive UI coupled with support for a lot of video formats. YouTube VR

    Here’s a feature set for an Anaglyph 3D Video Player on Android — designed for immersive playback of red-cyan, green-magenta, or blue-yellow anaglyph content.