Skip to content

ffmpeg: added openvino support #21151

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

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions recipes/ffmpeg/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class FFMpegConan(ConanFile):
"with_freetype": [True, False],
"with_openjpeg": [True, False],
"with_openh264": [True, False],
"with_openvino": [True, False],
"with_opus": [True, False],
"with_vorbis": [True, False],
"with_zeromq": [True, False],
Expand Down Expand Up @@ -128,6 +129,7 @@ class FFMpegConan(ConanFile):
"with_freetype": True,
"with_openjpeg": True,
"with_openh264": True,
"with_openvino": True,
Copy link
Contributor

@SpaceIm SpaceIm Dec 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's a good idea to enable openvino in ffmpeg by default:

  • there are already too many dependencies enabled in ffmpeg recipe, and it will leak to other recipes like opencv.
  • openvino is a C++ library while ffmpeg is a C library
  • openvino recipe has too many common cases of ConanInvalidConfiguration (build_type=Debug, clang with libc++, only recent compilers while ffmpeg supports many compilers), it will leak to downstream recipes, not good.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it was done for testing purposes.
I agree that adding heavy dependency like OpenVINO should be done with False by default

"with_opus": True,
"with_vorbis": True,
"with_zeromq": False,
Expand Down Expand Up @@ -208,6 +210,7 @@ def _dependencies(self):
"with_libiconv": ["avcodec"],
"with_openjpeg": ["avcodec"],
"with_openh264": ["avcodec"],
"with_openvino": ["avfilter"],
"with_vorbis": ["avcodec"],
"with_opus": ["avcodec"],
"with_libx264": ["avcodec"],
Expand All @@ -232,6 +235,9 @@ def _version_supports_vulkan(self):
return Version(self.version) >= "4.3.0"

@property
def _version_supports_openvino(self):
return Version(self.version) >= "6.1.0"

def _version_supports_libsvtav1(self):
return Version(self.version) >= "5.1.0"

Expand Down Expand Up @@ -262,6 +268,8 @@ def config_options(self):
del self.options.with_avfoundation
if not self._version_supports_vulkan:
self.options.rm_safe("with_vulkan")
if not self._version_supports_openvino:
del self.options.with_openvino
if not self._version_supports_libsvtav1:
self.options.rm_safe("with_libsvtav1")
if not self._version_supports_libdav1d:
Expand All @@ -270,6 +278,8 @@ def config_options(self):
def configure(self):
if self.options.shared:
self.options.rm_safe("fPIC")
if not self.options.avfilter:
self.options.rm_safe("with_openvino")
self.settings.rm_safe("compiler.cppstd")
self.settings.rm_safe("compiler.libcxx")

Expand All @@ -291,6 +301,8 @@ def requirements(self):
self.requires("openjpeg/2.5.0")
if self.options.with_openh264:
self.requires("openh264/2.3.1")
if self.options.get_safe("with_openvino"):
self.requires("openvino/2023.2.0")
if self.options.with_vorbis:
self.requires("vorbis/1.3.7")
if self.options.with_opus:
Expand Down Expand Up @@ -521,6 +533,9 @@ def opt_append_disable_if_set(args, what, v):
"gpl", self.options.with_libx264 or self.options.with_libx265 or self.options.postproc)
]

if self._version_supports_openvino:
args.append(opt_enable_disable("libopenvino", self.options.get_safe("with_openvino")))

# Individual Component Options
opt_append_disable_if_set(args, "everything", self.options.disable_everything)
opt_append_disable_if_set(args, "encoders", self.options.disable_all_encoders)
Expand Down Expand Up @@ -1011,6 +1026,8 @@ def package_info(self):
"CoreImage")
if Version(self.version) >= "5.0" and is_apple_os(self):
self.cpp_info.components["avfilter"].frameworks.append("Metal")
if self.options.get_safe("with_openvino"):
self.cpp_info.components["avfilter"].requires.append("openvino::Runtime_C")

if self.options.get_safe("with_vaapi"):
self.cpp_info.components["avutil"].requires.extend(
Expand Down