Ubuntu下mingw和aarch64交叉编译x264/x265/openssl/freetype2的ffmpeg

0、前记

在浏览gpac的github时发现编译gpac库教程,十分的强大,我之前常用的库都有编译脚本,照着做就行,中间会出现一些错误,我也记录了下,主要是版本更新和git clone timeout,稍作修改即可通过。github原地址:https://github.com/gpac/gpac我fork和修改后的地址:https://github.com/lishi0105-1/gpac/wiki/GPAC-Build-Guide-for-MSYS-MinGW

1、ffmpeg下载

前往ffmpeg官网下载地址下载需要的最新ffmpeg发布版本

2、ffmpeg编译选项说明

在ffmpeg官网中有对ffmpeg编译选项的部分说明内容如下:

--enable-libfreetype:启用Freetype支持。

--enable-gpl:允许使用 GPL 代码并允许支持后处理、swscale 和许多其他功能。

--enable-version3:允许使用 (L)GPL 版本 3 代码。

--enable-nonfree: 允许使用非自由代码。请注意,生成的库和二进制文件将不可再分发。

--disable-static:此开关可防止安装库的静态版本。

--enable-shared:启用构建共享库,否则仅构建和安装静态库。

--disable-debug:禁止将调试符号构建到程序和库中。

--enable-libass: 通过 启用 ASS/SSA 字幕格式渲染libass。

--enable-libdrm:如果安装了libdrm-2.4.114 ,请使用此开关 来构建 “ kmsgrab ”输入模块,该模块对屏幕捕获或流式传输很有用。

--enable-libfdk-aac: 通过 启用 AAC 音频编码libfdk-aac。

--enable-libmp3lame: 通过 启用 MP3 音频编码libmp3lame。

--enable-libvorbis --enable-libtheoralibvorbis: 通过和启用 Theora 视频编码 libtheora。

--enable-libvorbis --enable-libvpxlibvorbis: 通过和启用 WebM 编码libvpx。

--enable-libx264: 通过 启用高质量的 H.264/MPEG-4 AVC 编码libx264。

--enable-libx265:通过 启用高质量 H.265/HEVC 编码libx265。

--enable-openssl:为网络流启用 HTTPS 协议。

--enable-gnutls--enable-openssl:如果要使用 GnuTLS而不是OpenSSL用于 HTTPS 协议 ,请使用此选项而不是。

--disable-doc: 禁用构建 html 文档。这仅在安装了Doxygen-1.9.6 并且您不想构建 html 文档 时才需要。

--enable-libpulse:为音频输出 启用 Pulseaudio支持。

gcc tools/qt-faststart.c -o tools/qt-faststart:这构建了qt-faststart程序,它可以修改 QuickTime 格式的电影(.mov或.mp4),以便标题信息位于文件的开头而不是结尾。这允许电影文件在整个文件下载完成之前开始播放。

完整的编译选项需查看**./configure --help**,具体编译选项的选择看个人需要,我们在嵌入式平台下一般编解码使用嵌入式硬件,所以不需要附带libx264、libx265选项;对于需要其他编译选项的请参照ffmpeg在linux下编译这篇文章,需要编译安装第三方库。

编译完成之后安装内容说明如下:

#安装的程序:
#ffmpeg、ffplay、ffprobe 和 qt-faststart
#安装的库:
#libavcodec.so、libavdevice.so、libavfilter.so、libavformat.so、libavutil.so、libpostproc.so、libswresample.so 和 libswscale.so
#安装目录:
#/usr/include/libav{codec,device,filter,format,util}, /usr/include/libpostproc, /usr/include/libsw{resample,scale}, #/usr/share/doc/ffmpeg-5.1.2,和/usr/share/ffmpeg
#简短说明
#ffmpeg 是一个命令行工具,用于将视频文件、网络流和来自电视卡的输入转换为多种视频格式

#ffplay 是一个使用ffmpeg库和 SDL库的非常简单和便携的媒体播放器

#ffprobe 从多媒体流中收集信息并以人类和机器可读的方式打印出来

#qt-faststart 将索引文件移动到 quicktime (mov/mp4) 视频的前面

#libavcodec.so 包含FFmpeg编解码器(编码和解码) 的库

#libavdevice.so FFmpeg设备处理库

#libavfilter.so 过滤器库,可以在解码器和编码器(或输出)之间改变视频或音频

#libavformat.so 包含ffplay 使用的文件格式处理(多种格式的 mux 和 demux 代码)以及允许生成音频或视频流的 库

#libavresample.so 包含音频和视频重采样函数的库。

#libavutil.so FFmpeg实用程序库

#libpostproc.so FFmpeg后处理库

#libswresample.so FFmpeg音频缩放库,它包含转换音频采样格式的函数

#libswscale.so FFmpeg图像缩放库

3、ffmpeg编译和安装

在源码目录下创建install文件夹作为安装目录,我的交叉编译配置如下:

./configure \
        --prefix="$PWD/install" \
        --enable-shared \
        --enable-cross-compile \
        --target-os=linux \
        --arch=aarch64 \
        --cc=aarch64-none-linux-gnu-gcc \
        --cxx=aarch64-none-linux-gnu-g++ \
        --strip=aarch64-none-linux-gnu-strip \
        --enable-gpl \
        --extra-libs=-ldl \
        --extra-cflags="-fPIC" \
        --extra-ldflags=-Wl,-Bsymbolic \
        --extra-libs="-lpthread -lm"

配置完成后执行make -j8 & make install执行编译安装命令,在install下生成编译后的文件,这种配置生成的库非常大,于是做了裁剪,配置如下:

./configure \
	--prefix=$(pwd)/install --arch=aarch64 --target-os=linux --enable-cross-compile --disable-asm --enable-gpl \
	--cc=aarch64-none-linux-gnu-gcc \
	--cxx=aarch64-none-linux-gnu-g++ \
	--strip=aarch64-none-linux-gnu-strip \
	--disable-gpl --enable-nonfree --enable-error-resilience \
	--disable-debug --disable-shared --enable-small \
	--disable-ffmpeg --disable-ffprobe --disable-ffplay --disable-programs --disable-symver\
	--disable-doc --disable-htmlpages --disable-manpages --disable-podpages \
	--disable-txtpages --enable-avformat --enable-avcodec  --enable-swresample \
	--disable-avresample --disable-avfilter --disable-avdevice --disable-postproc \
	--disable-swscale --disable-everything --enable-decoder=h264 --enable-decoder=hevc \
	--enable-decoder=pcm_alaw --enable-decoder=aac  --enable-demuxer=aac --enable-demuxer=rtsp \
	--enable-demuxer=pcm_alaw --enable-demuxer=h264 --enable-demuxer=hevc \
	--enable-demuxer=m4v --enable-demuxer=avi --enable-demuxer=mov --enable-muxer=m4v --enable-muxer=rtsp \
	--enable-muxer=h264 --enable-muxer=hevc --enable-muxer=pcm_alaw \
	--enable-muxer=avi --enable-muxer=mov --enable-muxer=mp4  --enable-parser=h264 \
	--enable-parser=aac   --enable-parser=hevc --enable-protocol=file --disable-iconv \
	--disable-v4l2-m2m --disable-indevs --disable-outdevs

裁剪后静态库不到4MB,也满足我的需要。

4、ubuntu22.04下编译MinGw版本的ffmpeg

众所周知qt使用的有MinGw编译器,msvc版本的ffmpeg库很多人编译过,如果想使用MingW版本ffmpeg库需要自行编译,将编译过程做下记录

4.1 安装编译依赖

sudo apt install -y cmake nasm mingw-w64 mingw-w64-tools

4.2 编译安装第三方库

4.2.1 编译安装x264

git clone https://code.videolan.org/videolan/x264.git
cd x264
./configure --cross-prefix=x86_64-w64-mingw32- --host=mingw64 --disable-swscale --disable-lavf  --enable-pic --enable-static --prefix=$(pwd)/install
make -j8
make install

4.2.2 编译安装X265

git clone https://bitbucket.org/multicoreware/x265_git.git
mv x265_git x265
cd x265/build/
gedit build.cmake #在目录下新建一个build.cmake的文件

输入以下内容:

#!cmake

SET(CMAKE_SYSTEM_NAME Windows)

SET(cross_prefix x86_64-w64-mingw32-)

# specify the cross compiler
SET(CMAKE_C_COMPILER   ${cross_prefix}gcc)
SET(CMAKE_CXX_COMPILER ${cross_prefix}g++)
SET(CMAKE_RC_COMPILER  ${cross_prefix}windres)
SET(CMAKE_ASM_NASM_COMPILER nasm)

SET(CMAKE_CXX_FLAGS "-static-libgcc -static-libstdc++ -static -O3 -s")
SET(CMAKE_C_FLAGS "-static-libgcc -static-libstdc++ -static -O3 -s")
SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-static-libgcc -static-libstdc++ -static -O3 -s")
SET(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "-static-libgcc -static-libstdc++ -static -O3 -s")

再创建一个生成编译中间文件夹

mkdir mingw 

执行以下内容:

cmake -DCMAKE_TOOLCHAIN_FILE=../build.cmake -DCMAKE_INSTALL_PREFIX=$(pwd)/install -DENABLE_SHARED=0 -DENABLE_PIC=1 ../../source

执行脚本生成Makefile并编译安装

make -j8 && make install

4.2.3 编译zlib

前往zlib网站下载zlib-1.2.11.tar.gz,解压后进入目录,执行以下命令在同层目录下创建install并生成相关文件:

export CC=x86_64-w64-mingw32-gcc
./configure --prefix=$(pwd)/install --static
make -j8 && make install
export CC=""

4.2.4 编译libpng

前往libpng官网下载libpng-1.6.39.tar.gz,解压进入目录执行以下命令编译安装:

./configure --host=x86_64-w64-mingw32 --prefix=$PWD/install  LIBS=-L/home/user/work/ffmpeg_mingw/x64/zlib-1.2.11/install/lib CPPFLAGS=-I/home/user/work/ffmpeg_mingw/x64/zlib-1.2.11/install/include --disable-shared
make -j8 && make install

4.2.5 编译freetype2

执行以下命令配置之前编译的libpng和zlib

export PKG_CONFIG_PATH=/home/user/work/ffmpeg_mingw/x64/libpng-1.6.39/install/lib/pkgconfig:/home/user/work/ffmpeg_mingw/x64/zlib-1.2.11/install/lib/pkgconfig

再执行以下命令配置生成Makefile

