Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

video_thumbnail

this plugin generates thumbnail from video file or url. it returns image in memory or writes into a file. it offers rich options to control the image format, resolution and quality. supports ios and android.

video_file

video_thumbnail

methods

function parameter description return
thumbnaildata string

, imageformat [imageformat](jpeg/png/webp), int [maxheight](0: for the original resolution of the video, or scaled by the source aspect ratio), [maxwidth](0: for the original resolution of the video, or scaled by the source aspect ratio), int[timems]generates the thumbnail from the frame around the specified millisecond, int[quality](0-100)|generates thumbnail from

|[future]`

thumbnailfile string

, string [thumbnailpath](folder or full path where to store the thumbnail file, null to save to same folder as the video file), imageformat [imageformat](jpeg/png/webp), int [maxheight](0: for the original resolution of the video, or scaled by the source aspect ratio), int [maxwidth](0: for the original resolution of the video, or scaled by the source aspect ratio), int [timems] generates the thumbnail from the frame around the specified millisecond, int [quality](0-100)

creates a file of the thumbnail from the [future<string>]

warning:

giving both the maxheight and maxwidth has different result on android platform, it actually scales the thumbnail to the specified maxheight and maxwidth.
to generate the thumbnail from a network resource, the video must be properly url encoded.

usage

installing
add video_thumbnail as a dependency in your pubspec.yaml file.

dependencies:
  video_thumbnail: ^0.3.1

import

import 'package:video_thumbnail/video_thumbnail.dart';

generate a thumbnail in memory from video file

final uint8list = await videothumbnail.thumbnaildata(
  video: videofile.path,
  imageformat: imageformat.jpeg,
  maxwidth: 128, // specify the width of the thumbnail, let the height auto-scaled to keep the source aspect ratio
  quality: 25,
);

generate a thumbnail file from video url

final filename = await videothumbnail.thumbnailfile(
  video: "https://flutter.github.io/assets-for-api-docs/assets/videos/butterfly.mp4",
  thumbnailpath: (await gettemporarydirectory()).path,
  imageformat: imageformat.webp,
  maxheight: 64, // specify the height of the thumbnail, let the width auto-scaled to keep the source aspect ratio
  quality: 75,
);

notes

download or pull requests are always welcome. currently it seems have a little performance issue while generating webp thumbnail by using libwebp under ios.


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

Comments are closed.