C++实战手把手教您用ffmpeg和QT开发播放器实战--03FFmpeg编译和开发环境准备

1. windows下ffmpeg库下载安装方法和库文件说明

网站:ffmpeg.club

 

官网下载:ffmpeg.org

下载shared  和 dev

ffmpeg-4.2.1-dev有头文件 和 lib

ffmpeg-4.2.1-sharedbin

 

2.VS2015配置32位和64位通用的ffmpeg

 

#include <iostream>
using namespace std;
extern "C"
{
  #include <libavcodec/avcodec.h>
}

int main(int argc, char*argv[]) 
{
	//显示ffmpeg的编译配置
#ifdef _WIN32
	cout << "Test x86 and win 32 " << endl;
	cout << avcodec_configuration() << endl;
#endif
#ifdef WIN32
	cout << "Test win 32 " << endl;
	cout << avcodec_configuration() << endl;
#endif
#ifdef _WIN64
	cout << "Test win 64 " << endl;
	cout << avcodec_configuration() << endl;
#endif
	getchar();						
	return 0;
}

3.QtCreator配置32位和64位windows通用

TEMPLATE = app
CONFIG += console c++11
SOURCES += main.cpp

INCLUDEPATH += $$PWD/../../include


#区分32位和64位windows程序
opt = $$find(QMAKESPEC,"msvc2015_64")
isEmpty(opt){
message("win32 lib")
LIBS += -L$$PWD/../../lib/win32
}
!isEmpty(opt){
message("win64 lib")
LIBS += -L$$PWD/../../lib/win64
}

#message($$QMAKESPEC)

#include <iostream>
using namespace std;
//要引用c语言函数
extern "C"{
	#include <libavcodec/avcodec.h>
}
//预处理指令导入库
#pragma comment(lib,"avcodec.lib")
int main(int argc,char *argv[])
{
	//显示ffmpeg的编译配置
	cout << "Test FFmpeg.club" << endl;
#ifdef _WIN32 //32位和64位 win
    #ifdef _WIN64 //64位 win
        cout << "Windows X64" << endl;
    #else
        cout << "Windows X86" << endl;
    #endif
#else
	cout << "Linux" << endl;
#endif
	cout << avcodec_configuration() << endl;
	getchar();
	return 0;
}

4. 项目移植到ubuntu中并配置跨平台的pro文件

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值