Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement ZegoEffect #1706

Open
furkanKotic opened this issue Jan 23, 2025 · 7 comments
Open

Implement ZegoEffect #1706

furkanKotic opened this issue Jan 23, 2025 · 7 comments

Comments

@furkanKotic
Copy link

I am trying to implement a beauty filter using ZegoEffect. I started with the DeepAR example but I couldn't figure out how to do it.
The methods that can be used to process frames in ZegoEffect are as follows:

Image

Example I420 process code:

ZegoEffectsVideoFrameParam param = new ZegoEffectsVideoFrameParam();
param.setFormat(ZegoEffectsVideoFrameFormat.I420);
param.setWidth(width);
param.setHeight(height);
if (mZegoEffects != null) {
    mZegoEffects.processImageBufferYUV(data, dataLength, param);
}

How can I integrate it?
https://docs.zegocloud.com/article/9916

@pedroSG94
Copy link
Owner

I think the only way is use the example code with textureId:
https://docs.zegocloud.com/article/9916#5

I'm not sure if this should works or not.
You can try copy this class:
https://github.com/pedroSG94/RootEncoder/blob/master/encoder/src/main/java/com/pedro/encoder/input/gl/render/filters/NoFilterRender.java
And add the code example inside draw method and replace the previousTextureId with the textureId result

@furkanKotic
Copy link
Author

Do I need to send the previousTexId parameter as mTextureId and assign the incoming zegoTextureId value to the previousTexId value?

Image

@pedroSG94
Copy link
Owner

pedroSG94 commented Jan 24, 2025

I'm not sure, test both cases. I think yes
Also, you can get width and height with getWidth() and getHeight() methods

@pedroSG94
Copy link
Owner

Also, to improve the performance avoid instace the ZegoEffect inside draw method and do it inside initGlFilter or constructor

@furkanKotic
Copy link
Author

ZegoEffect wants me to send textureId in a loop. For this reason, I think I need to use it in drawFilter. TextureId 0 comes in initGlFilter and ZegoEffect does not accept it.
No error occurs but I see a black screen.
Image

@pedroSG94
Copy link
Owner

pedroSG94 commented Jan 27, 2025

Hello,

It is not working but I'm not sure about the reason
Can you create a project example and share me it to test?

@furkanKotic
Copy link
Author

Sure. I sent an invite. @pedroSG94

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants