Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding bitmap mask to video on Android?

Tags:

android

video

I've been looking for something about adding images to videos, but i haven't found what I wanted.

I'd like to add a bitmap/image mask in each frame of a video (it can be recorded or from SD), keeping the original sound, and save the video to the SD with the image.

Someone knows how it can be done in Android?

Thnx

like image 955
LNSD Avatar asked Jan 26 '26 07:01

LNSD


1 Answers

create a class that extends SurfaceView

public class PaintSurface extends SurfaceView { ....

In draw() function add code

@Override public void draw(Canvas canvas) { super.draw(canvas); canvas.drawBitmap(bitmap.img, bitmapPosX, bitmapPosY, null); } }

In onCreate function create an object of it.

videoView = new PaintSurface(this);

add it to your layout

RelativeLayout layut = (RelativeLayout) findViewById(R.id.lay);

layut.addView(videoView);

get a holder

videoHolder = videoView.getHolder();

set this holder's surface to the MediaRecorder object

recorder.setPreviewDisplay(videoHolder.getSurface());

like image 120
Devashish11 Avatar answered Jan 27 '26 21:01

Devashish11



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!