Hardware Accelerated Video Playback Guide
#1
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)


Code:
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
cmake -DENABLE_VP9D=ON -DRKPLATFORM=ON -DENABLE_AVSD=OFF -DENABLE_H263D=OFF -DENABLE_H264D=ON -DENABLE_H265D=ON -DENABLE_MPEG2D=ON -DENABLE_MPEG4D=ON -DENABLE_VP8D=ON -DENABLE_JPEGD=OFF -DHAVE_DRM=ON
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
./bootstrap.py
./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.
#2
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.
#3
Why there is no such solution for every distro for Rock64?


Possibly Related Threads…
Thread Author Replies Views Last Post
  RockPro64 linux console video mode callegar 0 822 09-06-2022, 02:32 PM
Last Post: callegar
  Video playback hiccups with Fedora 35 on RockPro64 whitecat23 4 3,451 02-01-2022, 03:35 PM
Last Post: whitecat23
  WORKING: GPU-accelerated Widevine Chromium for Ubuntu 64 twilite 0 1,629 09-13-2021, 11:02 AM
Last Post: twilite
  Netflix with hardware acceleration not working Helium75 1 2,790 12-15-2019, 09:26 AM
Last Post: Helium75
Information [archived] 0.8.X images from ayufan; Mate DE + video / 3d acceleration Luke 28 34,996 05-18-2019, 02:03 PM
Last Post: rickard
  Grabbing screenshot while hardware decoding StefanRvO 0 1,633 05-16-2019, 09:01 AM
Last Post: StefanRvO
  hardware pwm pins Mentaluproar 1 2,844 02-24-2019, 02:09 AM
Last Post: tllim
  Video playing Faster NightCrawler504 8 9,098 12-07-2018, 09:50 AM
Last Post: fosf0r
  Hardware Graphics Accelerator RuslanGennadievich 1 2,625 09-25-2018, 02:43 AM
Last Post: dukla2000

Forum Jump:


Users browsing this thread: 1 Guest(s)