Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getFileThumbnail Overwrites Thumbnails with Same Filename When Extracting Multiple Frames #274

Open
stephane-archer opened this issue Sep 25, 2024 · 0 comments

Comments

@stephane-archer
Copy link

  Future<List<File>> getTwoFrame(String videoPath) async {
    final MediaInfo info = await VideoCompress.getMediaInfo(videoPath);
    var duration = info.duration;
    if (duration == null) {
      throw StateError("no duration detected");
    }

    var f1 = await VideoCompress.getFileThumbnail(videoPath, position: -1);
    var f2 = await VideoCompress.getFileThumbnail(videoPath,
        position: (duration / 2).toInt());
    assert(f1.path != f2.path);
    return [f1, f2];
  }

the assert here will always be false. you can't extract multiple thumbnails from a video using getFileThumbnail because they will overwrite themselves.
getFileThumbnail should generate files with a unique file name to avoid this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant