• Windows 下 ffmpeg 的安装和测试


    ffmpeg 安装

    安装 vcpkg

    git clone https://github.com/microsoft/vcpkg
    .vcpkgootstrap-vcpkg.bat
    

    安装 ffmpeg

    vcpkg install ffmpeg
    

    安装之后可以查看下:

    PS D:3rdvcpkg-master> ./vcpkg list
    ffmpeg:x64-windows                                 4.3.2#2          a library to decode, encode, transcode, mux, dem...
    ffmpeg:x86-windows                                 4.3.2#2          a library to decode, encode, transcode, mux, dem...
    ffmpeg[avcodec]:x64-windows                                         Build the avcodec library
    ffmpeg[avcodec]:x86-windows                                         Build the avcodec library
    ffmpeg[avdevice]:x64-windows                                        Build the avdevice library
    ffmpeg[avdevice]:x86-windows                                        Build the avdevice library
    ffmpeg[avfilter]:x64-windows                                        Build the avfilter library
    ffmpeg[avfilter]:x86-windows                                        Build the avfilter library
    ffmpeg[avformat]:x64-windows                                        Build the avformat library
    ffmpeg[avformat]:x86-windows                                        Build the avformat library
    ffmpeg[avresample]:x64-windows                                      Build the avresample library
    ffmpeg[avresample]:x86-windows                                      Build the avresample library
    ffmpeg[gpl]:x64-windows                                             Allow use of GPL code, the resulting libs and bi...
    ffmpeg[gpl]:x86-windows                                             Allow use of GPL code, the resulting libs and bi...
    ffmpeg[postproc]:x64-windows                                        Build the postproc library
    ffmpeg[postproc]:x86-windows                                        Build the postproc library
    ffmpeg[swresample]:x64-windows                                      Build the swresample library
    ffmpeg[swresample]:x86-windows                                      Build the swresample library
    ffmpeg[swscale]:x64-windows                                         Build the swscale library
    ffmpeg[swscale]:x86-windows                                         Build the swscale library
    

    安装 ffmpeg 可执行文件

    测试:

    PS D:ffmpegin> .ffmpeg.exe --version
    ffmpeg version N-101994-g84ac1440b2 Copyright (c) 2000-2021 the FFmpeg developers
      built with gcc 9.3-win32 (GCC) 20200320
      configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-version3 --disable-debug --disable-w32threads --enable-pthreads --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --enable-libvmaf --enable-vulkan --enable-amf --enable-libaom --enable-avisynth --enable-libdav1d --enable-libdavs2 --enable-ffnvcodec --enable-cuda-llvm --enable-libglslang --enable-libgme --enable-libass --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libmfx --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --enable-libvidstab --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-libs=-lgomp
      libavutil      56. 73.100 / 56. 73.100
      libavcodec     58.136.101 / 58.136.101
      libavformat    58. 78.100 / 58. 78.100
      libavdevice    58. 14.100 / 58. 14.100
      libavfilter     7.111.100 /  7.111.100
      libswscale      5. 10.100 /  5. 10.100
      libswresample   3. 10.100 /  3. 10.100
      libpostproc    55. 10.100 / 55. 10.100
    

    ffmpeg visual studio 工程测试

    打开属性管理器

    这里以Debug Win32 为例进行配置:

    avcodec.lib
    avdevice.lib
    avfilter.lib
    avformat.lib
    avresample.lib
    avutil.lib
    postproc.lib
    swresample.lib
    swscale.lib
    

    写个程序测试下:

    #include "stdafx.h"
    #include <iostream>
    
    using namespace std;
    
    extern "C"
    {
    #include "libavcodec/avcodec.h"
    #include "libavformat/avformat.h"
    #include "libswscale/swscale.h"
    #include "libavdevice/avdevice.h"
    }
    
    int main()
    {
    	av_register_all();
    	unsigned int version = avcodec_version();
    	cout << "FFmpeg version is:" << version << endl;
    	return 0;
    }
    

    编译报错:

    'av_register_all': 被声明为已否决
    

    修改属性:

    编译输出:

    FFmpeg version is:3824484
    
  • 相关阅读:
    html部分常用内容
    Django media相关配置
    【设计模式】-单例模式
    SharePoint 修改完或制作完一定要发布
    SharePoint 创建模版页
    kindeditor 不能编辑 问题
    1
    SharePoint 第一个网站
    数据结构第一章
    未能加载文件或程序集“MICROSOFT.REPORTVIEWER.WEBFORMS …
  • 原文地址:https://www.cnblogs.com/xiaojianliu/p/14682601.html
Copyright © 2020-2023  润新知