samsface / godot-native-example

Example Godot native project using cmake
MIT License
32 stars 11 forks source link

what is the best route for FFMPEG as a Godot plugin #1

Closed ShadowFungi closed 2 years ago

ShadowFungi commented 2 years ago

Hello, hope you're is going well, but I'd like some help

Details

How would I go about implementing the FFMPEG libraries (FFMPEG is a leading multimedia codec) as a Godot plugin and not as a module (as I feel it would be more cumbersome to maintain as a module). I know a decent amount of how to use FFMPEG in C++ if that's useful. Help and suggestions on how to do this would be greatly appreciated. If you need any more information I would be glad to provide it.

samsface commented 2 years ago

https://conan.io/center/ffmpeg conan has ffmpeg as a package for windows, linux & mac. You can make your project build and link it like this:

  1. Download ffmpeg as part of the cmakelists.txt .https://github.com/samsface/godot-native-example/blob/a4118fc8ac1f1582d3c3d2ee759c223abd3403f2/CMakeLists.txt#L30 Change the line to this conan_cmake_configure(REQUIRES godot-cpp/3.3@local/stable ffmpeg/4.4 GENERATORS cmake_find_package)

  2. Underneath where we find_package(godot-cpp), also add a find_package(ffmpeg) https://github.com/samsface/godot-native-example/blob/a4118fc8ac1f1582d3c3d2ee759c223abd3403f2/CMakeLists.txt#L36

  3. Then lastly link to ffmpeg, underneath were we link with godot-cpp::godot-cpp, add ffmpeg::ffmpeg https://github.com/samsface/godot-native-example/blob/a4118fc8ac1f1582d3c3d2ee759c223abd3403f2/CMakeLists.txt#L53

That should be it.