I want to store the thumbnail image for video after the user start recording, because i want to use the only few video to list which is stored under specific instead of all video from sdcard.
If i want to shoe all video i got the thumbnails form MediaStore class, but i need for specific video i have to store the thumbnails separately for the particular video. Any suggest
some idea to achieve this.
If it is possible tell me how to capture the surface View of camera to save it as bitmap image for use it as Thumbnails.
Thanks
The first frame can be taken using the NDK and ffmpeg, but it's more trouble than it's worth.
The simple way is to use ThumbnailUtils as per this answer, provided you are on android-8 (Froyo) or later.
Related
I'm creating an Android app that makes use of OpenCV to implement augmented reality. One of the needed features is that it saves the processed video. I can't seem to find any sample code on real-time saving while using OpenCV.
If the above scenario isn't possible, another option is to save the video first and have it post-processed by OpenCV and saved back as a new file. But I can't find any sample code for this either.
Could someone be kind enough to point me to either direction, or give me an alternative? It's ok if the alternative doesn't use OpenCV.
Typical opencv flow is, you receive frames from camera, convert to RGB format, perform matrix operations then return to activity to display in View. You can actually store the modified frames as images somewhere in sdcard and use jcodec to create your mp4 out of your images. See Android make animated video from list of images.
In my application, we are capturing a video and uploading it to YouTube. But the requirement is, we need to display one image for 2 seconds before the video and after the video (similar to ads in Youtube videos)
And also we need to display a logo at bottom right corner of the video.
I searched for YouTube API for this and couldn't find any clue. Is there any way to do this?
Thanks in advance.
As far as the logo goes, your best bet would probably be to extend the YouTubePlayerView and add the logo on top of the video.
For displaying the image, I would create a layout that can hold either the video or the image. You could then use a FragmentManager to switch between the image and the video. Use a Timer to display the image for 2 seconds and then use the FragmentManager to switch to the YouTubePlayerView (or whatever your extended class is).
Then you will have to extend the YouTubePlayer.PlaybackEventListener to work with your new view. Call the onStopped() method of this listener to switch back to the image after the video is done playing.
EDIT
What it appears you want to do is some video editing. This is definitely not something that you will be able to do through the YouTube API, so you have no choice but to do it natively though the app.
First, you will have to convert the image to an mp4 file. This is no easy task, but this code seems to provide a solution. Make sure that the video from the image has the same encoding as the original video. This makes it possible to combine the videos using MP4Parser (although I have never actually used this library, it claims to work for this).
Finally, to make the video upload to YouTube with the logo, you will need to decode the video, embed the image onto every frame, and encode again. Doing this manually would be difficult, so I recommend using something like ffmpeg. FFmpeg contains a bunch of useful libraries and functions for multimedia data handling like this. Here is a link to an Android wrapper for FFmpeg. I have used ffmpeg alot in the past and the man page is pretty helpful, but I have not tried it on Android.
i want to capture the image from camera and upload on server
for capturing image which is best direct using intent simple sort code or using view or surfaceview which is best
when you use the basic Intent, you don't really need to bother with sufaceView or View. the user is prompt with the image and is asked if to save it or not. using the onActivityResult will take care of the upload.
have you looked at the android camera image capture? they have sample code for all the possibilities of capturing images from the android camera.
If you want some customization in your activity or some other functionality with image capturing then surfaceview is best. One example i have already given you can try this to capture frames. I have explained everything if you are having any problem then you can ask I will try to help you. Instead of onPreviewFrame use on picture taken.
Android Camera Surface View
hope it will help you.
How to create the video from series of png images. Is it possible in android can any body suggest me to do that?
yes its possible to generate a video (not exactly video, but like video) through the series of images.There is what you call "mpeg stream" which consists of the JPEG images in the multipart fashion that you read from a source (remote basically) and continuously updating the UI on the screen by parsing it nad fetching the binary content and converting it to objects of bitmap.If you are having the images locally, you can simply instanciate the bitmap objects and the place them periodically on the UI / ImageView on screen.What you needs to care about is that the updating frequency should be such that user sees it like a video is playing.If you have to make a short period video (some animation kinda video) with the help of the already made frames/images, you can follow the linkhttp://android-support-akkilis.blogspot.com/2011/12/animation-drawbles-in-android.html Hope this helps
In my app I have a requirement to create a video from the screen activities programatically. (ie: I am running some animations for some time I need to convert these animations to a video, like video demos.)
I have been searching for this for the last week, but I haven't found any solution. I don't know whether it is possible in Android or not. If it is, please tell me the way or suggest me some links.
If you want to capture the screenshots from "within your activity", it is possible. Follow this post
Having grabbed the screenshoton a bitmap, you need to encode the frames to a video yourself.
Captured bitmap --> JNI (Native-bitmap) --> feed input buffer to a native encoder (ffmpeg) --> save to file
This project will meet your request Android-MJPEG-Video-Capture-FFMPEG
It is just to convert jpegs into a movie file by ffmpeg bin