windows10-msys2-msvc编译ffmpeg4.4.2
2022/8/25 5:22:58
本文主要是介绍windows10-msys2-msvc编译ffmpeg4.4.2,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
- 下载msys2
在msys2安装目录下创建文件
msys2_ffmpeg.bat
call "D:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" set MSYS2_PATH_TYPE=inherit msys2_shell.cmd
测试
echo $LIB
- 准备环境
双击运行 msys2_ffmpeg.bat
pacman -S diffutils make pkg-config yasm nasm
说明
pacman -S nasm #汇编工具,安装 pacman -S yasm #汇编工具,安装 pacman -S make #项目编译工具,必须安装 pacman -S diffutils #比较工具,ffmpeg configure 生成makefile时会用到,若不安装会警告,最好是安装 pacman -S pkg-config #库配置工具,编译支持x264和x265用到 pacman -S base-devel # 安装基本开发组件 pacman -S binutils #包含ld等命令 pacman -S automake
- 下载ffmpeg
wget https://ffmpeg.org/releases/ffmpeg-4.4.2.tar.xz 手动解压
- 编译
./configure \ --prefix=../ffmepg-4.4-win64-msvc \ --enable-static \ --enable-gpl \ --enable-version3 \ --enable-nonfree \ --enable-shared \ --disable-doc \ --disable-pthreads \ --enable-w32threads \ --enable-ffmpeg \ --toolchain=msvc \ --arch=x86_64 make -j8 make install
- 使用
#include <stdio.h> extern "C" { #include "libavcodec/avcodec.h" #include "libavformat/avformat.h" #include "libavfilter/buffersink.h" #include "libavfilter/buffersrc.h" #include "libavutil/opt.h" #include "libavfilter/avfilter.h" } #pragma comment(lib, "libavcodec.a") #pragma comment(lib, "libavdevice.a") #pragma comment(lib, "libavfilter.a") #pragma comment(lib, "libavformat.a") #pragma comment(lib, "libavutil.a") #pragma comment(lib, "libswresample.a") #pragma comment(lib, "libswscale.a") #pragma comment(lib, "libpostproc.a") #pragma comment(lib, "ws2_32.lib") #pragma comment(lib, "Mfuuid.lib") #pragma comment(lib, "Strmiids.lib") #pragma comment(lib, "Mfplat.lib") #pragma comment(lib, "Bcrypt.lib") #pragma comment(lib, "Secur32.lib") int main() { char filepath[] = "input.mkv"; AVFormatContext* pFormatCtx = avformat_alloc_context(); av_log_set_level(AV_LOG_DEBUG); if (avformat_open_input(&pFormatCtx, filepath, NULL, NULL) != 0) { printf("Couldn't open input stream.\n"); return -1; } else { printf("open success"); } avformat_close_input(&pFormatCtx); return 0; }
参考:
window10_ffmpeg-msys2-msvc编译 - 弦外之音
Windows MSVC2019 MSYS2编译ffmpeg_xuexixhp的技术博客_51CTO博客
这篇关于windows10-msys2-msvc编译ffmpeg4.4.2的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-04-26高性能表格工具VTable总体构成-icode9专业技术文章分享
- 2024-04-16软路由代理问题, tg 无法代理问题-icode9专业技术文章分享
- 2024-04-16程序猿用什么锅-icode9专业技术文章分享
- 2024-04-16自建 NAS 的方案-icode9专业技术文章分享
- 2024-04-14ansible 在远程主机上执行脚本,并传入参数-icode9专业技术文章分享
- 2024-04-14ansible 在远程主机上执行脚本,并传入参数, 加上remote_src: yes 配置-icode9专业技术文章分享
- 2024-04-14ansible 检测远程主机的8080端口,如果关闭,则echo 进程已关闭-icode9专业技术文章分享
- 2024-04-14result 成功怎么写-icode9专业技术文章分享
- 2024-04-14stopped 状态设置为变量,由外部传递进来-icode9专业技术文章分享
- 2024-04-14为什么ansible执行远程脚本需要放到后台-icode9专业技术文章分享