./configure --host=x86_64-w64-mingw32 CC=x86_64-w64-mingw32-gcc --prefix=$PWD/install

最终结果如下:

Ubuntu下mingw和aarch64交叉编译x264/x265/openssl/freetype2的ffmpeg_第1张图片

显示配置libpng和zlib成功;

执行编译和安装命令make -j8 && make install ;

4.2.6 编译openssl

前往openssl官网下载openssl-1.1.1s.tar.gz解压进入目录(openssl3版本在随后ffmpeg检查时不匹配会报错),执行以下命令编译:

./Configure --prefix=$(pwd)/install  no-asm mingw no-shared --cross-compile-prefix=i686-w64-mingw32-  #32位编译
./Configure --prefix=$(pwd)/install  no-asm mingw64 no-shared --cross-compile-prefix=x86_64-w64-mingw32-  #64位编译
make -j8 && make install

4.3 编译ffmpeg

4.3.1 编译64位版本

解压下载的源码,进入源码路径,执行以下命令:

export PKG_CONFIG_PATH=""
export PKG_CONFIG_PATH=/home/user/work/ffmpeg_mingw/x64/libpng-1.6.39/install/lib/pkgconfig:$PKG_CONFIG_PATH
export PKG_CONFIG_PATH=/home/user/work/ffmpeg_mingw/x64/zlib-1.2.11/install/lib/pkgconfig:$PKG_CONFIG_PATH
export PKG_CONFIG_PATH=/home/user/work/ffmpeg_mingw/x64/openssl-3.0.7/install/lib64/pkgconfig:$PKG_CONFIG_PATH
export PKG_CONFIG_PATH=/home/user/work/ffmpeg_mingw/x64/freetype-2.12.0/install/lib/pkgconfig:$PKG_CONFIG_PATH
export PKG_CONFIG_PATH=/home/user/work/ffmpeg_mingw/x64/x265/build/mingw/install/lib/pkgconfig:$PKG_CONFIG_PATH
export PKG_CONFIG_PATH=/home/user/work/ffmpeg_mingw/x64/x264/install/lib/pkgconfig:$PKG_CONFIG_PATH
mkdir build
cd build
../configure \
--prefix=$(pwd)/install \
--arch=x86_64 \
--target-os=mingw32 \
--pkg-config-flags="--static" \
--cross-prefix=i686-w64-mingw32- \
--extra-libs=-lstdc++ \
--enable-shared \
--enable-static \
--enable-gpl \
--enable-nonfree \
--enable-version3 \
--enable-pic \
--enable-protocol=https \
--enable-openssl \
--enable-protocol=crypto \
--enable-libfreetype \
--enable-libx264 \
--enable-libx265 \
--disable-ffmpeg \
--disable-ffprobe 

注意这里指定openssl库位置要指定lib64目录,32位编译指定lib目录

出现以下画面说明第三方x264,x265,freetype2,openssl链接成功。

Ubuntu下mingw和aarch64交叉编译x264/x265/openssl/freetype2的ffmpeg_第2张图片

出现以下输出则表示https协议使能成功:

Ubuntu下mingw和aarch64交叉编译x264/x265/openssl/freetype2的ffmpeg_第3张图片

如果不加--extra-libs=-lstdc++会出现ERROR: x265 not found using pkg-config错误,查看编译log发现类似于以下错误Undefined reference to operator new(错误没有截图,csdn上找到的类似图片),这是因为libx265使用c++编译,ffmpeg采用c编译的问题;

Ubuntu下mingw和aarch64交叉编译x264/x265/openssl/freetype2的ffmpeg_第4张图片

如果不加--pkg-config-flags="--static"始终无法很好编译第三方库,不知道为啥。然后执行编译命令

make -j8 && make install

我的configure配置之后输出提示如下:

install prefix            /home/user/work/ffmpeg_mingw/x64/ffmpeg-4.4.3/build/install
source path               /home/user/work/ffmpeg_mingw/x64/ffmpeg-4.4.3
C compiler                x86_64-w64-mingw32-gcc
C library                 mingw64
host C compiler           gcc
host C library            glibc
ARCH                      x86 (generic)
big-endian                no
runtime cpu detection     yes
standalone assembly       yes
x86 assembler             nasm
MMX enabled               yes
MMXEXT enabled            yes
3DNow! enabled            yes
3DNow! extended enabled   yes
SSE enabled               yes
SSSE3 enabled             yes
AESNI enabled             yes
AVX enabled               yes
AVX2 enabled              yes
AVX-512 enabled           yes
XOP enabled               yes
FMA3 enabled              yes
FMA4 enabled              yes
i686 features enabled     yes
CMOV is fast              yes
EBX available             yes
EBP available             yes
debug symbols             yes
strip symbols             yes
optimize for size         no
optimizations             yes
static                    no
shared                    yes
postprocessing support    yes
network support           yes
threading support         w32threads
safe bitstream reader     yes
texi2html enabled         no
perl enabled              yes
pod2man enabled           yes
makeinfo enabled          no
makeinfo supports HTML    no

External libraries:
libfreetype             libx264                 libx265                 mediafoundation         openssl                 zlib

External libraries providing hardware acceleration:
d3d11va                 dxva2

Libraries:
avcodec                 avfilter                avutil                  swresample
avdevice                avformat                postproc                swscale

Programs:

