Neither ofVideoPlayer nor ofFbo is drawing if I use Opengles2 on Android

When I use ofFbo,
if I draw an ofVideoplayer object into an ofFbo:

void ofApp::setup()
{
    vidplayern.load("/storage/emulated/0/examp1/hands.mp4");
    vidplayern.play();
    ofSleepMillis(15000);
    vidplayern.setPosition(11);
    vidplayern.setPaused(true);

  
  
    fboo.allocate(vidplayern.getWidth(),vidplayern.getHeight());
}
void ofApp::update()
{
 vidplayern.update();
}
void ofApp::draw()
{

fboo.begin();
videoplayern.draw(0,0,videoplayer.getWidth(),videoplayer.getHeight());
fboo.end();

fboo.draw(0,0);

}

Now if I use in main.cpp:

ofGLESWindowSettings settings;
settings.setGLESVersion(2);
ofCreateWindow(settings);
ofRunApp( new ofApp() );

return 0;
}

I just get a blank black when I draw the ofFbo object.

If I use the exact same code in ofApp.cpp but if I use in main.cpp :

ofSetupOpenGL(1024,768, OF_WINDOW);
ofRunApp( new ofApp() );
return 0;
}

ofFbo object draws nicely the frame grabbed from vidplayern.

Is there a solution?I am using Openframeworks 0.11.0 for Android(on Windows).

Well, ofFbo not working on OpenGl and Opengles1 too, not just Opengles2.But drawing an ofVideoPlayer object seems working if I use Opengl or gles version 1.But if I use gles version 2, then neither ofFbo nor the ofVideoPlayer draws the texture.The situation is a bit more complex than I thought.

If I use Opengl or Opengles1 and use:

fboo.begin();
videoplayern.draw(0,0,videoplayer.getWidth(),videoplayer.getHeight());
fboo.end();

This draws a frame grabbed from ofVideoplayer at the bottom of the screen(without using fbo.draw()).

If I add:

fbo.draw(0,0);

Then still it draws videoplayer at the bottom of the screen and I think it is not drawing ofFbo but drawing just videoplayer instead.

If I just draw videoplayer without using ofFbo:

vidplayern.draw(0,0)

It draws the videoplayer at the top of the page.

If I use Opengles2, then:

    fboo.begin();
    vidplayern.draw(0,0);
    fboo.end(); 
    fboo.draw(0,0);

This code draws a blank black rectangle on top of the page.

Using gles2,without using ofFbo, just drawing videoplayer draws a blank black rectangle on top of the page, so the problem is not just with ofFbo, drawing an ofVideoPlayer object has the same problem.

Error log is like this:

