LeGoffMael / video_editor

A flutter package for editing video written in pure Dart with fully customizable UI. Supports crop, trim, rotation and cover selection.

Home Page:https://pub.dev/packages/video_editor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Enable web platform

maRci002 opened this issue · comments

First of all, congratulations on this package.

The video editor feature is very powerful, however, the convert / export functionality could be decoupled from the package. For instance, I could let the user choose the aspect ratio / duration, but I want to do the conversion on the server side since:

  • I might want to generate multiple resolutions with the same execute command
  • I can rewrite export parameters at any time without publishing a new app
  • Client devices won't struggle to do the exportation
  • FFmpeg won't increase APK / IPA sizes
  • The package can support the web

My proposal is to create a new package for the export, let's say video_editor_export (it can be unlisted on pub.dev), which could use a federating plugin system so Android / iOS could import ffmpeg_kit_flutter, and web could import ffmpeg_wasm (currently, the ffmpeg_wasm package is not working properly. For instance, the corePath is ignored, the progress handler does nothing, but I have my own patches locally). This way, we could define our interface for the export functionality, and developers can import the video_editor_export package to do the export.

I know that the web has some limitations:

This library is written in Dart only but uses external packages such as ffmpeg_kit_flutter and video_thumbnail, which makes it available only on iOS and Android plaforms for now.

video_thumbnail support for web is on the way. See justsoft/video_thumbnail#135

I have made a demonstration video showing that the thumbnail generator and video export can also work on the web. Note that Path.combine might not work with the HTML renderer, but we can manually union and calculate the difference for two rects via Rect.intersect / Rect.expandToInclude and CropGridPainter._drawBackground sometimes paints over the video. For instance, when I switch back to trim:

video_editor.mp4

Wow, that's impressive work. Do you mind posting the sample code for how you made it work with ffmpeg_wasm? I'd love to be able to replicate it, at least until the package is updated for official web support.

commented

Wow! That's indeed very impressive!

I also think this package will need some change especially when people wants to use a different binary of ffmpeg #133.

Your idea would be to remove all the ffmpeg part from this package ? And include it in a different package video_editor_export ?

It sounds like a good idea, we could release a different package for each ffmpeg binary, then people could select it based on their needs :

video_editor_export_min: any
video_editor_export_min_gpl: any
video_editor_export_full: any
video_editor_export_full_gpl: any
video_editor_export_https: any

For the web it would need need another package video_editor_export_web right ?

Wow, that's impressive work. Do you mind posting the sample code for how you made it work with ffmpeg_wasm? I'd love to be able to replicate it, at least until the package is updated for official web support.

You can check out the changes made in PR #147

It sounds like a good idea, we could release a different package for each ffmpeg binary, then people could select it based on their needs :

In that case, let the developer pick their own ffmpeg library. I have updated the example to include how to use manual export, but this still needs to be mentioned in the documentation.