Hardware Accelerated Video Playback Guide
Hey all,

With the help of MrFixit2001, I was able to come up with a recipe for playing hardware accelerated media files with MPV. I'm using MrFixit2001's image as a starter.

Flash this image to an SD card (Etcher) https://github.com/mrfixit2001/debian_bu...xit.img.xz
ssh or access the terminal with a keyboard (root/root or rock/rock)

apt update && apt install vim git libdrm-dev vainfo libmodplug1 libmodplug-dev libmp3lame-dev libmp3lame0 libopus0 libopus-dev libspeex1 libspeex-dev libtheora-dev libtheora0 libghc-bzlib-dev libass5 libass-dev autoconf automake libtool libasound2 libasound2-dev libpulse-dev cmake debhelper fakeroot libvorbis-dev python

git clone https://github.com/rockchip-linux/mpp --depth 1 -b release
git clone https://github.com/rockchip-linux/ffmpeg --depth 1 -b rockchip/release/4.0
git clone https://github.com/mpv-player/mpv --depth 1 -b v0.29.1
cd mpp
wget https://raw.githubusercontent.com/LibreELEC/LibreELEC.tv/master/packages/multimedia/rkmpp/patches/rkmpp-0001-fix-32-bit-mmap-issue-on-64-bit-kernels.patch
patch osal/allocator/allocator_drm.c rkmpp-0001-fix-32-bit-mmap-issue-on-64-bit-kernels.patch

make -j6 && make install
cd ../ffmpeg
./configure --enable-static --enable-shared --enable-cross-compile --cross-prefix=/usr/bin/arm-linux-gnueabihf- --sysroot="/" --sysinclude="/usr/include" --host-cc="/usr/bin/gcc" --arch="arm" --target-os="linux" --disable-stripping --pkg-config="/usr/bin/pkg-config" --prefix=/usr --enable-avfilter --disable-version3 --enable-logging --enable-optimizations --disable-extra-warnings --enable-avdevice --enable-avcodec --enable-avformat --enable-network --disable-gray --enable-swscale-alpha --disable-small --enable-dct --enable-fft --enable-mdct --enable-rdft --disable-crystalhd --disable-dxva2 --enable-runtime-cpudetect --disable-hardcoded-tables --disable-mipsdsp --disable-mipsdspr2 --disable-msa --enable-hwaccels --disable-cuda --disable-cuvid --disable-nvenc --disable-avisynth --disable-frei0r --disable-libopencore-amrnb --disable-libopencore-amrwb --disable-libcdio --disable-libdc1394 --disable-libgsm --disable-libilbc --disable-libopenjpeg --disable-libvo-amrwbenc --disable-symver --disable-doc --disable-w32threads --enable-asm --enable-bsfs --enable-bzlib --enable-demuxers --enable-encoder=aac --enable-encoder=ac3 --enable-encoder=mjpeg --enable-encoder=png --enable-encoder=wmav2 --enable-filters --enable-gpl --enable-libspeex --enable-muxer=adts --enable-muxer=asf --enable-muxer=ipod --enable-muxer=mpegts --enable-muxer=spdif --enable-parsers --enable-pic --enable-postproc --enable-protocol=http --enable-pthreads --enable-shared --enable-swscale --enable-yasm --enable-zlib  --enable-gpl --disable-nonfree --enable-ffmpeg --enable-ffplay --disable-avresample --disable-ffprobe --enable-postproc --enable-swscale --enable-indevs --enable-outdevs --enable-pthreads --enable-zlib --enable-bzlib --disable-libfdk-aac --disable-gnutls --disable-openssl --disable-libopenh264 --enable-libvorbis --enable-muxer=ogg --enable-encoder=libvorbis --disable-vaapi --disable-vdpau --disable-mmal --disable-omx --disable-omx-rpi --enable-libdrm --enable-version3 --enable-rkmpp --disable-libopencv --enable-libopus --disable-libvpx --enable-libass --disable-libbluray --disable-librtmp --enable-libmp3lame --enable-libmodplug --enable-libspeex --enable-libtheora --disable-libwavpack --enable-libfreetype --enable-fontconfig --disable-libx264 --disable-libx265 --disable-yasm --disable-mmx --disable-sse --disable-sse2 --disable-sse3 --disable-ssse3 --disable-sse4 --disable-sse42 --disable-avx --disable-avx2 --disable-armv6 --disable-armv6t2 --enable-vfp --enable-neon --disable-altivec --extra-libs=-latomic --enable-pic --cpu="cortex-a53" --pkgconfigdir=/usr/lib/arm-linux-gnueabihf/pkgconfig

make -j6 && make install
cd ../mpv
./waf configure && ./waf && ./waf install

 mpv --vo=gpu --gpu-context=drm --hwdec=rkmpp your_media_file.mp4
I haven't run through the guide a second time on a fresh image, so if you run into issues, let me know and I'll edit this. I'm working on creating a guide on the bionic minimal image from Ayufan next, but I'm running into a few issues.
update: change your url on the 32-to-64 patch to https://raw.githubusercontent.com/LibreE...nels.patch. It's missing in the current version.

question: Why set the cpu descriptor as a53? We also have two a72 cores to work with.
Why there is no such solution for every distro for Rock64?
Linux rock64 4.4.190-1233-rockchip-ayufan-gd3f1be0ed310 #1 SMP Wed Aug 28 08:59:34 UTC 2019 aarch64 GNU/Linux

Possibly Related Threads…
Thread Author Replies Views Last Post
  Netflix with hardware acceleration not working Helium75 1 296 12-15-2019, 09:26 AM
Last Post: Helium75
Information [archived] 0.8.X images from ayufan; Mate DE + video / 3d acceleration Luke 28 5,229 05-18-2019, 02:03 PM
Last Post: rickard
  Grabbing screenshot while hardware decoding StefanRvO 0 156 05-16-2019, 09:01 AM
Last Post: StefanRvO
  hardware pwm pins Mentaluproar 1 409 02-24-2019, 02:09 AM
Last Post: tllim
  Video playing Faster NightCrawler504 8 1,412 12-07-2018, 09:50 AM
Last Post: fosf0r
  Hardware Graphics Accelerator RuslanGennadievich 1 497 09-25-2018, 02:43 AM
Last Post: dukla2000

Forum Jump:

Users browsing this thread: 1 Guest(s)