Conan的安装与使用参考之前的文章:Conan简单使用
一、Conan编译ffmpeg
1.1 Conan的配置文件
创建配置文件:C:\Users\wujh\.conan2\profiles\vs2019
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=14
compiler.runtime=dynamic
compiler.version=192
os=Windows
解析说明:
| 设置项 | 值 | 说明 |
|---|---|---|
arch |
x86_64 |
目标架构为 64 位(x86_64)。 |
build_type |
Release |
构建类型为 Release(优化模式,非调试)。 |
compiler |
msvc |
使用 Microsoft Visual C++ 编译器。 |
compiler.cppstd |
14 |
C++ 标准版本为 C++14。 |
compiler.runtime |
dynamic |
使用动态运行时库(MD/MDd)。 |
compiler.version |
192 |
MSVC 编译器版本,对应 Visual Studio 2019(版本号 192.x)。 |
os |
Windows |
目标操作系统为 Windows。 |
1.2 在项目中创建conanfile.txt文件
查询库的版本:conancenter
conanfile.txt文件内容:
[requires]
ffmpeg/4.4.3
[options]
ffmpeg/*:shared=True
ffmpeg/*:with_libx264=True
ffmpeg/*:with_libx265=True
ffmpeg/*:with_libfdk_aac=True
ffmpeg/*:with_libmp3lame=True
ffmpeg/*:with_libvpx=False
ffmpeg/*:with_openjpeg=False
ffmpeg/*:with_openh264=False
ffmpeg/*:with_vorbis=False
ffmpeg/*:with_opus=False
ffmpeg/*:with_libwebp=False
ffmpeg/*:with_libaom=False
ffmpeg/*:with_ssl=False
[generators]
CMakeDeps
CMakeToolchain
[layout]
cmake_layout
说明:
- 在
requires节下,指定库和其版本号。 - 在
options节下,指定库的选项 - 在
generators节,指定生成器设置CMAkeDeps生成库的查找文件 Findxxx.cmakeCMakeToolchain配置工具链
- 在
layout节下,指定项目目录布局,cmake_layout标准的cmake项目目录结构
1.3 ffmpeg的Conan选项
| 分类 | Conan 选项 | 对应 ./configure 参数 |
说明 |
|---|---|---|---|
| FFmpeg 库 | ffmpeg/*:shared=True |
--enable-shared / --disable-shared |
编译动态库(True)或静态库(False) |
ffmpeg/*:avdevice=True |
--enable-avdevice / --disable-avdevice |
启用 FFmpeg 的设备处理模块 | |
ffmpeg/*:avcodec=True |
--enable-avcodec / --disable-avcodec |
启用 FFmpeg 的编解码模块 | |
ffmpeg/*:avformat=True |
--enable-avformat / --disable-avformat |
启用 FFmpeg 的封装/解封装模块 | |
ffmpeg/*:swresample=True |
--enable-swresample / --disable-swresample |
启用音频重采样模块 | |
ffmpeg/*:swscale=True |
--enable-swscale / --disable-swscale |
启用视频缩放和像素格式转换模块 | |
ffmpeg/*:postproc=True |
--enable-postproc / --disable-postproc |
启用视频后处理模块 | |
ffmpeg/*:avfilter=True |
--enable-avfilter / --disable-avfilter |
启用音视频过滤器模块 | |
| 视频编码 | ffmpeg/*:with_libx264=True |
--enable-libx264 / --disable-libx264 |
启用 H.264 编码支持(基于 libx264) |
Windows下Conan编译及VSCode使用FFmpeg

最低0.47元/天 解锁文章
333

被折叠的 条评论
为什么被折叠?