Enabled decoders:
aac                     atrac3al                ffvhuff                 mp2float                pfm                     thp
aac_fixed               atrac3p                 ffwavesynth             mp3                     pgm                     tiertexseqvideo
aac_latm                atrac3pal               fic                     mp3adu                  pgmyuv                  tiff
aasc                    atrac9                  fits                    mp3adufloat             pgssub                  tmv
ac3                     aura                    flac                    mp3float                pgx                     truehd
ac3_fixed               aura2                   flashsv                 mp3on4                  photocd                 truemotion1
acelp_kelvin            av1                     flashsv2                mp3on4float             pictor                  truemotion2
adpcm_4xm               avrn                    flic                    mpc7                    pixlet                  truemotion2rt
adpcm_adx               avrp                    flv                     mpc8                    pjs                     truespeech
adpcm_afc               avs                     fmvc                    mpeg1video              png                     tscc
adpcm_agm               avui                    fourxm                  mpeg2video              ppm                     tscc2
adpcm_aica              ayuv                    fraps                   mpeg4                   prores                  tta
adpcm_argo              bethsoftvid             frwu                    mpegvideo               prosumer                twinvq
adpcm_ct                bfi                     g2m                     mpl2                    psd                     txd
adpcm_dtk               bink                    g723_1                  msa1                    ptx                     ulti
adpcm_ea                binkaudio_dct           g729                    mscc                    qcelp                   utvideo
adpcm_ea_maxis_xa       binkaudio_rdft          gdv                     msmpeg4v1               qdm2                    v210
adpcm_ea_r1             bintext                 gif                     msmpeg4v2               qdmc                    v210x
adpcm_ea_r2             bitpacked               gremlin_dpcm            msmpeg4v3               qdraw                   v308
adpcm_ea_r3             bmp                     gsm                     msp2                    qpeg                    v408
adpcm_ea_xas            bmv_audio               gsm_ms                  msrle                   qtrle                   v410
adpcm_g722              bmv_video               h261                    mss1                    r10k                    vb
adpcm_g726              brender_pix             h263                    mss2                    r210                    vble
adpcm_g726le            c93                     h263i                   msvideo1                ra_144                  vc1
adpcm_ima_alp           cavs                    h263p                   mszh                    ra_288                  vc1image
adpcm_ima_amv           ccaption                h264                    mts2                    ralf                    vcr1
adpcm_ima_apc           cdgraphics              hap                     mv30                    rasc                    vmdaudio
adpcm_ima_apm           cdtoons                 hca                     mvc1                    rawvideo                vmdvideo
adpcm_ima_cunning       cdxl                    hcom                    mvc2                    realtext                vmnc
adpcm_ima_dat4          cfhd                    hevc                    mvdv                    rl2                     vorbis
adpcm_ima_dk3           cinepak                 hnm4_video              mvha                    roq                     vp3
adpcm_ima_dk4           clearvideo              hq_hqa                  mwsc                    roq_dpcm                vp4
adpcm_ima_ea_eacs       cljr                    hqx                     mxpeg                   rpza                    vp5
adpcm_ima_ea_sead       cllc                    huffyuv                 nellymoser              rscc                    vp6
adpcm_ima_iss           comfortnoise            hymt                    notchlc                 rv10                    vp6a
adpcm_ima_moflex        cook                    iac                     nuv                     rv20                    vp6f
adpcm_ima_mtf           cpia                    idcin                   on2avc                  rv30                    vp7
adpcm_ima_oki           cri                     idf                     opus                    rv40                    vp8
adpcm_ima_qt            cscd                    iff_ilbm                paf_audio               s302m                   vp9
adpcm_ima_rad           cyuv                    ilbc                    paf_video               sami                    vplayer
adpcm_ima_smjpeg        dca                     imc                     pam                     sanm                    vqa
adpcm_ima_ssi           dds                     imm4                    pbm                     sbc                     wavpack
adpcm_ima_wav           derf_dpcm               imm5                    pcm_alaw                scpr                    wcmv
adpcm_ima_ws            dfa                     indeo2                  pcm_bluray              screenpresso            webp
adpcm_ms                dirac                   indeo3                  pcm_dvd                 sdx2_dpcm               webvtt
adpcm_mtaf              dnxhd                   indeo4                  pcm_f16le               sga                     wmalossless
adpcm_psx               dolby_e                 indeo5                  pcm_f24le               sgi                     wmapro
adpcm_sbpro_2           dpx                     interplay_acm           pcm_f32be               sgirle                  wmav1
adpcm_sbpro_3           dsd_lsbf                interplay_dpcm          pcm_f32le               sheervideo              wmav2
adpcm_sbpro_4           dsd_lsbf_planar         interplay_video         pcm_f64be               shorten                 wmavoice
adpcm_swf               dsd_msbf                ipu                     pcm_f64le               simbiosis_imx           wmv1
adpcm_thp               dsd_msbf_planar         jacosub                 pcm_lxf                 sipr                    wmv2
adpcm_thp_le            dsicinaudio             jpeg2000                pcm_mulaw               siren                   wmv3
adpcm_vima              dsicinvideo             jpegls                  pcm_s16be               smackaud                wmv3image
adpcm_xa                dss_sp                  jv                      pcm_s16be_planar        smacker                 wnv1
adpcm_yamaha            dst                     kgv1                    pcm_s16le               smc                     wrapped_avframe
adpcm_zork              dvaudio                 kmvc                    pcm_s16le_planar        smvjpeg                 ws_snd1
agm                     dvbsub                  lagarith                pcm_s24be               snow                    xan_dpcm
aic                     dvdsub                  loco                    pcm_s24daud             sol_dpcm                xan_wc3
alac                    dvvideo                 lscr                    pcm_s24le               sonic                   xan_wc4
alias_pix               dxa                     m101                    pcm_s24le_planar        sp5x                    xbin
als                     dxtory                  mace3                   pcm_s32be               speedhq                 xbm
amrnb                   dxv                     mace6                   pcm_s32le               srgc                    xface
amrwb                   eac3                    magicyuv                pcm_s32le_planar        srt                     xl
amv                     eacmv                   mdec                    pcm_s64be               ssa                     xma1
anm                     eamad                   metasound               pcm_s64le               stl                     xma2
ansi                    eatgq                   microdvd                pcm_s8                  subrip                  xpm
ape                     eatgv                   mimic                   pcm_s8_planar           subviewer               xsub
apng                    eatqi                   mjpeg                   pcm_sga                 subviewer1              xwd
aptx                    eightbps                mjpegb                  pcm_u16be               sunrast                 y41p
aptx_hd                 eightsvx_exp            mlp                     pcm_u16le               svq1                    ylc
arbc                    eightsvx_fib            mmvideo                 pcm_u24be               svq3                    yop
argo                    escape124               mobiclip                pcm_u24le               tak                     yuv4
ass                     escape130               motionpixels            pcm_u32be               targa                   zero12v
asv1                    evrc                    movtext                 pcm_u32le               targa_y216              zerocodec
asv2                    exr                     mp1                     pcm_u8                  tdsc                    zlib
atrac1                  fastaudio               mp1float                pcm_vidc                text                    zmbv
atrac3                  ffv1                    mp2                     pcx                     theora

