yangjie10930 / opengl4android Goto Github PK
View Code? Open in Web Editor NEWOpenGL运用在Android上的Demo,结合Camera和MediaCodec实现预览和渲染,用于实现视频的裁剪,翻转,缩放,滤镜功能。
OpenGL运用在Android上的Demo,结合Camera和MediaCodec实现预览和渲染,用于实现视频的裁剪,翻转,缩放,滤镜功能。
你的demo原代码(MP4Processor类):
mEGLHelper.setSurface(mOutputSurface);//这里传入编码器内部创建的输出surface
实际合成时间32秒左右
我改了代码:
mEGLHelper.setSurface(new SurfaceTexture(1));//这里不直接传入编码器的surface
在GLThread循环中,绘制之前调用以下代码:
mEglWindowSurface = mEGLHelper.createEGLWindowSurface(mOutputSurface);//这里才传入编码器的 surface,相当于又重新创建一个EGLSurface,
结果: 通过以上改法,其他条件不变,但合成效率提升一半,平均16秒左右
问题: 为什么一开始传入输出surface效率低,要先new SurfaceTexture(1),再重新创建EGLSurface,反而效率提升?
我测试是mEGLHelper.swapBuffers();这个方法耗时,源代码每次调用需要几十毫秒,修改后平均2毫秒左右
如果要渲染image怎么弄啊
有些手机是好的!有些就会报错:
java.lang.NullPointerException: Attempt to invoke virtual method 'com.joe.camera2recorddemo.OpenGL.Filter.OesFilter com.joe.camera2recorddemo.OpenGL.WrapRenderer.getmFilter()' on a null object reference
at com.joe.camera2recorddemo.OpenGL.MP4Edior.setTransformation(MP4Edior.java:375)
at com.joe.camera2recorddemo.Activity.AdjustActivity$1$1.run(AdjustActivity.java:158)
at java.lang.Thread.run(Thread.java:764)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.