当前位置:网站首页>Win10 compiles the x264 library (there are also generated lib files)
Win10 compiles the x264 library (there are also generated lib files)
2022-08-09 13:02:00 【Know 12】
FFmpeg自带H.264解码器,But did not bring their ownH.264编码器,所以就要用到x264库了
一、x264是什么?
x264是一个开源的H.264/MPEG-4 AVC视频编码函数库,Coding is possible through this libraryh264视频
二、配置过程
1.下载
msys官网:https://www.msys2.org/
After downloading, install it all the way
2.Configure the tools required for compilation
- 更换国内源
对\etc\pacman.d里的三个mirrorlist文件,Add them to the front of the official mirror respectively
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//It will restart after the first input,to change the source
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
,If there is no error, it means it is fine
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
produces what we wantlib文件(做好的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;
}
成功!!!
边栏推荐
猜你喜欢
shell脚本------函数的格式,传参,变量,递归,数组
JD.com architects tidy up: what are the core technical knowledge points of jvm and performance tuning
水能自发变成“消毒水”,83岁斯坦福教授:揭示冬天容易得流感的部分原因...
非科班AI小哥火了:他没有ML学位,却拿到DeepMind的offer
Senior told me that the giant MySQL is through SSH connection
LeetCode热题(11.合并两个有序链表)
信息系统项目管理师必背核心考点(六十三)项目组合管理的主要过程&DIPP分析
研发需求的验收标准应该怎么写? | 敏捷实践
proto3-2 syntax
专业人士使用的 11 种渗透测试工具
随机推荐
二重指针-char **、int **的作用
微信支付开发流程
获取url地址中问号后参数(即使是iframe也可以)
proto3-2 syntax
Semaphore SIGCHLD use, how to make the parent that the child performs over, how to make the distinction between multiple child processes. The end
LeetCode热题(11.合并两个有序链表)
【Untitled】
JS封装防抖(代码持续优化)
专业人士使用的 11 种渗透测试工具
又有大厂员工连续加班倒下/ 百度搜狗取消快照/ 马斯克生父不为他骄傲...今日更多新鲜事在此...
PM2之配置文件
湖南进芯电子替代TIC2000的可能性
GET请求和POST请求区别
结构体变量的首地址获取注意事项
香港服务器如何进行加密?
Blocking, non-blocking, multiplexing, synchronous, asynchronous, BIO, NIO, AIO all in one pot
索引index
redis库没法引入
读写分离后,性能居然提升100%了呀
【小程序】低代码+小游戏=小游戏可视化开发