Enabled encoders:
a64multi                asv2                    h264_mf                 pcm_f64be               pgmyuv                  text
a64multi5               avrp                    hevc_mf                 pcm_f64le               png                     tiff
aac                     avui                    huffyuv                 pcm_mulaw               ppm                     truehd
aac_mf                  ayuv                    jpeg2000                pcm_s16be               prores                  tta
ac3                     bmp                     jpegls                  pcm_s16be_planar        prores_aw               ttml
ac3_fixed               cfhd                    libx264                 pcm_s16le               prores_ks               utvideo
ac3_mf                  cinepak                 libx265                 pcm_s16le_planar        qtrle                   v210
adpcm_adx               cljr                    ljpeg                   pcm_s24be               r10k                    v308
adpcm_argo              comfortnoise            magicyuv                pcm_s24daud             r210                    v408
adpcm_g722              dca                     mjpeg                   pcm_s24le               ra_144                  v410
adpcm_g726              dnxhd                   mlp                     pcm_s24le_planar        rawvideo                vc2
adpcm_g726le            dpx                     movtext                 pcm_s32be               roq                     vorbis
adpcm_ima_alp           dvbsub                  mp2                     pcm_s32le               roq_dpcm                wavpack
adpcm_ima_amv           dvdsub                  mp2fixed                pcm_s32le_planar        rpza                    webvtt
adpcm_ima_apm           dvvideo                 mp3_mf                  pcm_s64be               rv10                    wmav1
adpcm_ima_qt            eac3                    mpeg1video              pcm_s64le               rv20                    wmav2
adpcm_ima_ssi           exr                     mpeg2video              pcm_s8                  s302m                   wmv1
adpcm_ima_wav           ffv1                    mpeg4                   pcm_s8_planar           sbc                     wmv2
adpcm_ms                ffvhuff                 msmpeg4v2               pcm_u16be               sgi                     wrapped_avframe
adpcm_swf               fits                    msmpeg4v3               pcm_u16le               snow                    xbm
adpcm_yamaha            flac                    msvideo1                pcm_u24be               sonic                   xface
alac                    flashsv                 nellymoser              pcm_u24le               sonic_ls                xsub
alias_pix               flashsv2                opus                    pcm_u32be               speedhq                 xwd
amv                     flv                     pam                     pcm_u32le               srt                     y41p
apng                    g723_1                  pbm                     pcm_u8                  ssa                     yuv4
aptx                    gif                     pcm_alaw                pcm_vidc                subrip                  zlib
aptx_hd                 h261                    pcm_dvd                 pcx                     sunrast                 zmbv
ass                     h263                    pcm_f32be               pfm                     svq1
asv1                    h263p                   pcm_f32le               pgm                     targa

Enabled hwaccels:
h264_d3d11va            hevc_d3d11va            mpeg2_d3d11va           vc1_d3d11va             vp9_d3d11va             wmv3_d3d11va
h264_d3d11va2           hevc_d3d11va2           mpeg2_d3d11va2          vc1_d3d11va2            vp9_d3d11va2            wmv3_d3d11va2
h264_dxva2              hevc_dxva2              mpeg2_dxva2             vc1_dxva2               vp9_dxva2               wmv3_dxva2

