How to implement a video filter on an android such as instagram

I need to add a video filter to my Android app, like Instagram . I searched a lot, but did not find many things. Is there a library for this, like aviary sdk for image editing?

+4
source share
2 answers

The shortest way to do this is to use the OpenCV library for Java (importing it into an Android project can be a trick) - it allows you to easily extract each frame for various types of image objects that you can apply your filter to (not if OpenCV contains tools for this ), and then create a new video with the modified frames.

Keep in mind that this can be very related to CPU and battery consumption, and I'm not quite sure how this will work with various hardware configurations.

Another is a longer solution - dig into the Android NDK and try using ffmpeg. In general, this can reduce the load on the processor.

In addition, the new version of Android L will provide some basic filters for the camera (not sure if this video includes) https://www.youtube.com/watch?v=Xtp3tH27OFs so you can wait for some socket library

+1
source

I have provided some filter for videos such as instagram filter using OpenGL ES. It is very fast and very nice.

If you just want to filter and show the video, you can see about this example, you can visit https://www.virag.si/2014/03/playing-video-with-opengl-on-android/ . For another filter u, you can edit the shader_ fragment.

But if you need to filter the video and save it on the SD card, you will need mediacodec and mediamuxer. You can show an example here http://bigflake.com/mediacodec/ .

Hope this helps you and sorry for my english.

+1
source

Source: https://habr.com/ru/post/1262721/


All Articles