VideoThumbnails.getThumbnailAsync() return only key frames on Android

We want to generate several thumbnails per second from a video.

We call VideoThumbnails.getThumbnailAsync().

This line is called : return retriever.getFrameAtTime(time, MediaMetadataRetriever.OPTION_CLOSEST_SYNC);

Source: expo/VideoThumbnailsModule.java at master · expo/expo · GitHub

The second parameter accept several options described here: MediaMetadataRetriever  |  Android Developers

OPTION_CLOSEST_SYNC

This option is used with getFrameAtTime(long, int) to retrieve a sync (or key) frame associated with a data source that is located closest to (in time) or at the given time.

As you can see, retriever.getFrameAtTime(time, MediaMetadataRetriever.OPTION_CLOSEST_SYNC) only returns key frames, so we get the same thumbnail several times when we request several thumbnails in the same second of a video.

We would like to use the option OPTION_CLOSEST instead:

OPTION_CLOSEST

This option is used with getFrameAtTime(long, int) to retrieve a frame (not necessarily a key frame) associated with a data source that is located closest to or at the given time.

How can we call VideoThumbnails.getThumbnailAsync() that call retriever.getFrameAtTime(time, MediaMetadataRetriever.OPTION_CLOSEST)?

Should we report this as a bug?

Thanks in advance.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.