当前位置:网站首页>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("------------------------------------------------------------------");
}
- 编译运行程序,编译成功

效果如下

边栏推荐
- [binary tree] pseudo palindrome path in binary tree
- What does GPRS network mean
- flask之蓝图 补充openpyxl
- Netease Yunxin 2022q2 product supply station, come and get your product supply plan!
- 近期bug总结
- [CVPR 2021] cylinder3d: cylindrical asymmetric 3D convolution network for LIDAR point cloud segmentation
- log4j漏洞 elk平台 处理方法 (logstah5.5.1)
- Win11 how to open software notification
- Sword finger offer II 054. Sum of all values greater than or equal to nodes (medium binary search tree DFS)
- Awk blank line filtering
猜你喜欢

示波器发展史中的变化

静态成员static详解

If you want to grow rapidly, you must first experience a major blow!
![[CS231N]Lecture_ 2:Image Classification pipelin](/img/4f/de56b071560ada746c587a9dbc5f02.jpg)
[CS231N]Lecture_ 2:Image Classification pipelin

Solve Jupiter: the term 'Jupiter' is not recognized as the name of a cmdlet, function, script file

CDN working principle
![[LiteratureReview]Object Detection and Mapping with Bounding Box Constraints](/img/37/7cb5fa3a9078a5f5947485147c819d.png)
[LiteratureReview]Object Detection and Mapping with Bounding Box Constraints

SQL注入 Less38(堆叠注入)

imx6q gpio复用

Paddlenlp text classification based on ernir3.0: take wos dataset as an example (hierarchical classification)
随机推荐
Ngx+sql environment offline installation log (RPM installation)
MySQL command (add, delete, check and modify)
[Ruiji takeout project]day4 - dish management
Summary of common error types in JS
PaddleNLP基于ERNIR3.0文本分类以CAIL2018-SMALL数据集罪名预测任务为例【多标签】
Leetcode question brushing series - sum of majority type
Hcip experiment (15)
Win11怎么打开软件通知
静态成员static详解
The function of wechat applet to cut pictures
winServer运维技术栈
98. Verify binary search tree (medium binary search tree DFS)
微信小程序使用canvas绘图,圆形头像,网络背景图,文字,虚线,直线
gprs网络指的是什么
普源示波器实际的使用效果怎么样
静态路由和缺省路由实验
Paddlenlp text classification based on ernir3.0: take wos dataset as an example (hierarchical classification)
imx6q gpio复用
Establishment of Ruiji takeout development environment
ATT&CK 威胁情报