Comments (3)
The performance of glReadPixels() seems to vary widely between different devices and different driver releases. This is why I added a trivial benchmark to Grafika. (What values do you get?)
http://bigflake.com/mediacodec/#ExtractMpegFrames shows some timing values for extracting video frames with glReadPixels(); on a Nexus 5 the function ran quickly, and most of the time was spent elsewhere (primarily PNG compression in that case).
(The convertToBitmap() function you reference could be sped up by inverting the Y axis in the GL rendering, rather than the bitmap copy, and it'd annoy the GC less if the pixel buffers were allocated once and re-used. But if that's not the bottleneck then there's no reason to mess with it.)
One partially-completed attempt to use non-public APIs from the NDK can be found at http://stackoverflow.com/questions/21151259/replacing-glreadpixels-with-egl-khr-image-base-for-faster-pixel-copy/21199078#21199078 ; I think with the final "edit" it would actually work, but I never got around to trying it out (and at this point it's unlikely I ever will).
The fastest way to get images to disk is to use the MP4 video encoder, but that's usually not appropriate unless your input is video.
from grafika.
Hey @fadden,
The time glReadPixels in convertToBitmap() method takes on Nexus 5 (Android L) for 3264 X 2448 size image comes out to be 689 milli seconds.
In grafika 3264 X 2448 size image takes 51.416 milli seconds on Nexus 5 with on Android L.
from grafika.
That's a lot of pixels. Even so, I suspect you may be hitting a slow path in the driver to get performance that bad.
In any event, this is a bit out of scope for Grafika, since there isn't yet a public Java-language API that will make this faster.
from grafika.
Related Issues (20)
- Sound not available in Video using CameraCaptureActivity HOT 1
- how can i remove shape HOT 1
- how can i add shapes in texture view using open gl
- glReadPixels returns a blank image on disabling blend
- Decoding four video streams simultaneous on Google Pixel 2 phone
- seconds of video in Continuous Capture mode becomes double after keeping it on for a while. HOT 3
- If you want to record mp4 with sound, use this one https://github.com/moo611/OpenCamera
- Memory leak of Texture2dProgram
- Continuous capture bug(Android5.1.1) HOT 1
- Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x38 in tid 9379, pid 9379
- Some OpenGL stuff doesn't work on some devices: eglMakeCurrent failed and glDrawArrays: glError 0x505 HOT 4
- How to show front and back camera simultaneously? HOT 5
- Can we play scene.json in grafika?
- Test HOT 1
- Doesn't build on Flamingo and Giraffe HOT 2
- fun fact HOT 1
- Camera2 Pass Images from ImageReader to MediaRecorder HOT 2
- Camera2 pipeline; synchronously get PRIVATE/YUV/RGB Image data from a Frame HOT 4
- Website
- OpenGL + MediaRecorder.VideoEncoder.AV1 - a freezing video (like very low fps)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grafika.