how to save camera preview frame in video? - android

I am trying to add a green frame when record a video using android camera like the image below.
I build a custom cameraPreview and apply preview.setForeground(getDrawable(R.drawable.frame_green)); in the Camera Activity
After recording a video, this green frame won't show in the video.

You cannot use MediaRecorder to save a video with modified camera stream. You can use MediaCodec to encode modified video (see CameraToMpegTest sample at http://bigflake.com/mediacodec).
Or you can post-process the video file, as suggested by H.Brooks in comments above.

Related

How to flip(mirror effect) a video in a VideoView?

I know there are ways using TextureViews and some other ways, but can we do a video flip in a VideoView, I tried using the method scaleType of X axis to -1, but just getting a black screen. Is there no way to do a simple video flip for a video being played in a videoview? Am I forced to use a TextureView or other methods?
As you said, the best option is to use TextureView... Android's VideoView can only play videos straight and not mirrored.
If you want your app to play a video mirrored (for instance if the video was recorded using a front camera), you will need to use a TextureView, which can be easily mirrored by specifying android:scaleX=-1 in the XML file, or textureView.setScaleX(-1) in the code. (source)

Front facing Camera Recorded video not proper

I want to record Video using front facing camera. Using the example from here as reference. I changed the getCamerainstance method to getFrontFacingCamera. I am able to see the preview while recording. But when i close the recording and play the video, it is always some horizontal flickering lines. Seems like some encoding issue. I tried- changing the media recorder profile to QUALITY_LOW/ QUALITY_HIGH, - Setting the frame rate to 15. the same app works perfectly when i use rear camera.
P.S: I have set the preview's(surface view's) size to 208×208. (Should this affect? , It's working fine with rear camera).
Thanks
Finally solved it. (In case someone faces the same issue)
need to use: mediaRecorder.setVideoSize(320,240);

How can I show a preview picture after taking a video using MediaRecorder?

I am using MediaRecorder and a SurfaceView to create a custom video camera app. After the user has clicked a stop button, I'd like to show the user a preview of the video (maybe the first or last frame). Is there an easy way to do this?
Thanks!
for future references. It's possible to use the
surfaceHolder.getSurface().freeze();
to hold the last frame.

Android: Thumbnail

Is it possible to extract a Video Thumbnail using other frames than the first frame? Usually the first frame of a Video File is a black screen so I'm thinking its better to use other frame number or a frame anywhere in the middle of a video file that is not a black screen.
Take a look at ThumbnailUtils at this page:
http://developer.android.com/reference/android/media/ThumbnailUtils.html
That should help.

Android playing video with the camera surfaceview in background

Hello
i have a surfaceview and a videview in a framlayout. if i start the video in oncreate, i see all perfectly, the video playing while the camera plays in background.
but if i start the video after oncreate, for example in onpreviewframe, i can only hear the video, but it's like behind the camera, and all i see is the camera view.
any help?
You Need to Merge both layouts... see the Example.

Categories

Resources