Enabled parsers:
aac                     cook                    dvd_nav                 h264                    opus                    vorbis
aac_latm                cri                     dvdsub                  hevc                    png                     vp3
ac3                     dca                     flac                    ipu                     pnm                     vp8
adx                     dirac                   g723_1                  jpeg2000                rv30                    vp9
av1                     dnxhd                   g729                    mjpeg                   rv40                    webp
avs2                    dolby_e                 gif                     mlp                     sbc                     xbm
avs3                    dpx                     gsm                     mpeg4video              sipr                    xma
bmp                     dvaudio                 h261                    mpegaudio               tak
cavsvideo               dvbsub                  h263                    mpegvideo               vc1

Enabled demuxers:
aa                      cdxl                    ico                     lrc                     pcm_mulaw               sol
aac                     cine                    idcin                   luodat                  pcm_s16be               sox
aax                     codec2                  idf                     lvf                     pcm_s16le               spdif
ac3                     codec2raw               iff                     lxf                     pcm_s24be               srt
ace                     concat                  ifv                     m4v                     pcm_s24le               stl
acm                     data                    ilbc                    matroska                pcm_s32be               str
act                     daud                    image2                  mca                     pcm_s32le               subviewer
adf                     dcstr                   image2_alias_pix        mcc                     pcm_s8                  subviewer1
adp                     derf                    image2_brender_pix      mgsts                   pcm_u16be               sup
ads                     dfa                     image2pipe              microdvd                pcm_u16le               svag
adx                     dhav                    image_bmp_pipe          mjpeg                   pcm_u24be               svs
aea                     dirac                   image_cri_pipe          mjpeg_2000              pcm_u24le               swf
afc                     dnxhd                   image_dds_pipe          mlp                     pcm_u32be               tak
aiff                    dsf                     image_dpx_pipe          mlv                     pcm_u32le               tedcaptions
aix                     dsicin                  image_exr_pipe          mm                      pcm_u8                  thp
alp                     dss                     image_gif_pipe          mmf                     pcm_vidc                threedostr
amr                     dts                     image_j2k_pipe          mods                    pjs                     tiertexseq
amrnb                   dtshd                   image_jpeg_pipe         moflex                  pmp                     tmv
amrwb                   dv                      image_jpegls_pipe       mov                     pp_bnk                  truehd
anm                     dvbsub                  image_pam_pipe          mp3                     pva                     tta
apc                     dvbtxt                  image_pbm_pipe          mpc                     pvf                     tty
ape                     dxa                     image_pcx_pipe          mpc8                    qcp                     txd
apm                     ea                      image_pgm_pipe          mpegps                  r3d                     ty
apng                    ea_cdata                image_pgmyuv_pipe       mpegts                  rawvideo                v210
aptx                    eac3                    image_pgx_pipe          mpegtsraw               realtext                v210x
aptx_hd                 epaf                    image_photocd_pipe      mpegvideo               redspark                vag
aqtitle                 ffmetadata              image_pictor_pipe       mpjpeg                  rl2                     vc1
argo_asf                filmstrip               image_png_pipe          mpl2                    rm                      vc1t
argo_brp                fits                    image_ppm_pipe          mpsub                   roq                     vividas
asf                     flac                    image_psd_pipe          msf                     rpl                     vivo
asf_o                   flic                    image_qdraw_pipe        msnwc_tcp               rsd                     vmd
ass                     flv                     image_sgi_pipe          msp                     rso                     vobsub
ast                     fourxm                  image_sunrast_pipe      mtaf                    rtp                     voc
au                      frm                     image_svg_pipe          mtv                     rtsp                    vpk
av1                     fsb                     image_tiff_pipe         musx                    s337m                   vplayer
avi                     fwse                    image_webp_pipe         mv                      sami                    vqf
avr                     g722                    image_xbm_pipe          mvi                     sap                     w64
avs                     g723_1                  image_xpm_pipe          mxf                     sbc                     wav
avs2                    g726                    image_xwd_pipe          mxg                     sbg                     wc3
avs3                    g726le                  ingenient               nc                      scc                     webm_dash_manifest
bethsoftvid             g729                    ipmovie                 nistsphere              sdp                     webvtt
bfi                     gdv                     ipu                     nsp                     sdr2                    wsaud
bfstm                   genh                    ircam                   nsv                     sds                     wsd
bink                    gif                     iss                     nut                     sdx                     wsvqa
binka                   gsm                     iv8                     nuv                     segafilm                wtv
bintext                 gxf                     ivf                     obu                     ser                     wv
bit                     h261                    ivr                     ogg                     sga                     wve
bmv                     h263                    jacosub                 oma                     shorten                 xa
boa                     h264                    jv                      paf                     siff                    xbin
brstm                   hca                     kux                     pcm_alaw                simbiosis_imx           xmv
c93                     hcom                    kvag                    pcm_f32be               sln                     xvag
caf                     hevc                    live_flv                pcm_f32le               smacker                 xwma
cavsvideo               hls                     lmlm4                   pcm_f64be               smjpeg                  yop
cdg                     hnm                     loas                    pcm_f64le               smush                   yuv4mpegpipe

