pyav 是如何调用 FFmpeg libraries 的?
我知道,python 脚本可以调用 c 的 .so 文件
有一个包:pyav,用于处理音视频的包
PyAV is a Pythonic binding for the FFmpeg libraries. We aim to provide all of the power and control of the underlying library, but manage the gritty details as much as possible.
根据 README.md 的说明,使用了 FFmpeg libraries
但是,我搜索 ~/.local/share/virtualenvs/svddb_testing-LBS8tSMB/lib/python3.10/site-packages
路径下的 so 文件,没有带 FFmpeg 字样的 so 文件
─➤ fd -u -e .so 1 ↵PIL/_imaging.cpython-310-darwin.so
PIL/_imagingcms.cpython-310-darwin.so
PIL/_imagingft.cpython-310-darwin.so
PIL/_imagingmath.cpython-310-darwin.so
PIL/_imagingmorph.cpython-310-darwin.so
PIL/_imagingtk.cpython-310-darwin.so
PIL/_webp.cpython-310-darwin.so
_cffi_backend.cpython-310-darwin.so
av/_core.cpython-310-darwin.so
av/audio/codeccontext.cpython-310-darwin.so
av/audio/fifo.cpython-310-darwin.so
av/audio/format.cpython-310-darwin.so
av/audio/frame.cpython-310-darwin.so
av/audio/layout.cpython-310-darwin.so
av/audio/plane.cpython-310-darwin.so
av/audio/resampler.cpython-310-darwin.so
av/audio/stream.cpython-310-darwin.so
av/buffer.cpython-310-darwin.so
av/bytesource.cpython-310-darwin.so
av/codec/codec.cpython-310-darwin.so
av/codec/context.cpython-310-darwin.so
av/container/core.cpython-310-darwin.so
av/container/input.cpython-310-darwin.so
av/container/output.cpython-310-darwin.so
av/container/pyio.cpython-310-darwin.so
av/container/streams.cpython-310-darwin.so
av/data/stream.cpython-310-darwin.so
av/descriptor.cpython-310-darwin.so
av/dictionary.cpython-310-darwin.so
av/enum.cpython-310-darwin.so
av/error.cpython-310-darwin.so
av/filter/context.cpython-310-darwin.so
av/filter/filter.cpython-310-darwin.so
av/filter/graph.cpython-310-darwin.so
av/filter/link.cpython-310-darwin.so
av/filter/pad.cpython-310-darwin.so
av/format.cpython-310-darwin.so
av/frame.cpython-310-darwin.so
av/logging.cpython-310-darwin.so
av/option.cpython-310-darwin.so
av/packet.cpython-310-darwin.so
av/plane.cpython-310-darwin.so
av/sidedata/motionvectors.cpython-310-darwin.so
av/sidedata/sidedata.cpython-310-darwin.so
av/stream.cpython-310-darwin.so
av/subtitles/codeccontext.cpython-310-darwin.so
av/subtitles/stream.cpython-310-darwin.so
av/subtitles/subtitle.cpython-310-darwin.so
av/utils.cpython-310-darwin.so
av/video/codeccontext.cpython-310-darwin.so
av/video/format.cpython-310-darwin.so
av/video/frame.cpython-310-darwin.so
av/video/plane.cpython-310-darwin.so
av/video/reformatter.cpython-310-darwin.so
av/video/stream.cpython-310-darwin.so
charset_normalizer/md.cpython-310-darwin.so
charset_normalizer/md__mypyc.cpython-310-darwin.so
cryptography/hazmat/bindings/_openssl.abi3.so
cryptography/hazmat/bindings/_rust.abi3.so
cv2/cv2.abi3.so
numpy/core/_multiarray_tests.cpython-310-darwin.so
numpy/core/_multiarray_umath.cpython-310-darwin.so
numpy/core/_operand_flag_tests.cpython-310-darwin.so
numpy/core/_rational_tests.cpython-310-darwin.so
numpy/core/_simd.cpython-310-darwin.so
numpy/core/_struct_ufunc_tests.cpython-310-darwin.so
numpy/core/_umath_tests.cpython-310-darwin.so
numpy/fft/_pocketfft_internal.cpython-310-darwin.so
numpy/linalg/_umath_linalg.cpython-310-darwin.so
numpy/linalg/lapack_lite.cpython-310-darwin.so
numpy/random/_bounded_integers.cpython-310-darwin.so
numpy/random/_common.cpython-310-darwin.so
numpy/random/_generator.cpython-310-darwin.so
numpy/random/_mt19937.cpython-310-darwin.so
numpy/random/_pcg64.cpython-310-darwin.so
numpy/random/_philox.cpython-310-darwin.so
numpy/random/_sfc64.cpython-310-darwin.so
numpy/random/bit_generator.cpython-310-darwin.so
numpy/random/mtrand.cpython-310-darwin.so
psutil/_psutil_osx.abi3.so
psutil/_psutil_posix.abi3.so
pydantic/__init__.cpython-310-darwin.so
pydantic/_hypothesis_plugin.cpython-310-darwin.so
pydantic/annotated_types.cpython-310-darwin.so
pydantic/class_validators.cpython-310-darwin.so
pydantic/color.cpython-310-darwin.so
pydantic/config.cpython-310-darwin.so
pydantic/dataclasses.cpython-310-darwin.so
pydantic/datetime_parse.cpython-310-darwin.so
pydantic/decorator.cpython-310-darwin.so
pydantic/env_settings.cpython-310-darwin.so
pydantic/error_wrappers.cpython-310-darwin.so
pydantic/errors.cpython-310-darwin.so
pydantic/fields.cpython-310-darwin.so
pydantic/json.cpython-310-darwin.so
pydantic/main.cpython-310-darwin.so
pydantic/mypy.cpython-310-darwin.so
pydantic/networks.cpython-310-darwin.so
pydantic/parse.cpython-310-darwin.so
pydantic/schema.cpython-310-darwin.so
pydantic/tools.cpython-310-darwin.so
pydantic/types.cpython-310-darwin.so
pydantic/typing.cpython-310-darwin.so
pydantic/utils.cpython-310-darwin.so
pydantic/validators.cpython-310-darwin.so
pydantic/version.cpython-310-darwin.so
torch/_C.cpython-310-darwin.so
torch/_C_flatbuffer.cpython-310-darwin.so
torch/_dl.cpython-310-darwin.so
torchvision/_C.so
torchvision/image.so
yaml/_yaml.cpython-310-darwin.so
为什么呢?是因为 FFmpeg libraries 的 so 文件,不带 FFmpeg 字样?
我发现,我的电脑不装 FFmpeg 这个 app,pyav 也是可能正常工作的,所以这个 pyav 应该是不依赖 FFmpeg 这个 app,可能只是依赖 FFmpeg 的某个 so 文件?
回答:
在 ffmpeg 的文档里,可以看到 ffmpeg 的库是叫这些名字的:
Libraries Documentation
- libavutil
- libswscale
- libswresample
- libavcodec
- libavformat
- libavdevice
- libavfilter
在 mac 上,动态库还有一个扩展名是 .dylib 。
然后在 av 文件夹下跑一下 fd -H -e .dylib
,就可以看到:
.......dylibs/libavutil.57.28.100.dylib
......
等等动态库文件了。
以上是 pyav 是如何调用 FFmpeg libraries 的? 的全部内容, 来源链接: utcz.com/p/938737.html