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.
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);
}
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 {
}`
Is this normal?
Thank you.