Flutter subtitle editor

A video subtitle editing library that includes subtitle generation, subtitle editing, subtitle export, and related UI components for Flutter.

Android iOS
Support SDK 16+ 11.0+

📖 Installation

Following steps will help you add this library as a dependency in your flutter project.

  • Run flutter pub add video_subtitle_editor, or add video_editor to pubspec.yaml file manually.
dependencies:
  video_subtitle_editor: ^1.0.0
  • Import the package in your code:
import 'package:video_subtitle_editor/video_subtitle_editor.dart';

📸 Screenshots

subtitle slider edit text

👀 Usage

1. Init subtitle controller, you can init with file or assets

  late final VideoSubtitleController _controller = VideoSubtitleController.file(
  widget.videoFile,
  );

@override
void initState() {
  super.initState();
  @override
  void initState() {
    super.initState();
    var subtitlePath = "assets/test.srt";
    var controller = SubtitleController(
      provider: AssetSubtitle(subtitlePath),
    );
    _controller
    .initializeVideo()
    .then((_) =>
      setState(() {}))
    .catchError((error) {});
    _controller.initialSubtitles(controller);
    _controller.addListener(
        () {
          setState(() {});
          },
      );
    }
    }

@override
void dispose() {
  _controller.dispose();
  super.dispose();
}

2. add video viewer into you widget tree

 VideoViewer(
    controller: controller,
    child: SubtitleTextView(
    controller: controller,
    ),
  );

3. add subtitle viewer

  SubtitleSlider(
    height: 100,
    controller: _controller,
  ),

For more details check out the example.