I'm using VideoSurfaceView extends GLSurfaceView to render filtered video. I'm doing it buy changing the fragment shader according to my needs. Now I would like to save/render the video after the changes to a file of the same format(Ex. mp4 - h264) but couldn't find how to do it.
I am using this library - https://github.com/krazykira/VidEffects.
Any experts here?
I would try and use the MediaProjection API. Here is an Google sample for this api. Notice: this might not work on the new emulators.
Related
I am new in video streaming related project! I Create a streaming server with ant media. Its working fine with opengl GLSurfaceView. But I want to replace this GLSurfaceView with custom cameraview. But I'm unable to figure out how to do it. I seen an opensource project on github: https://github.com/natario1/CameraView
I want use this camera view as stream source.
I'm done with below code:
LiveVideoBroadcaster.LocalBinder binder = (LiveVideoBroadcaster.LocalBinder) service;
if (mLiveVideoBroadcaster == null) {
mLiveVideoBroadcaster = binder.getService();
mLiveVideoBroadcaster.init(LiveVideoBroadcasterActivity.this, mGLView);
mLiveVideoBroadcaster.setAdaptiveStreaming(true);
}
mLiveVideoBroadcaster.openCamera(Camera.CameraInfo.CAMERA_FACING_FRONT);
Here mGLView is GLSurfaceView I want replace it with this custom camera view. Can anyone suggest from where can I start?
I just want to get frames(bitmap) from a video in android.
Just like a method:
MediaCodecUtil.getFrameAt(long timeUs,Object otherParams);
I have query some blog,And I found MediaCodec is a good choose to do that.
but,how to do?Anyone help?
I believe that the easiest way will be to use MediaPlayer and set its output Surface to be ImageReader's Surface.
MediaPlayer will parse the video file, seek to the relevant frame, and decode it for you.
Currently I'm working on a android program using Mobile Vision. I am using the "TextRecognizer" class and one of the methods is .detect(Frame frame). Right now I have a image I want to input into it, however, the image is the file type "Bitmap". I have tried to convert it to "Frame" by casting it but that hasn't worked. If anyone has any suggesting it would be much appreciated.
Use the setBitmap method in the Frame.Builder class:
Frame outputFrame = new Frame.Builder().setBitmap(myBitmap).build();
I've implemented an android app that implements the CvCameraListener interface. In the onCameraFrame(Mat inputFrame) method I process the captured inputFrame from the camera.
Now to my problem: Is there a way that I can use a saved video file on my phone as an input instead of getting the frames directly from camera? That means I would like to have a video file input frame by frame in Mat format.
Is there a possible way to do that?
Thanks for your answers
though it is not tested and I don't have much experience in OpenCV on Android. Still, you can try like this:
//[FD : File descriptor or path.]
Bitmap myBitmapFrame;
MediaMetadataRetriever video_retriever = new MediaMetadataRetriever();
try {
retriever.setDataSource(FD);
myBitmapFrame = retriever.getFrameAtTime(..);
}
catch(...
:
Utils.bitmapToMat(myBitmapFrame, myCVMat);
You may have to implement some callback system as you can work with only OpenCV after it is initialized. Also, you can convert frame number to time-code.
Good Luck and Happy Coding. :)
I want to use google's API for displaying panoramas. Apparently I need for input a jpg with the panorama, in which I embed the metadata in XMP format. How can this be done? is it my job as a developer or the one's who creates the panorama? can this be done with a tool? ie photoshop?
Ok this is how I did it, I used photoshop which has an option to pass metadata from a custom template so I created an XMP file using the metadata mentioned in google documentation page. Hope it helps anyone who finds this post!
<?xpacket begin='' id=''?><x:xmpmeta xmlns:x='adobe:ns:meta/'>
<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
<rdf:Description rdf:about="" xmlns:GPano="http://ns.google.com/photos/1.0/panorama/">
<GPano:UsePanoramaViewer>True</GPano:UsePanoramaViewer>
<GPano:CaptureSoftware>Photo Sphere</GPano:CaptureSoftware>
<GPano:StitchingSoftware>Photo Sphere</GPano:StitchingSoftware>
<GPano:ProjectionType>equirectangular</GPano:ProjectionType>
<GPano:PoseHeadingDegrees>350.0</GPano:PoseHeadingDegrees>
<GPano:InitialViewHeadingDegrees>90.0</GPano:InitialViewHeadingDegrees>
<GPano:InitialViewPitchDegrees>0.0</GPano:InitialViewPitchDegrees>
<GPano:InitialViewRollDegrees>0.0</GPano:InitialViewRollDegrees>
<GPano:InitialHorizontalFOVDegrees>75.0</GPano:InitialHorizontalFOVDegrees>
<GPano:CroppedAreaLeftPixels>0</GPano:CroppedAreaLeftPixels>
<GPano:CroppedAreaTopPixels>0</GPano:CroppedAreaTopPixels>
<GPano:CroppedAreaImageWidthPixels>4000</GPano:CroppedAreaImageWidthPixels>
<GPano:CroppedAreaImageHeightPixels>2000</GPano:CroppedAreaImageHeightPixels>
<GPano:FullPanoWidthPixels>4000</GPano:FullPanoWidthPixels>
<GPano:FullPanoHeightPixels>2000</GPano:FullPanoHeightPixels>
<GPano:FirstPhotoDate>2012-11-07T21:03:13.465Z</GPano:FirstPhotoDate>
<GPano:LastPhotoDate>2012-11-07T21:04:10.897Z</GPano:LastPhotoDate>
<GPano:SourcePhotosCount>50</GPano:SourcePhotosCount>
<GPano:ExposureLockUsed>False</GPano:ExposureLockUsed>
</rdf:Description>
</rdf:RDF>