Beauty Filters
Add real-time beauty filters to your video stream using ConoStream's VideoProcessor interface.
VideoProcessor Interface
ConoStream uses a VideoProcessor to process video frames before publishing:
public interface VideoProcessor {
// Process a video frame
VideoFrame process(VideoFrame frame);
// Release resources
void release();
}
ConoStream Beauty Processor
1. Add Beauty SDK
// Add to app/libs/
conostream-beauty-sdk.aar
// build.gradle
implementation files('libs/conostream-beauty-sdk.aar')
2. Create Beauty Processor
public class ConoStreamBeautyProcessor implements VideoProcessor {
private BeautyEngine beautyEngine;
private boolean isInitialized = false;
public ConoStreamBeautyProcessor(Context context) {
initBeautyEngine(context);
}
private void initBeautyEngine(Context context) {
beautyEngine = BeautyEngine.create(context);
beautyEngine.init(new InitCallback() {
@Override
public void onSuccess() {
loadDefaultBeautyParams();
isInitialized = true;
}
});
}
@Override
public VideoFrame process(VideoFrame frame) {
if (!isInitialized) return frame;
// Process frame with beauty effects
int texId = beautyEngine.renderFrame(frame);
return createOutputFrame(texId, frame);
}
@Override
public void release() {
beautyEngine.release();
}
}
3. Set Processor Before Joining
// Create processor
ConoStreamBeautyProcessor beautyProcessor = new ConoStreamBeautyProcessor(context);
// Set on video helper BEFORE joining
videoHelper.setVideoProcessor(beautyProcessor);
// Then join as host
videoHelper.joinAsHost(serverUrl, token, channelName, localVideoView);
Beauty Settings
// Skin smoothing (0.0 - 1.0)
beautyProcessor.setSkinSmoothing(0.7f);
// Skin whitening (0.0 - 1.0)
beautyProcessor.setSkinWhitening(0.3f);
// Eye enlargement (0.0 - 1.0)
beautyProcessor.setEyeEnlargement(0.4f);
// Face slimming (0.0 - 1.0)
beautyProcessor.setFaceSlimming(0.2f);
// Nose slimming (0.0 - 1.0)
beautyProcessor.setNoseSlimming(0.3f);
// Chin adjustment (-1.0 to 1.0)
beautyProcessor.setChinAdjustment(0.1f);
Stickers & Effects
// Load sticker
beautyProcessor.loadSticker("stickers/cat_ears.bundle");
// Remove sticker
beautyProcessor.removeSticker();
// Load filter
beautyProcessor.loadFilter("filters/warm.bundle");
// Remove filter
beautyProcessor.removeFilter();
Available Filters
| Filter | Description |
|---|---|
filters/natural.bundle |
Natural light enhancement |
filters/warm.bundle |
Warm tone filter |
filters/cool.bundle |
Cool tone filter |
filters/vintage.bundle |
Vintage effect |
filters/bright.bundle |
Brightness boost |
Cleanup
@Override
protected void onDestroy() {
super.onDestroy();
if (beautyProcessor != null) {
beautyProcessor.release();
}
videoHelper.release();
}
ℹ️
The beauty processor must be set before camera starts. Contact sales for the Beauty SDK bundle.