29 23:29:48.989 571-11347/? E/MtkOmxVdecEx: [0xf1ccc000] [ERROR] Cannot get param: VDEC_DRV_GET_TYPE_GET_FRAME_CROP_INFO
06-29 23:29:48.989 571-14862/? E/MtkOmxVdecEx: [0xf1ccc000] MtkOmxVdec::GetExtensionIndex Unknown parameter name: OMX.google.android.index.configureVideoTunnelMode
06-29 23:29:48.989 571-14862/? E/MtkOmxVdecEx: [0xf1ccc000] MtkOmxVdec::GetExtensionIndex Unknown parameter name: OMX.google.android.index.useAndroidNativeBuffer2
06-29 23:29:48.990 571-18202/? E/MtkOmxVdecEx: [0xf1ccc000] MtkOmxVdec::SetConfig Unknown config index: 0x6F800002
06-29 23:29:48.990 571-18202/? E/OMXNodeInstance: setConfig(23b0378:MTK.DECODER.AVC, ConfigPriority(0x6f800002)) ERROR: UnsupportedIndex(0x8000101a)
06-29 23:29:48.990 571-14863/? E/MtkOmxVdecEx: [0xf1ccc000] MtkOmxVdec::SetConfig Unknown config index: 0x6F800003
06-29 23:29:48.990 571-14863/? E/OMXNodeInstance: setConfig(23b0378:MTK.DECODER.AVC, ConfigOperatingRate(0x6f800003)) ERROR: UnsupportedIndex(0x8000101a)
06-29 23:29:48.993 571-1653/? E/OMXNodeInstance: getConfig(23b0378:MTK.DECODER.AVC, ConfigCommonOutputCrop(0x700000f)) ERROR: BadParameter(0x80001005)
06-29 23:29:49.005 571-18202/? E/OMXNodeInstance: setParameter(23b0378:MTK.DECODER.AVC, ParamPortDefinition(0x2000001)) ERROR: BadParameter(0x80001005)
06-29 23:29:49.005 571-14863/? E/OMXNodeInstance: setParameter(23b0378:MTK.DECODER.AVC, ParamPortDefinition(0x2000001)) ERROR: BadParameter(0x80001005)
06-29 23:29:49.005 571-571/? E/OMXNodeInstance: setParameter(23b0378:MTK.DECODER.AVC, ParamPortDefinition(0x2000001)) ERROR: BadParameter(0x80001005)
06-29 23:29:49.006 571-11347/? E/MtkOmxVdecEx: [0xf1ccc000] [ERROR] Cannot get param: VDEC_DRV_GET_TYPE_GET_FRAME_CROP_INFO
06-29 23:29:49.007 571-1454/? E/MtkOmxMVAMgr: [0xf381b9d8] [ERROR] Can not find MVA from VA: 0xf3832210
06-29 23:29:49.019 571-14143/? E/VDO_LOG: ***iDataSize 112,mTeeType 0
06-29 23:29:49.019 571-14143/? E/VDO_LOG: u4LevelIdc 30
06-29 23:29:49.019 571-14143/? E/VDO_LOG: u4LevelIdc 30
06-29 23:29:49.019 571-14143/? E/VDO_LOG: u4FrameTsInterval value is 0x8256, u4FrameTimingInfo 0x77ff
06-29 23:29:49.019 571-14143/? E/VDO_LOG: MAX W:2048, H:1088, u4MaxFixedBufWidth=1920, u4MaxFixedBufHeight=1088
06-29 23:29:49.019 571-14143/? E/VDO_LOG: vdec_drv_h264_decode, u4LevelIdc 30
06-29 23:29:49.019 571-14143/? E/VDO_LOG: [Debug] getDpbSize final u4DpbSize (5)!!
06-29 23:29:49.028 571-14143/? E/VDO_LOG: [Info, h264_dec_init] u4Width 720, u4Height 576, u4PicWidth 720, u4PicHeight 576, u4BitDepthLuma 8, u4BitDepthChroma 8
06-29 23:29:49.034 571-14143/? E/VDO_LOG: [DEBUG] VDEC_DRV_GET_TYPE_QUERY_VIDEO_DPB_SIZE 5
06-29 23:29:49.034 571-14143/? E/VDO_LOG: [DEBUG] VDEC_DRV_GET_TYPE_QUERY_VIDEO_DPB_SIZE 5
06-29 23:29:49.034 571-14143/? E/VDO_LOG: [Info] no cropInfo in SPS
06-29 23:29:49.035 571-1454/? E/VDO_LOG: [Info] no cropInfo in SPS
06-29 23:29:49.035 571-1454/? E/OMXNodeInstance: getConfig(23b0378:MTK.DECODER.AVC, ConfigCommonOutputCrop(0x700000f)) ERROR: BadParameter(0x80001005)
06-29 23:29:49.036 571-14142/? E/VDO_LOG: DecodeEx return 1
06-29 23:29:49.036 571-14142/? E/MtkOmxMVAMgr: [0xf381b9d8] [ERROR] Can not find MVA from VA: 0x0
06-29 23:29:49.037 571-14142/? E/MtkOmxMVAMgr: [0xf381b9d8] [ERROR] Can not find MVA from VA: 0x0
06-29 23:29:49.037 571-14142/? E/MtkOmxMVAMgr: [0xf381b9d8] [ERROR] Can not find MVA from VA: 0x0
06-29 23:29:49.043 571-14862/? E/OMXNodeInstance: setParameter(23b0378:MTK.DECODER.AVC, ParamPortDefinition(0x2000001)) ERROR: BadParameter(0x80001005)
06-29 23:29:49.043 571-770/? E/OMXNodeInstance: setParameter(23b0378:MTK.DECODER.AVC, ParamPortDefinition(0x2000001)) ERROR: BadParameter(0x80001005)
06-29 23:29:49.044 571-1454/? E/OMXNodeInstance: setParameter(23b0378:MTK.DECODER.AVC, ParamPortDefinition(0x2000001)) ERROR: BadParameter(0x80001005)
06-29 23:29:49.046 571-18838/? E/MtkOmxMVAMgr: [0xf381b9d8] [ERROR] Can not find MVA from VA: 0xf35980a0
06-29 23:29:49.046 571-18838/? E/MtkOmxMVAMgr: [0xf381b9d8] [ERROR] Can not find MVA from VA: 0xf35980a0
06-29 23:29:49.046 571-18838/? E/MtkOmxMVAMgr: [0xf381b9d8] [ERROR] Can not find MVA from VA: 0xf35983f0
06-29 23:29:49.047 571-571/? E/MtkOmxMVAMgr: [0xf381b9d8] [ERROR] Can not find MVA from VA: 0xf38322d0
06-29 23:29:49.047 571-571/? E/MtkOmxMVAMgr: [0xf381b9d8] [ERROR] Can not find MVA from VA: 0xf3832360
06-29 23:29:49.047 571-11347/? E/MtkOmxMVAMgr: [0xf381b9d8] [ERROR] Can not find MVA from VA: 0xf3832310
06-29 23:29:49.047 571-14863/? E/MtkOmxMVAMgr: [0xf381b9d8] [ERROR] Can not find MVA from VA: 0xf3598490
06-29 23:29:49.048 571-14862/? E/MtkOmxMVAMgr: [0xf381b9d8] [ERROR] Can not find MVA from VA: 0xf3832210
06-29 23:29:49.048 571-770/? E/MtkOmxMVAMgr: [0xf381b9d8] [ERROR] Can not find MVA from VA: 0xf3598450
06-29 23:29:49.049 571-1454/? E/MtkOmxMVAMgr: [0xf381b9d8] [ERROR] Can not find MVA from VA: 0xf38321a0
06-29 23:29:49.049 571-1653/? E/MtkOmxMVAMgr: [0xf381b9d8] [ERROR] Can not find MVA from VA: 0xf3598110
06-29 23:29:49.051 571-14143/? E/VDO_LOG: u4LevelIdc 30
06-29 23:29:49.052 571-14143/? E/VDO_LOG: u4LevelIdc 30
06-29 23:29:49.052 571-14143/? E/VDO_LOG: handleSPSNALU() 1 u4LevelIdc 30
06-29 23:29:49.052 571-14143/? E/VDO_LOG: vdec_drv_h264_decode, u4LevelIdc 30
06-29 23:29:49.052 571-14143/? E/VDO_LOG: [Debug] getDpbSize final u4DpbSize (5)!!
06-29 23:29:49.052 571-14143/? E/VDO_LOG: handleSPSNALU() 2 u4LevelIdc 30
06-29 23:29:49.052 571-14143/? E/VDO_LOG: DecodeEx return 1
06-29 23:29:49.052 571-14143/? E/VDO_LOG: DecodeEx return 1
06-29 23:29:49.05

