@Nullable
  private static Bitmap createThumbnailFromContentProvider(
      ContentResolver contentResolver, Uri uri) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD_MR1) {
      MediaMetadataRetriever mediaMetadataRetriever = null;
      try {
        ParcelFileDescriptor videoFile = contentResolver.openFileDescriptor(uri, "r");
        Preconditions.checkNotNull(videoFile);
        mediaMetadataRetriever = new MediaMetadataRetriever();
        mediaMetadataRetriever.setDataSource(videoFile.getFileDescriptor());
        return mediaMetadataRetriever.getFrameAtTime(-1);
      } catch (FileNotFoundException e) {
        return null;
      } finally {
        if (mediaMetadataRetriever != null) {
          try {
            mediaMetadataRetriever.release();
          } catch (IOException ex) {
            // Nothing to do.
          }
        }
      }
    } else {
      return null;
    }
  }
A producer that creates video thumbnails.

<p>At present, these thumbnails are created on the java heap rather than being pinned purgeables.
This is deemed okay as the thumbnails are only very small.
imagepipeline/src/main/java/com/facebook/imagepipeline/producers/LocalVideoThumbnailProducer.java