Giter Site home page Giter Site logo

Comments (9)

wuhaoyu1990 avatar wuhaoyu1990 commented on July 19, 2024

获取YUV数据要通过onPreviewFrame接口,这里没有用到,直接使用的SurfaceTexture与OpenGL绑定,获取外部纹理id,将预览数据输出到SurfaceTexture,就可以操作数据了

from magiccamera.

scientt avatar scientt commented on July 19, 2024

多谢大牛的回复。
这么说,你的OpenGL操作是在播放端做的了?
如果我想直接从编码端操作,直接修改从编码端获取的YUV数据,该把OpenGL与什么绑定呢?

from magiccamera.

wuhaoyu1990 avatar wuhaoyu1990 commented on July 19, 2024

通过
GLES20.glGenTextures(1, textures, 0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textures[0]);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, size.width, size.height,
0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, data);
这样就行了,详细可以看这里的loadTexture方法

不过这样是显示RGB数据的,在onPreviewFrame获取的YUV数据经过修改后要再转换成RGB数据OpenGL才能显示
或者可以在OpenGL里实现YUV转换成RGB

班门弄斧。。有错误望指出

from magiccamera.

scientt avatar scientt commented on July 19, 2024

太谦虚了
从编码端做修改看来可行,不过改动量看起来大一些,需要多次转换,好像开销也有些大吧。
那么在解码端用OpenGL不知道可不可以,我目前是用ijkmediaplayer播放的,解码端主要播放网络上的rtmp视频流

from magiccamera.

wuhaoyu1990 avatar wuhaoyu1990 commented on July 19, 2024

我没看过ijkmediaplayer简单看了下,这个目录下的shader脚本是不是就是接收视频流后显示时用的?如果是在这里改动并添加滤镜就行,不知道理解的对不对

from magiccamera.

scientt avatar scientt commented on July 19, 2024

这位大牛您好,我这里有个项目急需一个带有美颜功能的Android版demo,最好是从编码端渲染,取到渲染过的rgb数据之后再编码成h264数据打包发送。
估计以我们的实力短时间内无法完成了,请问您可否加一下我的qq:734285958,详谈一下商务合作的事?

from magiccamera.

wuhaoyu1990 avatar wuhaoyu1990 commented on July 19, 2024

好多朋友问过这个问题,这个问题我也不知道....
我试过用glReadPixels来读取帧数据,用ffmpeg将RGB转换并且编码,但是光读取RGB就需要80ms-120ms,再加上编码和转换的时间,大约用了250ms,跳帧太严重~可能代码写的有问题吧,但即使有优化空间,要达到25-30的帧数还是不知道该如何是好.....
后来也没有想出解决办法,目前忙于学校的事情,暂时也没时间研究,爱莫能助啊.....
希望有真大牛能帮助....

from magiccamera.

wuhaoyu1990 avatar wuhaoyu1990 commented on July 19, 2024

你可以看下https://github.com/google/grafika 试试

from magiccamera.

scientt avatar scientt commented on July 19, 2024

好的,非常感谢您的指导。

from magiccamera.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.