树莓派4B:编译安装FFMPEG与X264

简介: 树莓派4B:编译安装FFMPEG与X264

一、环境介绍

开发板:树莓派4B

操作方式:windows远程桌面连接

远程桌面连接参考这里:https://blog.csdn.net/xiaolong1126626497/article/details/106099194

二、编译安装X264

下面一切都在树莓派4B上操作,下面步骤里下载各种安装包之后(下载通过树莓派4B自带的谷歌浏览器下载),再将安装包移动

到U盘里进行编译的,主要是树莓派4B本身空间不大。

image.png

2.1 编译安装NASM

下载NASM库:  http://distfiles.macports.org/nasm/

image.png

pi@raspberrypi:/media/pi/DS小龙哥/work $ mv /home/pi/Downloads/nasm-2.14.02.tar.bz2 ./
pi@raspberrypi:/media/pi/DS小龙哥/work $ tar xvf nasm-2.14.02.tar.bz2 
pi@raspberrypi:/media/pi/DS小龙哥/work $ cd nasm-2.14.02/
pi@raspberrypi:/media/pi/DS小龙哥/work/nasm-2.14.02 $ ./configure
pi@raspberrypi:/media/pi/DS小龙哥/work/nasm-2.14.02 $ make
pi@raspberrypi:/media/pi/DS小龙哥/work/nasm-2.14.02 $ sudo make install

2.2 下载编译X264

下载地址: https://www.videolan.org/developers/x264.html

image.png

pi@raspberrypi:/media/pi/DS小龙哥/work $ mv /home/pi/Downloads/x264-master.tar.bz2 ./
pi@raspberrypi:/media/pi/DS小龙哥/work $ tar xvf x264-master.tar.bz2 
pi@raspberrypi:/media/pi/DS小龙哥/work $ cd x264-master/
pi@raspberrypi:/media/pi/DS小龙哥/work/x264-maste $  ./configure --prefix=$PWD/_install  --enable-shared
pi@raspberrypi:/media/pi/DS小龙哥/work/x264-master $ make && make install
pi@raspberrypi:/media/pi/DS小龙哥/work/x264-master $ sudo cp _install/include /usr/ -rf
pi@raspberrypi:/media/pi/DS小龙哥/work/x264-master $ sudo cp _install/lib /usr/ -rf

下面图片是编译之后生成的文件:

image.png

2.3 下载编译FFMPEG库

下载地址:  http://www.ffmpeg.org/download.html

image.png

pi@raspberrypi:/media/pi/DS小龙哥/work $ mv /home/pi/Downloads/ffmpeg-4.2.2.tar.bz2 ./
pi@raspberrypi:/media/pi/DS小龙哥/work $ tar xvf ffmpeg-4.2.2.tar.bz2
pi@raspberrypi:/media/pi/DS小龙哥/work $ cd ffmpeg-4.2.2/
pi@raspberrypi:/media/pi/DS小龙哥/work/ffmpeg-4.2.2 $ sudo apt-get install libomxil-bellagio-dev
pi@raspberrypi:/media/pi/DS小龙哥/work/ffmpeg-4.2.2 $  ./configure --enable-shared --prefix=$PWD/_install --enable-gpl --enable-libx264 --enable-omx-rpi --enable-mmal --enable-hwaccel=h264_mmal --enable-decoder=h264_mmal --enable-encoder=h264_omx --enable-omx
pi@raspberrypi:/media/pi/DS小龙哥/work/ffmpeg-4.2.2 $ make && make install
pi@raspberrypi:/media/pi/DS小龙哥/work/ffmpeg-4.2.2 $ sudo cp _install/include /usr/ -rf
pi@raspberrypi:/media/pi/DS小龙哥/work/ffmpeg-4.2.2 $ sudo cp _install/lib /usr/ -rf
pi@raspberrypi:/media/pi/DS小龙哥/work/ffmpeg-4.2.2 $ sudo cp _install/bin /usr/ -rf
pi@raspberrypi:/media/pi/DS小龙哥/work/ffmpeg-4.2.2 $ ffmpeg -v
ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 8 (Raspbian 8.3.0-6+rpi1)
  configuration: --enable-shared --prefix='/media/pi/DS小龙哥/work/ffmpeg-4.2.2/_install' --enable-gpl --enable-libx264 --enable-omx-rpi --enable-mmal --enable-hwaccel=h264_mmal --enable-decoder=h264_mmal --enable-encoder=h264_omx --enable-omx
  WARNING: library configuration mismatch
  avutil      configuration: --prefix=/usr --extra-version='1+rpt7~deb10u1' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs
  avcodec     configuration: --prefix=/usr --extra-version='1+rpt7~deb10u1' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs
  avformat    configuration: --prefix=/usr --extra-version='1+rpt7~deb10u1' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs
  avdevice    configuration: --prefix=/usr --extra-version='1+rpt7~deb10u1' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs
  avfilter    configuration: --prefix=/usr --extra-version='1+rpt7~deb10u1' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs
  swscale     configuration: --prefix=/usr --extra-version='1+rpt7~deb10u1' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs
  swresample  configuration: --prefix=/usr --extra-version='1+rpt7~deb10u1' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs
  postproc    configuration: --prefix=/usr --extra-version='1+rpt7~deb10u1' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs
  libavutil      56. 31.100 / 56. 22.100
  libavcodec     58. 54.100 / 58. 35.100
  libavformat    58. 29.100 / 58. 20.100
  libavdevice    58.  8.100 / 58.  5.100
  libavfilter     7. 57.100 /  7. 40.101
  libswscale      5.  5.100 /  5.  3.100
  libswresample   3.  5.100 /  3.  3.100
  libpostproc    55.  5.100 / 55.  3.100