I think I found the solution here:

schmitzware’s fix is working(although it was from year 2015), I just replaced the ofVideoPlayer.java and ofxAndroidVideoPlayer.cpp files with the code from schmitzware’s files,a few tiny modifications(to make them be able to compile ) and it worked.Now I can draw ofVideoPlayer using both with ofFbo and without ofFbo and when Gles2 is set :smiley:

Not much a problem but isLoaded() function for ofVideoPlayer doesn’t work anymore, although it loads the video file, isLoaded() function returns false.

Well, there is another problem.

When I draw two ofVideoPlayer() objects on Android using Gles2 and the solution I wrote above, if I draw 2 ofxVideoPlayer objects and load and play two different movies at the same time, load movie1 for ofVideoPlayerobject one and load movie2 for other of Videoplayer object,two objects play both of the movies at the same time , something like: ofxVideoPlayer object 1 plays one frame from the movie1 and then plays one frame from the movie2,then 1 frame from movie1 then one frame from movie2.The other ofxVideoPlayer object does the same.

When I draw them inside ofFbo, to grab a frame from both of the movies and store them, after I pause them ,it draws the same frame of the same movie from both ofVideoPlayer objects.

How can I solve this problem?When I run the same code on Windows, there is no problem.

Actually what I want to do is, I want to grab just one frame from every movie file inside a directory and display those frames, on Android.How can I do this, maybe there is a better/another way?