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

Enable web platform #146

Open
maRci002 opened this issue Apr 4, 2023 · 4 comments · May be fixed by #147
Open

Enable web platform #146

maRci002 opened this issue Apr 4, 2023 · 4 comments · May be fixed by #147
Labels
enhancement New feature or request

Comments

@maRci002
Copy link

maRci002 commented Apr 4, 2023

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
@kevinsun-dev
Copy link

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.

@LeGoffMael
Copy link
Owner

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 ?

@maRci002
Copy link
Author

maRci002 commented Apr 7, 2023

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.

@LeGoffMael LeGoffMael added the enhancement New feature or request label Apr 14, 2023
@LeGoffMael LeGoffMael changed the title Separating Video Export Functionality from the Video Editor Package Enable web platform Jun 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants
@maRci002 @kevinsun-dev @LeGoffMael and others