当前位置:网站首页>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;
}

成功!!!
边栏推荐
猜你喜欢

Common gadgets of Shell (sort, uniq, tr, cut)

mysql + redis + flask + flask-sqlalchemy + flask-session 配置及项目打包移植部署

"Digital Economy Panorama White Paper" Special Analysis of Banking Industry Intelligent Marketing Application Released

【小程序】低代码+小游戏=小游戏可视化开发

报告:想学AI的学生数量已涨200%,老师都不够用了

两分钟录音就可秒变语言通!火山语音音色复刻技术如何修炼而成?

腾讯欲成育碧最大股东/ 米哈游招NLP内容生成研究员/ AI发现四千余物种濒临灭绝...今日更多新鲜事在此...

软件测试——金融测试类面试题,看完直接去面试了

专业人士使用的 11 种渗透测试工具

拍频造成的轻微震荡
随机推荐
Fapi_StatusType Fapi_issueProgrammingCommand使用注意事项
内网穿透工具ngrok使用教程
The redis library cannot be imported
TIC2000调用API函数Flash擦除片上FLASH失败
Two ways to enter the Oracle database
The latest interview summary in 20022 brought by Ali senior engineer is too fragrant
Senior told me that the giant MySQL is through SSH connection
Blazor Server (9) from scratch -- modify Layout
预置第三方apk到MTK项目相关问题总结
API调用,API传参,面向对接开发,你真的会写接口文档吗?
00后写个暑假作业,被监控成这笔样
shell脚本------函数的格式,传参,变量,递归,数组
HAproxy: load balancing
网页控制台控制编辑框
全面了解什么是TPS、QPS以及两者的区别
专业人士使用的 11 种渗透测试工具
PM2 configuration file
proto3-2语法
Information system project managers must memorize the core test sites (63) The main process of project portfolio management & DIPP analysis
程序员的专属浪漫——用3D Engine 5分钟实现烟花绽放效果