video_manipulation 0.1.7

video_manipulation #

A library for manipulating videos. This library has the following features

  • Changing a videos framerate
  • Changing a videos speed/duration
  • Adding still frames to an existing video, e.g. watermarks
  • Generate videos from images

NOTE: Currently supports iOS only

Install #

Simply add the following line to your pubspec.yaml file:

video_manipulation: ^0.1.7

Usage #

The plugin currently has one static method for all video manipulation: .generateVideo(List<String> paths, String filename, int fps, double speed).

Parameters paths list of input file paths. Can be images (.jpg or .png) or video files (.mp4) that are used to generate the new video. E.g.: ["documents/input.mp4", "documents/watermark.jpg] - in this case the plugin would add the "watermark.jpg" image to every frame of the "input.mp4" video. The image would be scaled to have the same size as the "input.mp4" video.

filename the filename of the generated video. The directory of the first input file is used as output directory.

fps frames per second of the output file.

speed a value between 0.1 (slowmotion) and 1xxx.0 (timelapse). 1.0 to keep the same speed.

The method returns the full path of the generated video when successful.

How it works #

This plugin is using AVFoundation on the iOS part to extract frames from a video and also encoding them back to an mp4 file. Android has currently no implementation. FFmpeg won`t be implemented due to licensing, extra overhead from the ffmpeg binaries and overall slow performance. A possible solution could be

0.1.7 #

  • Added demo example
  • Updated readme

0.1.6 #

  • Fixed memory issues during frame extraction


video_manipulation_example #

Demonstrates how to use the video_manipulation plugin.

void generateTimelapse() async {
    final speed = 6.0;
    final framerate = 60;
    final inputFilename = "clock.mp4";
    final outputFilename = "clock-processed.mp4";
    final docDir = (await getApplicationDocumentsDirectory()).path;
    final inputFilepath = docDir + "/" + inputFilename;

    _outputFilepath =
        await VideoManipulation.generateVideo([inputFilepath], outputFilename, framerate, speed);

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  video_manipulation: ^0.1.7

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:video_manipulation/video_manipulation.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Aug 19, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19
  • Flutter: 1.7.8+hotfix.4


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health issues and suggestions

Document public APIs. (-1 points)

5 out of 5 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Format lib/video_manipulation.dart.

Run flutter format to format lib/video_manipulation.dart.

Maintenance suggestions

The package description is too short. (-16 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.3.0-dev.0.1 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8