2.4 将库集合到一个目录下,方便后续编译调用,指定路径

pi@raspberrypi:~ $ pwd
/home/pi
pi@raspberrypi:~ $ mkdir work
pi@raspberrypi:~ $ cd work/
pi@raspberrypi:~/work $ mkdir pi4b_ffmpeg_x264_lib
pi@raspberrypi:~/work $ cd pi4b_ffmpeg_x264_lib/                              
pi@raspberrypi:~/work/pi4b_ffmpeg_x264_lib $ cp /media/pi/DS小龙哥/work/ffmpeg-4.2.2/_install/* ./ -rf
pi@raspberrypi:~/work/pi4b_ffmpeg_x264_lib $ cp /media/pi/DS小龙哥/work/x264-master/_install/* ./ -rf
pi@raspberrypi:~/work/pi4b_ffmpeg_x264_lib $ ls
bin  include  lib  share
pi@raspberrypi:~/work/pi4b_ffmpeg_x264_lib $ 

目录
相关文章
|
7月前
|
Linux 开发工具 C语言
Centos8下编译安装最新版ffmpeg解决方案(含Centos8换源阿里云)
Centos8下编译安装最新版ffmpeg解决方案(含Centos8换源阿里云)
994 3
|
Ubuntu 编译器
Ubuntu18.4下交叉编译X264和FFMPEG到ARM平台(aarch64-linux-gcc)
Ubuntu18.4下交叉编译X264和FFMPEG到ARM平台(aarch64-linux-gcc)
1529 0
|
7月前
|
人机交互 C++
QT + FFmpeg 5.x + x264 + x265 + SDL2 音视频播放器
QT + FFmpeg 5.x + x264 + x265 + SDL2 音视频播放器
230 0
|
算法 Ubuntu Linux
红胖子网络科技博文大全:开发技术集合(包含Qt实用技术、树莓派、三维、OpenCV、OpenGL、ffmpeg、OSG、单片机、软硬结合等等)持续更新中...
红胖子网络科技博文大全:开发技术集合(包含Qt实用技术、树莓派、三维、OpenCV、OpenGL、ffmpeg、OSG、单片机、软硬结合等等)持续更新中...
|
编解码 Ubuntu IDE
基于Ubuntu交叉编译X264, FFmpeg Windows SDK详细教程
基于Ubuntu交叉编译X264, FFmpeg Windows SDK详细教程
245 0
|
编解码 Linux 编译器
FFmpeg引入x264扩展
FFmpeg引入x264扩展
228 0
|
Windows
编译WINDOWS版FFmpeg:编译x264
编译WINDOWS版FFmpeg:编译x264
139 0
|
Ubuntu 编译器
ubuntu下交叉编译X264和FFMPEG到RK3399平台(编译器:aarch64-linux-gcc)
ubuntu下交叉编译X264和FFMPEG到RK3399平台(编译器:aarch64-linux-gcc)
598 0
ubuntu下交叉编译X264和FFMPEG到RK3399平台(编译器:aarch64-linux-gcc)
|
编译器 Linux C语言
Linux下交叉编译FFMPEG与X264库:目标板友善之臂Tiny4412开发板_EXYNOS4412(ARMV7_32位)
Linux下交叉编译FFMPEG与X264库:目标板友善之臂Tiny4412开发板_EXYNOS4412(ARMV7_32位)
398 0
Linux下交叉编译FFMPEG与X264库:目标板友善之臂Tiny4412开发板_EXYNOS4412(ARMV7_32位)
|
Ubuntu Shell Android开发
Ubuntu下 Android NDK 编译 FFmpeg + x264 + fdk-aac (arm/x86)的配置脚本
Ubuntu下 Android NDK 编译 FFmpeg + x264 + fdk-aac (arm/x86)的配置脚本
391 0
Ubuntu下 Android NDK 编译 FFmpeg + x264 + fdk-aac (arm/x86)的配置脚本