当前位置:网站首页>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;
}
成功!!!
边栏推荐
- 索引index
- 张朝阳对话俞敏洪:一边是手推物理公式,一边是古诗信手拈来
- 两分钟录音就可秒变语言通!火山语音音色复刻技术如何修炼而成?
- 修改VOT2018.json文件,去掉图片路径中的color
- CANopen DS402名词
- Information system project managers must memorize the core test sites (63) The main process of project portfolio management & DIPP analysis
- web course design
- 【Untitled】
- 在北京参加UI设计培训到底怎么样?
- Programmer's Exclusive Romance - Use 3D Engine to Realize Fireworks in 5 Minutes
猜你喜欢
Batch大小不一定是2的n次幂!ML资深学者最新结论
C# async 和 await 理解
JD.com architects tidy up: what are the core technical knowledge points of jvm and performance tuning
在北京参加UI设计培训到底怎么样?
太卷了... 腾讯一面被问到内存满了,会发生什么?
已解决IndentationError: unindent does not match any oute r indentation Level
proto3-2 syntax
Reading and writing after separation, performance were up 100%
The redis library cannot be imported
问题来了:4GB物理内存的机器上申请8G内存能成功吗?
随机推荐
水能自发变成“消毒水”,83岁斯坦福教授:揭示冬天容易得流感的部分原因...
微信支付开发流程
Common gadgets of Shell (sort, uniq, tr, cut)
【面试高频题】可逐步优化的链表高频题
ThreadLocal的简单理解
太卷了... 腾讯一面被问到内存满了,会发生什么?
香港服务器如何进行加密?
Django 无法链接mysql数据库
HAproxy:负载均衡
WPF 实现带蒙版的 MessageBox 消息提示框
发明时代,「幂集创新」事关你我
Reading and writing after separation, performance were up 100%
阿里云新增三大高性能计算解决方案,助力生命科学行业快速发展
AQS同步组件-FutureTask解析和用例
GPT-3组合DALL·E,60秒内搞定游戏设定和原型动画!网友看后:这游戏想玩
GRPC整体学习
基于STM32+铂电阻设计的测温仪
proto3-2 syntax
Gumbel_Softmax 概要
国产抗新冠口服药每瓶不超300元/ 我国IPv6网络全面建成/ 谷歌入局折叠屏手机...今日更多新鲜事在此...