Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frames missing from extraction. #241

Open
namhkoh opened this issue Apr 4, 2021 · 0 comments
Open

Frames missing from extraction. #241

namhkoh opened this issue Apr 4, 2021 · 0 comments

Comments

@namhkoh
Copy link

namhkoh commented Apr 4, 2021

I am currently developing a feature where a system can extract frames from a video every second. For the most part, I am able to extract the frames every second but notice that it always stops before the last frame of the video. For instance, if the video is 10 seconds long, it seems to extract up to 9 seconds.

Here is the method:

`private void extractImageFrame(String absPath) throws IOException {

    FFmpegMediaMetadataRetriever med = new FFmpegMediaMetadataRetriever();
    med.setDataSource(absPath);
    String time = med.extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_DURATION);
    int videoDuration = Integer.parseInt(time);
    Log.e("video duration", String.valueOf(videoDuration));

    for (int i = 1000000; i < videoDuration * 1000; i += 1000000) {
        Bitmap bmp = med.getFrameAtTime(i, FFmpegMediaMetadataRetriever.OPTION_NEXT_SYNC);
        Log.d("Frame extracted at ", String.valueOf(i));
        saveBit(bmp);
    }

}`

Is this normal?

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant