Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 

 1 Answer(s)

  • Below is the code

     ArrayList<Bitmap> frameList;
    String absolutePath;
    /* MediaMetadataRetriever class is used to retrieve meta data from methods. */
    MediaMetadataRetriever retriever = new MediaMetadataRetriever();
    try {
    //path of the video of which you want frames
    retriever.setDataSource(absolutePath);
    }catch (Exception e) {
    System.out.println("Exception= "+e);
    }
    // created an arraylist of bitmap that will store your frames
    frameList = new ArrayList<Bitmap>();
    String duration = retriever.extractMetadata(MediaMetadataRetriever.METADATA&#95;KEY&#95;DURATION);
    int duration&#95;millisec = Integer.parseInt(duration); //duration in millisec
    int duration&#95;second = duration&#95;millisec / 1000; //millisec to sec.
    int frames&#95;per&#95;second = 2; //no. of frames want to retrieve per second
    numeroFrameCaptured = frames&#95;per&#95;second * duration&#95;second;
    for (int i = 0; i < numeroFrameCaptured; i++)
    {
    //setting time position at which you want to retrieve frames
    frames.add(retriever.getFrameAtTime(5000*i) )
    }
    

    Hope, It will help you. :)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: