Split `videoio` module to independent package and support FFMPEG for all platforms
Personally, I think supporting FFMPEG for all platforms is necessary, since there are many issues about VideoWriter and VideoCapture.
Several principles:
- uniform FFMPEG version (FFMPEG 6.1 is selected for now)
- better for same modules (opencv requires avutil, avcodec, avformat, swscale)
- minimal package size
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 😮💨).
- with custom compiled FFMPEG, opencv will link it via absolute path, leading to a difficult redistribution (solved by linking via target and a new
ffmpeg-config.cmake) - with current compile script, the entire library will depends on ffmpeg, for those who doesn't need FFMPEG, it will be unnecessary.
Solutions
- 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.
- Pros:
- 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.
- Pros:
- 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
- Pros:
Personally I prefer option 1 now, what do you think? @abdelaziz-mahdy
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.
Yes you are right. Thanks ~