How to capture a frame from video in android?

前端 未结 2 1936
被撕碎了的回忆
被撕碎了的回忆 2021-01-20 15:09

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 \"c

相关标签:
2条回答
  • 2021-01-20 15:56

    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.

    0 讨论(0)
  • 2021-01-20 15:59

    You can get a video frame with MediaMetadataRetriever. The basic usage is as follows.

    MediaMetadataRetriever retriever = new MediaMetadataRetriever();
    
    // 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.
    Bitmap bitmap = retriever.getFrameAtTime(timeInMicroSeconds);
    
    // Do something with your bitmap.
    

    You might want to use FFmpegMediaMetadataRetriever for better performance.

    0 讨论(0)
提交回复
热议问题