Enabled muxers:
a64                     daud                    hevc                    mpeg1video              pcm_s8                  stream_segment
ac3                     dirac                   hls                     mpeg2dvd                pcm_u16be               streamhash
adts                    dnxhd                   ico                     mpeg2svcd               pcm_u16le               sup
adx                     dts                     ilbc                    mpeg2video              pcm_u24be               swf
aiff                    dv                      image2                  mpeg2vob                pcm_u24le               tee
alp                     eac3                    image2pipe              mpegts                  pcm_u32be               tg2
amr                     f4v                     ipod                    mpjpeg                  pcm_u32le               tgp
amv                     ffmetadata              ircam                   mxf                     pcm_u8                  truehd
apm                     fifo                    ismv                    mxf_d10                 pcm_vidc                tta
apng                    fifo_test               ivf                     mxf_opatom              psp                     ttml
aptx                    filmstrip               jacosub                 null                    rawvideo                uncodedframecrc
aptx_hd                 fits                    kvag                    nut                     rm                      vc1
argo_asf                flac                    latm                    oga                     roq                     vc1t
asf                     flv                     lrc                     ogg                     rso                     voc
asf_stream              framecrc                m4v                     ogv                     rtp                     w64
ass                     framehash               matroska                oma                     rtp_mpegts              wav
ast                     framemd5                matroska_audio          opus                    rtsp                    webm
au                      g722                    md5                     pcm_alaw                sap                     webm_chunk
avi                     g723_1                  microdvd                pcm_f32be               sbc                     webm_dash_manifest
avm2                    g726                    mjpeg                   pcm_f32le               scc                     webp
avs2                    g726le                  mkvtimestamp_v2         pcm_f64be               segafilm                webvtt
bit                     gif                     mlp                     pcm_f64le               segment                 wtv
caf                     gsm                     mmf                     pcm_mulaw               singlejpeg              wv
cavsvideo               gxf                     mov                     pcm_s16be               smjpeg                  yuv4mpegpipe
codec2                  h261                    mp2                     pcm_s16le               smoothstreaming
codec2raw               h263                    mp3                     pcm_s24be               sox
crc                     h264                    mp4                     pcm_s24le               spdif
dash                    hash                    mpeg1system             pcm_s32be               spx
data                    hds                     mpeg1vcd                pcm_s32le               srt

Enabled protocols:
async                   ffrtmphttp              http                    mmst                    rtmpt                   tcp
cache                   file                    httpproxy               pipe                    rtmpte                  tee
concat                  ftp                     https                   prompeg                 rtmpts                  tls
crypto                  gopher                  icecast                 rtmp                    rtp                     udp
data                    gophers                 md5                     rtmpe                   srtp                    udplite
ffrtmpcrypt             hls                     mmsh                    rtmps                   subfile

Enabled filters:
abench                  ashowinfo               deband                  highshelf               pal75bars               sine
abitscope               asidedata               deblock                 hilbert                 palettegen              smartblur
acompressor             asoftclip               decimate                histeq                  paletteuse              smptebars
acontrast               asplit                  deconvolve              histogram               pan                     smptehdbars
acopy                   astats                  dedot                   hqdn3d                  perms                   sobel
acrossfade              astreamselect           deesser                 hqx                     perspective             spectrumsynth
acrossover              asubboost               deflate                 hstack                  phase                   speechnorm
acrusher                asubcut                 deflicker               hue                     photosensitivity        split
acue                    asupercut               dejudder                hwdownload              pixdesctest             spp
addroi                  asuperpass              delogo                  hwmap                   pixscope                sr
adeclick                asuperstop              derain                  hwupload                pp                      ssim
adeclip                 atadenoise              deshake                 hysteresis              pp7                     stereo3d
adelay                  atempo                  despill                 identity                premultiply             stereotools
adenorm                 atrim                   detelecine              idet                    prewitt                 stereowiden
aderivative             avectorscope            dilation                il                      pseudocolor             streamselect
adrawgraph              avgblur                 displace                inflate                 psnr                    super2xsai
aecho                   axcorrelate             dnn_processing          interlace               pullup                  superequalizer
aemphasis               bandpass                doubleweave             interleave              qp                      surround
aeval                   bandreject              drawbox                 join                    random                  swaprect
aevalsrc                bass                    drawgraph               kerndeint               readeia608              swapuv
aexciter                bbox                    drawgrid                kirsch                  readvitc                tblend
afade                   bench                   drawtext                lagfun                  realtime                telecine
afftdn                  bilateral               drmeter                 lenscorrection          remap                   testsrc
afftfilt                biquad                  dynaudnorm              life                    removegrain             testsrc2
afifo                   bitplanenoise           earwax                  limiter                 removelogo              thistogram
afir                    blackdetect             ebur128                 loop                    repeatfields            threshold
afirsrc                 blackframe              edgedetect              loudnorm                replaygain              thumbnail
aformat                 blend                   elbg                    lowpass                 reverse                 tile
afreqshift              bm3d                    entropy                 lowshelf                rgbashift               tinterlace
agate                   boxblur                 epx                     lumakey                 rgbtestsrc              tlut2
agraphmonitor           bwdif                   eq                      lut                     roberts                 tmedian
ahistogram              cas                     equalizer               lut1d                   rotate                  tmidequalizer
aiir                    cellauto                erosion                 lut2                    sab                     tmix
aintegral               channelmap              estdif                  lut3d                   scale                   tonemap
ainterleave             channelsplit            exposure                lutrgb                  scale2ref               tpad
alimiter                chorus                  extractplanes           lutyuv                  scdet                   transpose
allpass                 chromahold              extrastereo             mandelbrot              scroll                  treble
allrgb                  chromakey               fade                    maskedclamp             select                  tremolo
allyuv                  chromanr                fftdnoiz                maskedmax               selectivecolor          trim
aloop                   chromashift             fftfilt                 maskedmerge             sendcmd                 unpremultiply
alphaextract            ciescope                field                   maskedmin               separatefields          unsharp
alphamerge              codecview               fieldhint               maskedthreshold         setdar                  untile
amerge                  color                   fieldmatch              maskfun                 setfield                uspp
ametadata               colorbalance            fieldorder              mcdeint                 setparams               v360
amix                    colorchannelmixer       fifo                    mcompand                setpts                  vaguedenoiser
amovie                  colorcontrast           fillborders             median                  setrange                vectorscope
amplify                 colorcorrect            find_rect               mergeplanes             setsar                  vflip
amultiply               colorhold               firequalizer            mestimate               settb                   vfrdet
anequalizer             colorize                flanger                 metadata                shear                   vibrance
anlmdn                  colorkey                floodfill               midequalizer            showcqt                 vibrato
anlms                   colorlevels             format                  minterpolate            showfreqs               vif
anoisesrc               colormatrix             fps                     mix                     showinfo                vignette
anull                   colorspace              framepack               monochrome              showpalette             vmafmotion
anullsink               colortemperature        framerate               movie                   showspatial             volume
anullsrc                compand                 framestep               mpdecimate              showspectrum            volumedetect
apad                    compensationdelay       freezedetect            mptestsrc               showspectrumpic         vstack
aperms                  concat                  freezeframes            msad                    showvolume              w3fdif
aphasemeter             convolution             fspp                    negate                  showwaves               waveform
aphaser                 convolve                gblur                   nlmeans                 showwavespic            weave
aphaseshift             copy                    geq                     nnedi                   shuffleframes           xbr
apulsator               cover_rect              gradfun                 noformat                shufflepixels           xfade
arealtime               crop                    gradients               noise                   shuffleplanes           xmedian
aresample               cropdetect              graphmonitor            normalize               sidechaincompress       xstack
areverse                crossfeed               greyedge                null                    sidechaingate           yadif
arnndn                  crystalizer             haas                    nullsink                sidedata                yaepblur
aselect                 cue                     haldclut                nullsrc                 sierpinski              yuvtestsrc
asendcmd                curves                  haldclutsrc             oscilloscope            signalstats             zoompan
asetnsamples            datascope               hdcd                    overlay                 signature
asetpts                 dblur                   headphone               owdenoise               silencedetect
asetrate                dcshift                 hflip                   pad                     silenceremove
asettb                  dctdnoiz                highpass                pal100bars              sinc

