I've been strugling with this for some time now, found some topics about using TextureSurface, FFmpegFrameGrabber etc but still dont have a clue. I would like load a video file, than take a frame and make some modifications ( process frame using either JavaCV or OpenCV4Android) and show it to back to the user. This proccess should be repeated for every frame in video file. Does anyone have a clue how to do that ?
Asked
Active
Viewed 991 times
0
-
maybe you find some information here or in one of it's links: http://answers.opencv.org/question/6576/opencv-and-ffmpeg-for-android/ – Micka Mar 19 '14 at 15:28
-
Thanks for reply. I've already used FFmpegFrameGrabber with JavaCV and have been trying to convert IPplImage to Bitmap and set it to ImageView, but i believe this is not a clean soulution. I would prefer some best practice, if there is one. – user3438183 Mar 19 '14 at 19:37
1 Answers
0
I have not yet used FFmpegFrameGrabber before, but I use ffmpeg JNI writed by myself. My solution is:
- Get frame data (NV21 or BGR24) by ffmpeg.
- Process the frame data by my image / video processing algorithm.
- Upload frame data to GPU as OpenGL texture.
- Display data by OpenGL fragment shader in a fullscreen rectangle.
I have another idea if the 2th operation can be written in GPU shader (Many real-time camera effects in mobile are done by this method). You can use MediaPlayer instead of ffmpeg. And write GPU shader for SurfaceTexture.

maxint
- 1,005
- 8
- 12
-
I tried the 1. approach but it gives me the same frame rate as changing bitmap directly on ImageView (maybe the reason might be using Opengl ES 1.0, i'll try it on Opengl ES 2.0) and number of dynamically changed textures is limited, I confes I may be doing something wrong with changing textures in OpenGL because I am a novice in Android and started to looking for OpenGL just today. – user3438183 Mar 20 '14 at 22:51
-
If the image format of video frame is NV21, it's faster to decode and display the data in OpenGL shader. Otherwise, maybe there is no too much difference in performance when compared with your bitmap solution. – maxint Mar 21 '14 at 02:17