0

I created small app to show my problem. https://github.com/Anton111111/MediaExtractorTest

This app contain two video:

these are same videos with different resolutions (1440x720 and 2160x1080).

Then i try extract this video with MediaExtractor and render it to file. You can find results on the root of memory (two files v1440_720.png and v2160_1080.png).

But for video with resolution 2160x1080 i see that it extracted with green artifact in the bottom. And this artifact i see only on Huawei nova.

I wonder is it problem only with Huawei phone? And how to fix it?

Results from Huawei nova you can see in links: enter image description here https://github.com/Anton111111/MediaExtractorTest/blob/master/result/v1440_720.png

enter image description here https://github.com/Anton111111/MediaExtractorTest/blob/master/result/v2160_1080.png

How i extract you can see in file: https://github.com/Anton111111/MediaExtractorTest/blob/master/app/src/main/java/com/mediaextractortest/ExtractorMpeg.java

Anton111111
  • 656
  • 1
  • 7
  • 23

1 Answers1

0

I think i find solution. This is a issue in how the video player handles video textures. When Android creates a Surface to decode video, some devices create a Surface that is slightly larger than the actual video. Then they set a matrix on Surface which is exposed in SurfaceTexture.getTransformMatrix.

I add changes in code to use transform matrix in vertex to solve this issue. And it works. Here is new vertex shader:

vec4 textureCoord = aTextureCoord;
textureCoord.y = 1.0 - textureCoord.y;
vTextureCoord = (uSTMatrix * textureCoord).xy;
Anton111111
  • 656
  • 1
  • 7
  • 23