mp4parser icon indicating copy to clipboard operation
mp4parser copied to clipboard

How to get frames of video according to time as pictures(jpg) ?

Open wangchenyan opened this issue 7 years ago • 2 comments

thanks

wangchenyan avatar Jun 21 '18 08:06 wangchenyan

"What can't you do?

Create JPEGs from a movie. No - this is no decoder. The MP4 Parser doesn't know how to do that. Create a movie from JPEGs" I bet you're trolling right?

Tomygames avatar Jun 25 '18 23:06 Tomygames

This is not impossible. But you will have to use this library in combination with FFmpegMediaMetadataRetriever.

Let me explain:

You can get time between each frame by doing the following:

totalFrames = videoTrack.getSamples().size();
durationUs = videoTrack.getDuration() * 1000 *1000 / timeScale;
int intervals = Integer.parseInt(String.valueOf(durationUs / frames));

Above, intervals will provide you the intervals (in ms) between each frame. You can now pass these intervals to FFmpegMediaMetadataRetriever and retrieve all the frames from the video.

Please close this issue.

HBiSoft avatar Jan 27 '20 10:01 HBiSoft