Enabled bsfs:
aac_adtstoasc           eac3_core               hevc_metadata           mpeg2_metadata          remove_extradata        vp9_superframe
av1_frame_merge         extract_extradata       hevc_mp4toannexb        mpeg4_unpack_bframes    setts                   vp9_superframe_split
av1_frame_split         filter_units            imx_dump_header         noise                   text2movsub
av1_metadata            h264_metadata           mjpeg2jpeg              null                    trace_headers
chomp                   h264_mp4toannexb        mjpega_dump_header      opus_metadata           truehd_core
dca_core                h264_redundant_pps      mov2textsub             pcm_rechunk             vp9_metadata
dump_extradata          hapqa_extract           mp3_header_decompress   prores_metadata         vp9_raw_reorder

Enabled indevs:
dshow                   gdigrab                 lavfi                   vfwcap

Enabled outdevs:

License: nonfree and unredistributable

4.3.2 编译32位版本

步骤与64位版本基本相同,编译第三方库和ffmpeg时更改以下项即可:

--host=i686-w64-mingw32
--arch=x86_64 
--target-os=mingw32 
--cross-prefix=i686-w64-mingw32-

4.4 测试验证

在install目录下生成需要的库文件和bin文件,经测试可以在windows下用qtcreator的mingw-64位编译和使用;
我的qt编译环境如下:

Ubuntu下mingw和aarch64交叉编译x264/x265/openssl/freetype2的ffmpeg_第5张图片
qt的pro文件添加以下内容:

INCLUDEPATH += $$PWD/ffmpeg-4.4.3/include

LIBS += -L$$PWD/ffmpeg-4.4.3/lib/ \
        -lavcodec \
        -lavfilter \
        -lavformat \
        -lavutil \
        -lswscale

Ubuntu下mingw和aarch64交叉编译x264/x265/openssl/freetype2的ffmpeg_第6张图片

库存放路径:

Ubuntu下mingw和aarch64交叉编译x264/x265/openssl/freetype2的ffmpeg_第7张图片

4.5 编译好的mingw版ffmpeg下载

包含32位静态和共享库,64位共享库。下载链接

5、gpac库编译

参考链接

git clone [email protected]:gpac/gpac.git
cd gpac-master
./configure --target-os=mingw32 --cross-prefix=x86_64-w64-mingw32- --prefix=build/x86_64-w64-mingw32 --static-mp4box --use-zlib=no --extra-cflags="-Ibuild/x86_64-w64-mingw32/include" --extra-ldflags="-Lbuild/x86_64-w64-mingw32/lib"
make -j20
make install

你可能感兴趣的:(日常记录,ffmpeg,ubuntu,linux)