当前位置:网站首页>Qt+FFmpeg环境搭建
Qt+FFmpeg环境搭建
2022-07-28 20:50:00 【路过的小熊~】
下载FFmpeg库
FFmpeg库可以使用源码编译也可以从网上下载已经编译好的库文件,这里使用从网上下载编译好的库文件。
1.从网站:https://ffmpeg.zeranoe.com/builds/ 下载编译好的FFmpeg库。我选择下载64位的库。
2.编好的库地址下载https://github.com/BtbN/FFmpeg-Builds/releases
Static,Share,Dev三个都下载,下载好的三个文件分别为:
下载已编译好的ffmpeg库
添加FFmpeg库到Qt项目
使用QtCreator创建一个Qt gui项目,创建完项目后:
在项目根目录下创建ffmpeg文件夹,在ffmpeg文件夹中创建include和lib文件夹
- 解压ffmpeg-3.4-win64-dev.zip压缩文件
- 将解压后ffmpeg-3.4-win64-dev文件夹下include目录中所有头文件拷贝到新建的ffmpeg目录下的include文件夹中
- 将解压后ffmpeg-3.4-win64-dev文件夹下lib目录中的所有dll.a结尾的文件拷贝到ffmpeg的lib文件夹中
- 将解压后ffmpeg-3.4-win64-shared文件夹下bin目录中的所有dll结尾的文件拷贝到ffmpeg的bin文件夹中


修改项目pro文件,在pro文件中增加如下内容:
INCLUDEPATH += ../ffmpeg/include
LIBS += -L../ffmpeg/lib \
-lavcodec \
-lavfilter \
-lavformat \
-lavutil \
-lswscale
LIBS += -L../ffmpeg/bin \
-lavcodec \
-lavfilter \
-lavformat \
-lavutil \
-lswscale
测试FFmpeg库是否能正常使用
- 在项目中FFmpegLibTestFrm.cpp文件中添加FFmpeg头文件
extern "C"
{
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libswscale/swscale.h>
#include <libavdevice/avdevice.h>
#include <libavformat/version.h>
#include <libavutil/time.h>
#include <libavutil/mathematics.h>
}
- 在FFmpegLibTestFrm构造函数中增加如下代码
FFmpegLibTestFrm::FFmpegLibTestFrm(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::FFmpegLibTestFrm)
{
ui->setupUi(this);
qDebug("------------------------------------------------------------------");
qDebug("%s", avcodec_configuration());
qDebug("version: %d", avcodec_version());
qDebug("------------------------------------------------------------------");
}
- 编译运行程序,编译成功

效果如下

边栏推荐
- gprs网络指的是什么
- TensorFlow Serving 高性能的机器学习模型服务系统
- Why doesn't the icon on the elment plus icon input display
- Wechat applet uses canvas drawing, round avatar, network background, text, dotted line, straight line
- lotus 1.16.0 延长扇区过期时间
- Ruiji takeout - background login function development
- PaddleNLP基于ERNIR3.0文本分类:WOS数据集为例(层次分类)
- Win11怎么打开软件通知
- HCIP(12)
- 网易云信 2022Q2 产品补给站,快来获取你的产品补给计划吧!
猜你喜欢

CMD common commands
![[Ruiji takeout project]day4 - dish management](/img/2a/2d9deb7a583aa37b38a67ef2c74ee7.png)
[Ruiji takeout project]day4 - dish management

The blueprint of flask complements openpyxl

HCIP(12)

MySQL built-in functions

Hcip experiment (14)

Changes in the history of oscilloscope development
Integrating database Ecology: using eventbridge to build CDC applications

Att & CK Threat Intelligence

LVS+KeepAlived高可用部署实战应用
随机推荐
Sword finger offer II 054. Sum of all values greater than or equal to nodes (medium binary search tree DFS)
微信小程序剪切图片的功能
For loops and functions
Hcip experiment (15)
Leetcode integer exercises integer inversion
Ultra detailed visual studio 2019 running littlevgl (lvgl) simulator
Soft exam network engineer
微信小程序里button点击的时候会边框有黑线
Sword finger offer II 064. magic Dictionary (medium dictionary tree string design)
Winserver operation and maintenance technology stack
Ngrok intranet penetration
imx6q gpio复用
SQL injection less38 (Stack Injection)
ssh 免密码登录
LeetCode刷题系列之-多数之和类型
2021 mathematical modeling group B exercise
Leetcode question brushing series - sum of majority type
SQL injection less42 (post stack injection)
[Ruiji takeout] day05 package management business development
log4j漏洞 elk平台 处理方法 (logstah5.5.1)