Android video mirror effect - android

I'm working on a camera application that has to capture video in mirror effect. I used texture view to show video preview with mirror effect. Now video preview showing mirror effect but after video being captured and saved it don't have mirror effect.
I used MediaRecorder to save video file.
I Google this problem but didn't find any solution.
I want to save video with mirror effect as shown in camera preview.
thanks in advance.

I have solved this problem by flipping the video.
when the video is completed I'm storing the original video temporary and then applying the flip effect and got the mirror effect in video.
Flip video library

Related

Is there a way of playing a video with a alpha channel on android?

I have a set of video animations with an alpha channel. I would like the user of the android app to record a video and play the animation that overlay the camera view at the same time. I have searched the Internet but didn't find any solution to achieve this. Have you any ideas of how that can be achieved?
For Preview:
You could try using opencv to read the video frame by frame and then overlay it with the camera frame and display it on a textureview.
[EDIT]: This doesn't work since opencv on android doesn't have the ability to extract frames from a video, as there is no native ffmpeg support.
For Recording:
You cannot record video this way and your best bet is to use ffmpeg to overlay the animation video on the recorded video.
Opencv4android: http://docs.opencv.org/2.4/doc/tutorials/introduction/android_binary_package/dev_with_OCV_on_Android.html
Read Video frame by frame: (http://answers.opencv.org/question/5768/how-can-i-get-one-single-frame-from-a-video-file/)
Blending frames on opencv: (http://docs.opencv.org/2.4/doc/tutorials/core/adding_images/adding_images.html)
FFFMPEG on Android: https://android-arsenal.com/details/1/931

Android camera video mirror

Hello android developers,
I am using camera API, and facing a problem which cause the front camera video flip mirror when finish record and display on videoView.
So is there a solution to scale the Camera/VideoView mirroring?
If the problem was in picture I could use matrix scale on the image.
Thanks for helping.
You cannot do this with MediaRecorder because it's not an orientation problem, it's about frames that you have to mirroir yourself to achieve this result.
The optimal solution is to use ffmpeg which is one of the best tool to do the video morroring with command line. With this tool you can still record with MediaRecorder and use ffmpeg command after recording to reverse frames but if your video is too large it can be long to treat and therefore does not meet the need.
Another way would be using OpenCV with ffmpeg to get the mirorred video at the end of the recording.

Android - Add text or image while recording video?

I am struggling with recording and editing videos. For editing, I found a useful library in Android named ffmpeg4Android. However, I am still get stuck in recording video. Here is what I want:
1/ Add text or images in video while recording
2/ Add filter while recording video
I found there is a library GPUImage for Android but it has only some examples related to taking a photo, not to recording video)
Please let me know if you have any ways or any suggested libraries which can do it.
Thank you in advance!
Links which I read when researching:
Add overlay while record video on Android
How to Record video with GPUImage?
FFMpeg add text to actual video file after recording in Android
You can add an overlay image on video using a blend filter.
You cannot add text directly but you can add the text to the image writing on a canvas.
android-gpuimage library does not natively support video recording but you can try using the android-gpuimage-videorecording library. It is a fork of the gpu-image for android that provides also the video recording functionality
android-gpuimage-videorecording
see the GPUImageMovieWriter class
It should point you in the right direction for developing your own video writer on top of GPUImage.
The idea is to:
draw on current screen surface
switch to encoder input surface and draw previous frame buffer again on it
switch back to screen surface
other useful links: EGL surface helper, Media encoder

how do I capture a video square like instagram and vine using Mediarecorder

I have tried by setting the videosize(width,height) for mediarecorder, but this has device compatibility issue, on few devices its crashing at mediarecorder.start();
If the device happens to support a square video size, you are welcome to use it. Most will not.
Vine, based on the last reports that I heard, does not use MediaRecorder. Instead, they use preview frames from the camera, which they crop to be square and assemble into a video. I do not know what Instagram does.
You are also welcome to record a non-square video, then post-process the video yourself to crop it to be square.

Add overlay while record video on Android

I want to record video by camera in my Android device. I need to add overlay image over recorded movie. In iOS I would use GPUImage. In Android I found Android GPUImage. I tried to use it but I didn't found any way to add any filter while video recording. In provided example I could add filters only for taking photos. Is there any ways to record video with filters with Android GPUImage? Is there any other ways to add images overlay over recording video in realtime? If not, is there any ways to add images overlay over recorded video in postprocessing?
You can add an overlay image on video using a blend filter.
About video recording: android-gpuimage library does not support it but you can try using the android-gpuimage-videorecording library. It is a fork of the gpu-image for android that provides also the video recording functionality
android-gpuimage-videorecording
see the GPUImageMovieWriter class
It should point you in the right direction for developing your own video writer on top of GPUImage.
The idea is to:
draw on current screen surface
switch to encoder input surface and draw previous frame buffer again on it
switch back to screen surface
other useful links: EGL surface helper, Media encoder
This project (MagicCamera) has many multiple input filters. You can write your own fragment shader to overlay an image on camera texture (similar to MagicN1977Filter). It also includes video recording.

Categories

Resources