rainyl / opencv_dart

OpenCV bindings for Dart language and Flutter. Support Asynchronous Now!
https://pub.dev/packages/opencv_dart
Apache License 2.0
127 stars 17 forks source link

Split `videoio` module to independent package and support FFMPEG for all platforms #254

Closed rainyl closed 2 weeks ago

rainyl commented 1 month ago

Personally, I think supporting FFMPEG for all platforms is necessary, since there are many issues about VideoWriter and VideoCapture.

Several principles:

Status & problems

I have worked on this for about 5 days and finish it successfully, but it is not elegant (so I published v1.2.5, originally I want this feature to be included in v1.2.5 😮‍💨).

Solutions

  1. split the entire package to several plugins (or federated plugins), e.g., opencv_core, opencv_imgproc, etc.
    • Pros:
      • allow users to avoid introducing unnecessary modules and reduce the package size.
      • can publish binaries to pub.dev and no need to download (maybe)
      • easy to maintain and avoid compile/publish the entire package
    • Cons:
      • much works to do and I have no much time, so may need a long time to finish
      • need to figure out the dependencies of different modules
      • other problems I haven't thought of.
  2. split the videoIO module, e.g., opencv_videoio, which depends on opencv_dart
    • Pros:
      • relatively easy to work on.
    • Cons:
      • not elegant
      • basically same as before, need to download binaries.
  3. keep the current package and provide an option to download binaries with ffmpeg included
    • Pros:
      • the best compatibility
    • Cons:
      • more binaries to be compiled and published

Personally I prefer option 1 now, what do you think? @abdelaziz-mahdy

abdelaziz-mahdy commented 1 month ago

I understand the benefits of splitting the modules, but that will cause confusion for people since open cv is one module in Python 😅

So bundling ffmpeg being optional will be awesome, also you can make a minimal ffmpeg version by removing codecs that are not used like media_kit does and fvp, which will make the bundle size small

Also due to you not having time I guess the fastest workaround for now is the way to go,and when you have time for the others it can look into the others.

rainyl commented 1 month ago

Yes you are right. Thanks ~