uestccokey / EZFilter

A lightweight (<180KB), easy-to-extend Android filter and dynamic sticker framework for adding filters and stickers for camera, video, bitmap and view.(一个轻量级(<180KB)、易扩展的Android滤镜和动态贴纸框架,支持摄像头、视频、图片和视图添加滤镜和贴纸。)
MIT License
207 stars 56 forks source link

Add Text #45

Closed androidiapp closed 5 years ago

androidiapp commented 6 years ago

I want to add text in video and that text will animate on video with different animations. I tried it using FFMPEG But the output is not smooth. So i found your library

If you can help me in adding animating text in video and save it Please reply asap

uestccokey commented 6 years ago

This is very simple, you can convert the text to a Bitmap and then use it as a sticker.

androidiapp commented 6 years ago

How to animate Text?

I want to animate text continously for 10 seconds

uestccokey commented 6 years ago

Is the text position change? Or is the text content change? If the text position changes only, you can refer to GraffitiStickerRender.java If the text content changes, you need to convert each changed text to a Bitmap.

androidiapp commented 6 years ago

But In stickerRender class, There is only preview of stickers and How can save them to gallery ?

uestccokey commented 6 years ago
  1. You can use startRecording and stopRecording like VideoFilterActivity.java
  2. Use OffscreenVideo like VideoOffscreenActivity.java
androidiapp commented 6 years ago

ok Thanks But when i put my stickers in local storage then it is giving me exceptions

/storage/emulated/0/intro_text/

indexOutOfBound Exception

and in your demo you have put all resources in assets

How to import from particular folder in sdcard?

uestccokey commented 6 years ago

For example,

        Sticker sticker = new Sticker();
        sticker.components = new ArrayList<>();
        Component component = new Component();
        component.duration = 2000;
        component.src = "text";
        component.width = 245;
        component.height = 245;
        TextureAnchor textureAnchor = new TextureAnchor();
        textureAnchor.leftAnchor = new AnchorPoint(AnchorPoint.LEFT_BOTTOM, 0, 0);
        textureAnchor.rightAnchor = new AnchorPoint(AnchorPoint.RIGHT_BOTTOM, 0, 0);
        textureAnchor.width = component.width;
        textureAnchor.height = component.height;
        component.textureAnchor = textureAnchor;
        sticker.components.add(component);
        ComponentConvert.convert(context, component, Path.FILE.wrap("/storage/emulated/0/intro_text/"));
        setSticker(sticker);

        ScreenAnchor screenAnchor = new ScreenAnchor();
        screenAnchor.leftAnchor = new AnchorPoint(AnchorPoint.LEFT_TOP, 0, 0);
        screenAnchor.rightAnchor = new AnchorPoint(AnchorPoint.LEFT_TOP, 0, 0);
        setScreenAnchor(screenAnchor);

then your bitmaps should put in /storage/emulated/0/intro_text/text/ folder

androidiapp commented 6 years ago

ok thankyou so much 👍

elangosaravanan21 commented 5 years ago

@androidiapp did you achieve this? if yes can you please share how to add text on video and animate he text..