当前位置:网站首页>win10编译x264库(也有生成好的lib文件)
win10编译x264库(也有生成好的lib文件)
2022-08-09 11:58:00 【略知12】
FFmpeg自带H.264解码器,可是没有自带H.264编码器,所以就要用到x264库了
一、x264是什么?
x264是一个开源的H.264/MPEG-4 AVC视频编码函数库,通过这个库可以编码h264视频
二、配置过程
1.下载
msys官网:https://www.msys2.org/
下好之后一路安装
2.配置编译所需的工具
- 更换国内源
对\etc\pacman.d里的三个mirrorlist文件,分别添加到官方镜像前面
mirrorlist.mingw32:
Server = http://mirrors.ustc.edu.cn/msys2/mingw/i686/
mirrorlist.mingw64:
Server = http://mirrors.ustc.edu.cn/msys2/mingw/x86_64/
mirrorlist.mingw:
Server = http://mirrors.ustc.edu.cn/msys2/msys/$arch/
- 更新软件库
pacman -Syu//第一次输入后会重启,要再换一下源
pacman -Su
pacman -S mingw-w64-i686-gcc
pacman -S mingw-w64-x86_64-gcc
pacman -S base-devel
pacman -S nasm
pacman -S yasm
- 检查:
打开MSYS2 64bit,执行gcc -v
,没出错就说明安好了
3.配置x264
- 下载x264源码包,地址:https://www.videolan.org/developers/x264.html
- 下载后放到msys64\home下
- 打开MSYS2 MinGW 64-bit,执行
./configure --prefix=../build --host=x86_64-w64-mingw32 --enable-shared --extra-ldflags=-Wl,--output-def=libx264.def
会生成一个def文件 - 将x264.dll也放在vs/vc的bin下,如我的目录就是C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64下,cmd命令:
lib /machine:x64 /def:libx264.def
就生成了我们要的lib文件(做好的x264-155.dll、.def、.lib
链接:https://pan.baidu.com/s/1mcNkEXjOJUZs9LcI5YKT7w
提取码:w1js)
4.测试
- 在工程里添加x264.h、x264_config.h、libx264.dll和libx264.lib
- 在项目->属性->链接器->输入->输入->附加依赖库->添加libx264.lib
- 测试代码如下:
#include <iostream>
#include <string>
#include "stdint.h"
extern "C"
{
#include "x264.h"
#include "x264_config.h"
};
using namespace std;
int main(int argc, char **argv)
{
x264_param_t param;
x264_param_default(¶m);
cout << "hello,x264" << endl;
return 0;
}
成功!!!
边栏推荐
猜你喜欢
IDEA close/open reference prompt Usages
ABAP 报表中如何以二进制方式上传本地文件试读版
放下手机吧:实验表明花20分钟思考和上网冲浪同样快乐
The latest interview summary in 20022 brought by Ali senior engineer is too fragrant
HAproxy:负载均衡
鹅厂机器狗花式穿越10m梅花桩:前空翻、单桩跳、起身作揖...全程不打一个趔趄...
超越CLIP的多模态模型,只需不到1%的训练数据!南加大最新研究来了
又有大厂员工连续加班倒下/ 百度搜狗取消快照/ 马斯克生父不为他骄傲...今日更多新鲜事在此...
C# async 和 await 理解
Here comes the question: Can I successfully apply for 8G memory on a machine with 4GB physical memory?
随机推荐
The latest interview summary in 20022 brought by Ali senior engineer is too fragrant
【面试高频题】可逐步优化的链表高频题
二重指针-char **、int **的作用
腾讯欲成育碧最大股东/ 米哈游招NLP内容生成研究员/ AI发现四千余物种濒临灭绝...今日更多新鲜事在此...
CANopen DS402名词
"Digital Economy Panorama White Paper" Special Analysis of Banking Industry Intelligent Marketing Application Released
专业人士使用的 11 种渗透测试工具
Semaphore SIGCHLD use, how to make the parent that the child performs over, how to make the distinction between multiple child processes. The end
国产抗新冠口服药每瓶不超300元/ 我国IPv6网络全面建成/ 谷歌入局折叠屏手机...今日更多新鲜事在此...
全面了解什么是TPS、QPS以及两者的区别
AQS同步组件-FutureTask解析和用例
索引index
MySQL查询性能优化七种武器之索引潜水
900页数学论文证明旋转的黑洞不会爆炸,丘成桐:30多年来广义相对论首次重大突破...
阻塞、非阻塞、多路复用、同步、异步、BIO、NIO、AIO 一锅端
正则表达式(规则,匹配,和实际使用)
《数字经济全景白皮书》银行业智能营销应用专题分析 发布
Django 无法链接mysql数据库
世界第4疯狂的科学家,在103岁生日那天去世了
微信支付开发流程