It seems everything needed are these two patches, then you can build kernel packages and simply try it out. Please report back and have also a look at http://linux-sunxi.org/User:Rellla/Armbian
EDIT: Kernel package with patches and appropriate CMA settings: kernel-cma_ump-sun7i_5.06_armhf.tgz Please test and report back.
It's not that hard to build ffmpeg on Armbian, directly from official source. I will show all steps i am using and all codecs i install, if some is not needed, skip and remove it from ffmpeg ./config. First i create some temporary folder, it's named "t" in this example. Then we can get dependencies with "apt-get build-dep". As ffmpeg is present in Ubuntu repositories, we can get directly:
sudo apt-get update
sudo apt-get build-dep ffmpeg
But in Debian ffmpeg is not present, so we can get deps for libav:
sudo apt-get update
sudo apt-get build-dep libav
It's also a good idea to have ffmpeg support samba, so we can install it too:
sudo apt-get install samba samba-common attr samba-vfs-modules smbclient
Get some more dependencies:
sudo apt-get install autoconf automake build-essential libass-dev libfreetype6-dev libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev pkg-config texinfo zlib1g-dev
We will probably need this packages too:
cd t
wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
tar xzvf yasm-1.3.0.tar.gz
cd yasm-1.3.0
./configure --prefix=/usr
make -j2
sudo make install
cd ..
tar -xjvf fribidi-0.19.7.tar.bz2
cd fribidi-0.19.7
./configure
make
sudo make install
cd ..
http://savannah.nongnu.org/download/freetype/
wget http://download.savannah.gnu.org/releases/freetype/freetype-2.6.3.tar.bz2
tar xjvf freetype-2.6.3.tar.bz2
cd freetype-2.6.3
sh autogen.sh
make setup ansi
make -j2
cd ..
Let's install some codecs, avoid what you don't need:
sudo curl https://yt-dl.org/downloads/2016.02.27/youtube-dl -o /usr/local/bin/youtube-dl
sudo chmod a+rx /usr/local/bin/youtube-dl
https://sourceforge.net/projects/lame/files/lame/
tar -xzvf lame-3.99.5.tar.gz
cd lame-3.99.5
./configure
make -j2
sudo make install
cd ..
git clone http://git.videolan.org/git/x262.git
cd x262
./configure --prefix=/usr --enable-static --enable-shared
make -j2
sudo make install
sudo ldconfig
cd ..
git clone git://git.videolan.org/x264.git
cd x264
./configure --enable-static --enable-shared
make -j2
sudo make install
sudo ldconfig
cd ..
video4linux/libv4l2
git clone git://linuxtv.org/v4l-utils.git
cd v4l-utils
./bootstrap.sh
./configure
make -j2
sudo make install
cd ..
http://downloads.sourceforge.net/opencore-amr/fdk-aac-0.1.4.tar.gz
tar xzvf fdk-aac-0.1.4.tar.gz
cd fdk-aac-0.1.4
./configure --prefix=/usr --disable-static
make -j2
sudo make install
cd ..
wget http://downloads.xiph.org/releases/opus/opus-1.1.tar.gz
tar xzvf opus-1.1.tar.gz
cd opus-1.1
./configure
make -j2
sudo make install
cd ..
wget http://storage.googleapis.com/downloads.webmproject.org/releases/webm/libvpx-1.5.0.tar.bz2
tar xjvf libvpx-1.5.0.tar.bz2
cd libvpx-1.5.0
./configure --prefix=/usr --disable-examples --disable-unit-tests
make -j2
sudo make install
cd ..
sudo apt-get install flac
git clone https://github.com/libass/libass.git
cd libass
./autogen.sh
./configure --prefix=/usr
make -j2
sudo make install
cd ..
https://www.xiph.org/downloads/
wget http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.xz
tar xJvf libogg-1.3.2.tar.xz
cd libogg-1.3.2
./configure
make -j2
sudo make install
cd ..
wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.5.tar.xz
tar xJvf libvorbis-1.3.5.tar.xz
cd libvorbis-1.3.5
./configure
make -j2
sudo make install
cd ..
If you need x265 (as H3 support HEVC/H265) this is a tricky one and took me some time to deal with, because of a bug, so it need special attention. We need shared libraries but we will get error during make. So first some dependencies:
sudo apt-get install mercurial cmake cmake-curses-gui build-essential
hg clone https://bitbucket.org/multicoreware/x265
We have to modify one file, so shared version can be build. Open the following file:
nano /t/x265/source/common/primitives.cpp
and locate this lines:
- #if ENABLE_ASSEMBLY && X265_ARCH_ARM == 0
void PFX(cpu_neon_test)(void) {}
int PFX(cpu_fast_neon_mrc_test)(void) { return 0; }
- #endif
}
#endif
Remove the two lines with "-" in front and save (ctrl+o, ctrl+x). Now we can build what we need:
cd x265/build/linux
./make-Makefiles.bash #> c > g
make -j2
sudo make install
sudo ldconfig
cd ~/t
As we have all packages and codecs we need, we can build ffmpeg:
wget http://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
tar xjvf ffmpeg-snapshot.tar.bz2
cd ffmpeg
./configure --prefix=/usr --enable-nonfree --enable-gpl --enable-version3 --enable-vdpau --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libpulse --enable-libv4l2 --enable-libx264 --enable-libx265
make -j2
sudo make install
This will take a while, but i think it worth.
The only important thing about kernel is this parameter:
CONFIG_CMA=y
# CONFIG_CMA_DEBUG is not set
#
# Default contiguous memory area size:
#
CONFIG_CMA_SIZE_MBYTES=192
CONFIG_CMA_SIZE_SEL_MBYTES=y
# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set
# CONFIG_CMA_SIZE_SEL_MIN is not set
# CONFIG_CMA_SIZE_SEL_MAX is not set
CONFIG_CMA_ALIGNMENT=8
CONFIG_CMA_AREAS=7
I compiled amrbian 3.4 kernel with it and it work stable. Even the zero-copy double buffering start working with the help of this and now 1080p video acceleration is no problem. But this guy have some very modded system and it's difficult to install his versions of libraries. His UMP version is not working in my system, but i suspect i had to install fbturbo for X11 and not for framebuffer. And his libvdpau-sunxi require to remove some parameters before compilation, because of something about Valgrind i completely missunderstand. And there were many other thing i manage to solve, but those two give up me.
Hm, i really have to open this topic to find solution to my first question a minutes later. I don't know why but i have to reboot halted system during install and run - "dpkg --configure -a" . The process resumes and finish with the following errors:
but Gnome loads successfully after reboot. Of course i have to add another user instead of root to be able to login and the old problem - "the screen goes off and will not restart until reboot" remain, but it something for now.
So only the thing with "fb0_framebuffer_num=3" bother me for now.