How To Capture A Frame From Video In Android?
Hi i have made a custom video played in android.with some simple 'play','pause','play again' and 'capture' button.NOw i have done all this functionalities except 'capture'.I have s
Solution 1:
You can get a video frame with MediaMetadataRetriever
. The basic usage is as follows.
MediaMetadataRetrieverretriever=newMediaMetadataRetriever();
// Set data source to retriever.// From your code, you might want to use your 'String path' here.
retriever.setDataSource(yourPath);
// Get a frame in Bitmap by specifying time.// Be aware that the parameter must be in "microseconds", not milliseconds.Bitmapbitmap= retriever.getFrameAtTime(timeInMicroSeconds);
// Do something with your bitmap.
You might want to use FFmpegMediaMetadataRetriever
for better performance.
Solution 2:
I too have searched the same for some days and finally i came across opencv library through that we can able to read the frames from a live video and do the operations accordingly.
I have did successfully and keeping the project in github for your reference.
https://github.com/Karthi96/Video-Recorder-with-Frames-Analysis
Let me know if you still need a help.
Post a Comment for "How To Capture A Frame From Video In Android?"