1

We're building a simple Android app where user can create a collage of images and video and then export it as a single video. Our current code on 16, 17 is very slow. So imagine if we have 6 videos 1 min long (each) it take us about 15min to combine them -- when they are playing one after another -- and about 7 mins when they are working simultaneously. I want to bring it to maximum of twice the total length of the video. So, for last example 2 min when playing simultaneously and 12 mins when playing one after another.

We've tried some software libraries like FFMPEG without any help. Probably we should go hardware decoding route. For which probably we should mess up with NDK. I found this article https://vec.io/posts/faster-alternatives-to-glreadpixels-and-glteximage2d-in-opengl-es that is helpful. But I need some help on it ....

  • What percent of the time is spent in `glReadPixels()`? 15 minutes to encode 6 minutes of 30fps video seems long enough that your pixel read speed may not be your issue. There's a crude benchmark in Grafika that you can try (https://github.com/google/grafika). – fadden Jan 25 '15 at 17:27
  • We are making collage out of videos each video is displayed ina seperate frame hence using `code`GLSurfaceView`code` to accelerate the process. However to get final extracted combined video we need to provide frames to `MediaMuxer`, in 18 and above we can attach `GLSurfaceView` output to `MediaMuxer`, however in 17 and 16 that api is not avilable so we need to find a work arroudn by saving the frames as jpegs and then creating a final video out of it. – Sana__Ahmed Jan 26 '15 at 04:40
  • Just wanted to add we are saving jpegs in a seperate thread already and even if we comment that code it only lessen 30 seconds. – Sana__Ahmed Jan 26 '15 at 04:42
  • You're going to get backed up behind the JPEG compressor. While `glReadPixels()` can be slow, it's not going to be JPEG-compression slow. I put some timings in http://bigflake.com/mediacodec/#ExtractMpegFramesTest when extracting frames to PNG; you can see the difference there. If you've got the JPEG compression happening in parallel, and the threads aren't interfering with each other, then the time required is only dependent on the JPEG compression speed -- so long as `glReadPixels()` is faster than JPEG compression, it will have no effect on the total duration of the process. – fadden Jan 26 '15 at 16:52
  • hmmm thanks for teh insight i went with `GLTextureView` instead and used the `getBitmap()` from it that worked for me to lessen the time alot. Thanks @fadden I really apreciate your time and help thank you. – Sana__Ahmed Jan 28 '15 at 07:23

0 Answers0