Closed mm318 closed 5 years ago
I've thought about the runtime solution as well, and I agree with you.
My concern at the time was that the runtime solution will involve messy hardcoding (because FFmpeg doesn't expose any APIs for testing the availability of the h264_omx codec dependencies on the execution platform, see the static initialization function and hardcoded library names here https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/omx.c#L142). I was thinking we'd rather have hardcoding at the configure stage (in CMake) than in the source.
I'll implement the runtime solution anyway.
Issue #2
Description of changes:
On Ubuntu Bionic 18.04 x64, libavcodec.so's
avcodec_find_encoder_by_name()
indicates that the "h264_omx" codec is available, but the codec depends on libOMX_Core.so/libOMXCore.so, which are not available and means that the "h264_omx" codec simply does not work.The fix is to have CMake detect the presence of libOMX_Core.so/libOMXCore.so (or libopenmaxil.so and libbcm_host.so in the case of Raspberry Pi's, see https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/omx.c#L142) on the system to decide whether or not the hardware encoder should be used.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.