-
-
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" |
echo "deb http://www.deb-multimedia.org buster main non-free" >> /etc/apt/sources.list
apt-get update -oAcquire::AllowInsecureRepositories=true
sudo apt-get install deb-multimedia-keyring -y
HI,
after install the previous packages and add:
apt-get install libcelt-dev
now I have this error:
ERROR: libcelt must be installed and version must be >= 0.11.0.
Any idea how to fix it?
I'm using a raspberrypi4 with debian buster
Here my notes in spanish (please use google translator)
Note that the this custom ffmpeg version are not stable, and sometime ffmpeg get zombie, sometime occurs a kernel panik, but is very fast on raspberry pi4
compilar ffmpeg en raspberry pi4 debian buster con soporte para HW
Nota:
Problemas de inestabilidad. A veces el proceso de ffmpeg se cuelga y se gueda zombie. Lo peor es que el raspberry no consigue reinciarse porqué se cuelga también el proceso de reboot.
Por lo tanto hay que reiniciar fisicamente, quitando la corriente. Desaconsejado usar este ffmpeg en un servidor remoto.
Pero podría servir en casa para crear un encoder usando el script ffmpeg-remote.
echo "deb http://www.deb-multimedia.org buster main non-free" >> /etc/apt/sources.list
apt-get update -oAcquire::AllowInsecureRepositories=true
sudo apt-get install deb-multimedia-keyring -y
sudo apt-get install libfdk-aac-dev automake autoconf libtool m4 build-essential yasm libmodplug-dev libx264-dev libopenh264-dev librtmp-dev libopencv-dev libsmbclient-dev libzimg-dev
http://www.celt-codec.org/downloads/
http://downloads.xiph.org/releases/celt/celt-0.11.1.tar.gz
tar zxvf celt-0.11.1.tar.gz
cd celt-0.11.1
./configure
make
make install
git clone https://github.com/ultravideo/kvazaar.git
./autogen.sh
./configure
make
sudo make install
[b]
https://github.com/jayrambhia/Install-OpenCV[/b]
(No estoy seguro probar ante sin este)Hay que instalar también Open-CV desde el código fuente (tarda una media hora larga)
git clone https://github.com/jayrambhia/Install-OpenCV.git
cd Install-OpenCV
cd Ubuntu
chmod +x *
./opencv_latest.sh
Tampoco esto no estoy seguro que sirva
export LD_LIBRARY_PATH=/usr/local/lib:/usr/lib/arm-linux-gnueabihf/:$LD_LIBRARY_PATH
https://gist.github.com/enzanki-ars/7d67996a90883e928bc1dd2db7ef0351
Aquí el script modificado para que se pueda compiañlr en raspberry pi4 con Raspbian oficial (debian buster)
#!/bin/bash
# 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/
# nel caso manchino dipendenze
#echo "deb http://www.deb-multimedia.org buster main non-free" >> /etc/apt/sources.list
#apt-get update -oAcquire::AllowInsecureRepositories=true
#sudo apt-get install deb-multimedia-keyring -y
export LD_LIBRARY_PATH=/usr/local/lib:/usr/lib/arm-linux-gnueabihf/:/usr/lib/arm-linux-gnueabihf/pkgconfig/:$LD_LIBRARY_PATH
export PKG_CONFIG_PATH=/usr/lib/pkgconfig
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 \
libfdk-aac-dev automake autoconf libtool m4 build-essential yasm libmodplug-dev libx264-dev libopenh264-dev librtmp-dev libopencv-dev libsmbclient-dev libzimg-dev \
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-libshine \
--enable-libsnappy \
--enable-libsoxr \
--enable-libspeex \
--enable-libssh \
--enable-libtheora \
--enable-libtwolame \
--enable-libv4l2 \
--enable-libvidstab \
--enable-libvo-amrwbenc \
--enable-libvorbis \
--enable-libvpx \
--enable-libwavpack \
--enable-libwebp \
--enable-libx264 \
--enable-libx265 \
--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
# --enable-librtmp \
# --enable-libsmbclient \
# --enable-libtesseract \
# --enable-libvmaf \
# --enable-libxavs \
echo "Making FFmpeg"
PATH="$HOME/bin:$PATH" make -j4
make install
hash -r
install ~/ffmpeg_sources/ffmpeg/ffmpeg /usr/local/bin
install ~/ffmpeg_sources/ffmpeg/ffplay /usr/local/bin
install ~/ffmpeg_sources/ffmpeg/ffprobe /usr/local/bin
#Update Shared Library Cache
echo "Updating Shared Library Cache"
sudo ldconfig
echo "FFmpeg and Codec Installation Complete"
Sorry, what is "tas"?
"tas zxvf celt-0.11.1.tar.gz"
hoobs@hoobs:~/config $ tas zxvf celt-0.11.1.tar.gz
bash: tas: command not found
Still get the following failures:
1.)
Installing various tools and packages, including audio-video codecs, required for building FFmpeg
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package libfdk-aac-dev
E: Unable to locate package libopenh264-dev
E: Unable to locate package libzimg-dev
E: Unable to locate package libfdk-aac-dev
E: Unable to locate package libkvazaar-dev
E: Unable to locate package libopenh264-dev
E: Unable to locate package libzimg-dev
--2020-01-27 01:47:07-- http://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
Resolving ffmpeg.org (ffmpeg.org)... 79.124.17.100
2.)
ERROR: chromaprint not found
3.)
If you think configure made a mistake, make sure you are using the latest
version from Git. If the latest version fails, report the problem to the
[email protected] mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "ffbuild/config.log" produced by configure as this will help
solve the problem.
Making FFmpeg
Makefile:166: /tests/Makefile: No such file or directory
make: *** No rule to make target '/tests/Makefile'. Stop.
Makefile:166: /tests/Makefile: No such file or directory
make: *** No rule to make target '/tests/Makefile'. Stop.
install: cannot stat '/home/hoobs/ffmpeg_sources/ffmpeg/ffmpeg': No such file or directory
install: cannot stat '/home/hoobs/ffmpeg_sources/ffmpeg/ffplay': No such file or directory
install: cannot stat '/home/hoobs/ffmpeg_sources/ffmpeg/ffprobe': No such file or directory
Updating Shared Library Cache
FFmpeg and Codec Installation Complete
please read "tas" -> "tar"
i had an error in avisynth
"ERROR: avisynth/avisynth_c.h not found"
apparently it was removed from ffmpeg and need to clone/compile it again :/
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
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
Hi. How do I resolve missing packages?
Begining Installation of FFmpeg Suite
Updating the APT repository information
Hit:1 https://deb.nodesource.com/node_8.x stretch InRelease
Hit:2 http://raspbian.raspberrypi.org/raspbian stretch InRelease
Ign:3 http://nimblestreamer.com/raspbian jessie/ InRelease
Hit:4 http://archive.raspberrypi.org/debian stretch InRelease
Hit:5 http://nimblestreamer.com/raspbian jessie/ Release
Hit:6 http://mirrordirector.raspbian.org/raspbian jessie InRelease
Reading package lists... Done
Setting up working directories to be used during the installation and build process
Installing various tools and packages, including audio-video codecs, required for building FFmpeg
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package libfdk-aac-dev
E: Unable to locate package libkvazaar-dev
E: Unable to locate package libopenh264-dev
E: Unable to locate package libvidstab-dev
E: Unable to locate package libzimg-dev