-
-
Save enzanki-ars/7d67996a90883e928bc1dd2db7ef0351 to your computer and use it in GitHub Desktop.
| #!/bin/bash | |
| # ######################################################### | |
| # | |
| # WW WW AAA RRRRRR NN NN IIIII NN NN GGGG | |
| # WW WW AAAAA RR RR NNN NN III NNN NN GG GG | |
| # WW W WW AA AA RRRRRR NN N NN III NN N NN GG | |
| # WW WWW WW AAAAAAA RR RR NN NNN III NN NNN GG GG | |
| # WW WW AA AA RR RR NN NN IIIII NN NN GGGGGG | |
| # | |
| # ######################################################### | |
| # | |
| # WARNING: This script was last modified in 2017, and a lot | |
| # has changed with FFmpeg and RaspberryPi OS since then. | |
| # This script no longer works as is and should not be used. | |
| # The builtin FFmpeg might also work better now for most | |
| # hardware accelerated encoding/decoding needs. | |
| # | |
| # ######################################################### | |
| # Compile and install/update (or install via Apt) FFmpeg Codecs | |
| # Compile and install/update FFmpeg suite | |
| # Compile with hardware acceleration | |
| # Modified from https://retroresolution.com/compiling-ffmpeg-from-source-code-all-in-one-script/ | |
| echo "Begining Installation of FFmpeg Suite" | |
| #Update APT Repository | |
| echo "Updating the APT repository information" | |
| sudo apt-get update | |
| #Create Working Directories | |
| echo "Setting up working directories to be used during the installation and build process" | |
| cd ~ | |
| rm -rf ~/ffmpeg_build ~/ffmpeg_sources ~/bin/{ffmpeg,ffprobe,ffplay,ffserver,x264,x265} | |
| mkdir -p ~/ffmpeg_sources | |
| mkdir -p ~/ffmpeg_build | |
| #Build Tools | |
| echo "Installing various tools and packages, including audio-video codecs, required for building FFmpeg" | |
| sudo apt-get -y install \ | |
| autoconf \ | |
| automake \ | |
| build-essential \ | |
| git \ | |
| pkg-config \ | |
| texinfo \ | |
| wget \ | |
| yasm \ | |
| libavdevice-dev \ | |
| frei0r-plugins-dev \ | |
| ladspa-sdk \ | |
| libass-dev \ | |
| libavc1394-dev \ | |
| libavresample-dev \ | |
| libbluray-dev \ | |
| libbs2b-dev \ | |
| libcaca-dev \ | |
| libcdio-dev \ | |
| libcelt-dev \ | |
| libchromaprint-dev \ | |
| libdrm-dev \ | |
| libfdk-aac-dev \ | |
| flite1-dev \ | |
| libfontconfig1-dev \ | |
| libfreetype6-dev \ | |
| libfrei0r-ocaml-dev \ | |
| libfribidi-dev \ | |
| libgme-dev \ | |
| libgsm1-dev \ | |
| libiec61883-dev \ | |
| libjack-dev \ | |
| libkvazaar-dev \ | |
| libladspa-ocaml-dev \ | |
| libmodplug-dev \ | |
| libmp3lame-dev \ | |
| libmp3lame-dev \ | |
| libopencore-amrnb-dev \ | |
| libopencore-amrwb-dev \ | |
| libopencv-dev \ | |
| libopenh264-dev \ | |
| libopenjpeg-dev \ | |
| libopenmpt-dev \ | |
| libopus-dev \ | |
| libopus-dev \ | |
| libpulse-dev \ | |
| librsvg2-dev \ | |
| librtmp-dev \ | |
| librubberband-dev \ | |
| libsdl2-dev \ | |
| libshine-dev \ | |
| libsmbclient-dev \ | |
| libsnappy-dev \ | |
| libsoxr-dev \ | |
| libspeex-dev \ | |
| libssh-dev \ | |
| libtesseract-dev \ | |
| libtheora-dev \ | |
| libtheora-dev \ | |
| libtool \ | |
| libtwolame-dev \ | |
| libv4l-dev \ | |
| libva-dev \ | |
| libvdpau-dev \ | |
| libvidstab-dev \ | |
| libvo-amrwbenc-dev \ | |
| libvorbis-dev \ | |
| libvorbis-dev \ | |
| libvpx-dev \ | |
| libvpx-dev \ | |
| libwavpack-dev \ | |
| libwebp-dev \ | |
| libx264-dev \ | |
| libx264-dev \ | |
| libx265-dev \ | |
| libx265-dev \ | |
| libxcb1-dev \ | |
| libxcb-shape0-dev \ | |
| libxcb-shm0-dev \ | |
| libxcb-xfixes0-dev \ | |
| libxml2-dev \ | |
| libxvidcore-dev \ | |
| libzimg-dev \ | |
| libzmq-dev \ | |
| libzvbi-dev \ | |
| libopenal-dev \ | |
| libssl1.0-dev \ | |
| zlib1g-dev | |
| cd ~/ffmpeg_sources | |
| wget http://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 -O ffmpeg-snapshot.tar.bz2 | |
| tar xjvf ffmpeg-snapshot.tar.bz2 | |
| cd ffmpeg | |
| echo "Configuring FFmpeg" | |
| PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure \ | |
| --prefix="$HOME/ffmpeg_build" \ | |
| --pkg-config-flags="--static" \ | |
| --extra-cflags="-I$HOME/ffmpeg_build/include" \ | |
| --extra-ldflags="-L$HOME/ffmpeg_build/lib" \ | |
| --extra-libs="-lpthread -lm" \ | |
| --bindir="$HOME/bin" \ | |
| --enable-gpl \ | |
| --enable-nonfree \ | |
| --enable-version3 \ | |
| --enable-avresample \ | |
| --enable-omx \ | |
| --enable-omx-rpi \ | |
| --enable-mmal \ | |
| --enable-avisynth \ | |
| --enable-chromaprint \ | |
| --enable-frei0r \ | |
| --enable-ladspa \ | |
| --enable-libass \ | |
| --enable-libbluray \ | |
| --enable-libbs2b \ | |
| --enable-libcaca \ | |
| --enable-libcelt \ | |
| --enable-libcdio \ | |
| --enable-libdc1394 \ | |
| --enable-libfdk-aac \ | |
| --enable-libflite \ | |
| --enable-libfontconfig \ | |
| --enable-libfreetype \ | |
| --enable-libfribidi \ | |
| --enable-libgme \ | |
| --enable-libgsm \ | |
| --enable-libiec61883 \ | |
| --enable-libjack \ | |
| --enable-libkvazaar \ | |
| --enable-libmodplug \ | |
| --enable-libmp3lame \ | |
| --enable-libopencore-amrnb \ | |
| --enable-libopencore-amrwb \ | |
| --enable-libopencv \ | |
| --enable-libopenh264 \ | |
| --enable-libopenjpeg \ | |
| --enable-libopenmpt \ | |
| --enable-libopus \ | |
| --enable-libpulse \ | |
| --enable-librsvg \ | |
| --enable-librubberband \ | |
| --enable-librtmp \ | |
| --enable-libshine \ | |
| --enable-libsmbclient \ | |
| --enable-libsnappy \ | |
| --enable-libsoxr \ | |
| --enable-libspeex \ | |
| --enable-libssh \ | |
| --enable-libtesseract \ | |
| --enable-libtheora \ | |
| --enable-libtwolame \ | |
| --enable-libv4l2 \ | |
| --enable-libvidstab \ | |
| --enable-libvmaf \ | |
| --enable-libvo-amrwbenc \ | |
| --enable-libvorbis \ | |
| --enable-libvpx \ | |
| --enable-libwavpack \ | |
| --enable-libwebp \ | |
| --enable-libx264 \ | |
| --enable-libx265 \ | |
| --enable-libxavs \ | |
| --enable-libxcb \ | |
| --enable-libxcb-shm \ | |
| --enable-libxcb-xfixes \ | |
| --enable-libxcb-shape \ | |
| --enable-libxvid \ | |
| --enable-libxml2 \ | |
| --enable-libzimg \ | |
| --enable-libzmq \ | |
| --enable-libzvbi \ | |
| --enable-libdrm \ | |
| --enable-openssl \ | |
| --enable-openal \ | |
| --enable-opengl | |
| echo "Making FFmpeg" | |
| PATH="$HOME/bin:$PATH" make -j4 | |
| make install | |
| hash -r | |
| #Update Shared Library Cache | |
| echo "Updating Shared Library Cache" | |
| sudo ldconfig | |
| echo "FFmpeg and Codec Installation Complete" |
Please note. Actually the stock ffmpeg coming with raspberry is, support omx and neon. Try it with a simple scale from HD to SD without codecs or other parameters. Just the filter scale
i'm trying to build a hardware accelerated ffmpeg to use with emby-server, currently it's only doing software accel... no ffmpeg is installed in the base OS, ffmpeg is only installed with emby-server
I'm using a RPi4 of 4GB with AVideo (ex youphptube) and it's compressing by HW the new videos form 720p to 480p and 360p every day.
Please try to use Raspbian from https://www.raspberrypi.org/downloads/ then
sudo apt install ffmpeg
then use a test HD video on mp4 and try to:
fmpeg -i $pathFileName -vf 'scale=-2:min(480\,if(mod(iw\,2)\,iw-1\,iw))' $destinationFile -y
this reencode the video at 480p usign NEON v6 hardware from CPU
then try to
fmpeg -i $pathFileName -c:a copy -c:v h264_omx -vf 'scale=-2:min(480\,if(mod(iw\,2)\,iw-1\,iw))' $destinationFile -y
This use the HW encoder of video processor.
BUT: compare the videos quality now
The speed is similar (3-4x) but the quality of NEON is superior for the moment. In future I hope that it change. but fot moment OMX is useless apart live scenarios in low quality but fastest.
Please try it
i'll try it, it's for raspi 3
with h264_omx the encoding it's a bit faster and the processor will be only at 65-70º max, but the video quality it's not good.
with h264_omx the encoding it's a bit faster and the processor will be only at 65-70º max, but the video quality it's not good.
installed from the repository and replaced the one in emby server with the repository.... working flawless
Getting
Unknown option "--enable-avresample".
See ./configure --help for available options.
because libavresample was deprecated in 2018-1, and removed from FFmpeg in 2021-4 (ffmpeg 4.4).
removing line 127 allows building ffmpeg albeit without avresample support.
Substituting --enable-avresample for --enable-swresample might work.
Compillation bullseye ::
- aarch64 ~~ (X • opencv, omx-rpi, kvazaar, mmmal)(√ . . . )
- armv7l ~~ (X • opencv, omx-rpi, kvazaar)( √ . . . )
tmpdocs.epizy.com/000_Raspy_Bullseye_Ffmpeg.txt


Please note. Actually the stock ffmpeg coming with raspberry is, support omx and neon. Try it with a simple scale from HD to SD without codecs or other parameters. Just the filter scale