Well unsure where to post it, but since it’s actually more about using what exists i will post it here.
Since Debian is stretch and only have gstreamer 1.10 (which is not enough for gstreamer-rockchip which require >=1.12) and I have failed at building gstreamer (maybe some library links broken after all) here is a guide how to to do it with Ubuntu Server we have.
Gstreamer can be fullscreen and windowed, mpv only fullscreen.
Preparation:
-
I’m gonna install full Desktop (but using mpv should be possible even without Desktop, because mpv will be anyway only Fullscreen). To do this do
sudo su
apt-get update && apt-get upgrade && unminimize && reboot
, then after it’s rebooted install Desktop you prefer (aka, Ubuntu Mate), after Armbian i prefer xfce4 (which I’m gonna install). Do thisapt-get install xfce4 xfce4-goodies
thenreboot
.
After this you still will boot in console, from there you have two options, or use root as default user or just default user. Since most of times you will still need root to do most things I use first choice (if you prefer second skip next command).sudo su
startx
. After this you will boot in xfce4 environment (if you choose to use just default user from there you will need to add sudo to each command, or do sudo su in terminal window where you type all this) -
Additional steps:
To use network share you will need to doapt-get install samba gvfs-*
. To get default (in Application start menu) shortcuts to work you will need to generate all locales.
To do this dodpkg-reconfigure locales
, then selectAll locales
then select your own locale (most likely en_US.UTF-8 UTF-8). -
Now time to get all necessary libraries.
Do
apt-get install libqt5opengl5 libqt5qml5 libqt5quick5 libqt5widgets5 libqt5gui5 libqt5core5a qml-module-qtquick2 libqt5multimedia5 libqt5multimedia5-plugins libqt5multimediaquick-p5 qtmultimedia5-examples qtmultimedia5-doc-html pkg-config gcc make git unzip wget xz-utils cmake devscripts equivs build-essential docutils-common mercurial cmake-curses-gui yasm mercurial gcc-arm-linux-gnueabi
g++-arm-linux-gnueabi
texinfo nasm automake gstreamer1.0-tools qtgstreamer-plugins-qt5 gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-plugins-good gstreamer1.0-plugins-base gstreamer1.0-plugins-base-apps glib-2.0 libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgtk2.0-dev libperl-dev libglib2.0-dev jack libass-dev libfdk-aac-dev fdkaac aac-enc libfdk-aac1 autoconf automake git-core libfreetype6-dev libsdl2-dev libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev zlib1g-dev libx264-dev libx265-dev libnuma-dev libvpx-dev libmp3lame-dev libopus-dev mc locate libghc-bzlib-dev speex libspeex-dev alsa gstreamer1.0-alsa libssl-dev
-
Time to download all necessary apps. Do
mkdir video && cd video && git clone -b master https://github.com/rockchip-linux/libmali && git clone https://github.com/rockchip-linux/mpp && git clone -b master https://github.com/rockchip-linux/gstreamer-rockchip && git clone https://github.com/rockchip-linux/gstreamer-rockchip-extra && git clone https://github.com/mpv-player/mpv-build && git clone -b master https://github.com/FFmpeg/FFmpeg && git clone -b master https://github.com/mpv-player/mpv && git -C aom pull 2> /dev/null || git clone --depth 1 https://aomedia.googlesource.com/aom && mkdir aom_build -
We need to patch drm_fourcc.h to be able to play 10bits video, to do this do
find /usr/include/ -name drm_fourcc.h -exec sed -i "143 i #define DRM_FORMAT_NV12_10\ fourcc_code('N', 'A', '1', '2') /* 2x2 subsampled Cr:Cb plane */\n#define DRM_FORMAT_NV21_10 fourcc_code('N', 'A', '2', '1') /* 2x2 subsampled Cb:Cr plane */\n#define DRM_FORMAT_NV16_10 fourcc_code('N', 'A', '1', '6') /* 2x1 subsampled Cr:Cb plane */\n#define DRM_FORMAT_NV61_10 fourcc_code('N', 'A', '6', '1') /* 2x1 subsampled Cb:Cr plane */\n#define DRM_FORMAT_NV24_10 fourcc_code('N', 'A', '2', '4') /* non-subsampled Cr:Cb plane */\n#define DRM_FORMAT_NV42_10 fourcc_code('N', 'A', '4', '2') /* non-subsampled Cb:Cr plane */" {} +
- Next step is to add all this codes to gstreamer-rockchip (we have them here, why don’t add them for gstreamer too?)
find ./gstreamer-rockchip -name rkx_kmsutils.c -exec sed -i "67 i \ DEF_FMT (NV21_10, P010_10LE),\n DEF_FMT (NV21_10, P010_10LE),\n DEF_FMT (NV16_10, P010_10LE),\n DEF_FMT (NV61_10, P010_10LE),\n DEF_FMT (NV24_10, P010_10LE),\n DEF_FMT (NV42_10, P010_10LE),\n" {} +
find ./gstreamer-rockchip-extra -name rkx_kmsutils.c -exec sed -i "64 i \ DEF_FMT (NV21_10, P010_10LE),\n DEF_FMT (NV21_10, P010_10LE),\n DEF_FMT (NV16_10, P010_10LE),\n DEF_FMT (NV61_10, P010_10LE),\n DEF_FMT (NV24_10, P010_10LE),\n DEF_FMT (NV42_10, P010_10LE),\n" {} +
find ./gstreamer-rockchip-extra -name gstkmsutils.c -exec sed -i "64 i \ DEF_FMT (NV21_10, P010_10LE),\n DEF_FMT (NV21_10, P010_10LE),\n DEF_FMT (NV16_10, P010_10LE),\n DEF_FMT (NV61_10, P010_10LE),\n DEF_FMT (NV24_10, P010_10LE),\n DEF_FMT (NV42_10, P010_10LE),\n" {} +
Now all preparation are completed.
- To build gstreamer do this:
cd libmali && cmake CMakeLists.txt && make -j6 && make install && ldconfig && LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib && LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/include && cd ../mpp && cmake -DRKPLATFORM=ON -DHAVE_DRM=ON && make -j6 && make install && cd ../gstreamer-rockchip && ./autogen.sh && make -j6 && make install && ldconfig && cd ../gstreamer-rockchip-extra && ./autogen.sh && make clean && make -j6 && make install && ldconfig && cd ..
- To test result
gst-inspect-1.0 --gst-plugin-path=/usr/local/lib/gstreamer-1.0 rkximage
Expected output:
Plugin Details:
Name rkximage
Description Rockchip X/DRM Video Sink
Filename /usr/local/lib/gstreamer-1.0/libgstrkximage.so
Version 1.1.0
License GPL
Source module gstreamer-rockchip-extra
Binary package GStreamer Plug-ins source release
Origin URL Unknown package originrkximagesink: Video sink
1 features:
±- 1 elements
-
to use gst-play-1.0 you will need to do
gst-play-1.0 --gst-plugin-path=/usr/local/lib/gstreamer-1.0 --videosink=rkximagesink <videofile>
-
to use QT player you will need to do this command
env GST_PLUGIN_PATH=/usr/local/lib/gstreamer-1.0 QT_GSTREAMER_WIDGET_VIDEOSINK=rkximagesink /usr/lib/aarch64-linux-gnu/qt5/examples/multimediawidgets/player/player
This will start player which can be also fullscreen -
Now about ffmpeg+mpv. First we gonna install everything mpv wanna see to do this do
cd mpv-build && mk-build-deps -s -i && dpkg --unpack *.deb && apt-get install -f -y && cd ..
- For most complete installation of ffmpeg i will include aom in it, so to build ffmpeg we first need to build aom. To do this do
cd aom_build && cmake -G "Unix Makefiles" ../aom && make -j6 && make install && cd ..
- Now to ffmpeg. To build ffmpeg do this (this will take a bit of time)
first this
./configure \
--
arch="
aarch64"
\
--
extra-libs="-Lpthread -Lm" \
--
disable-debug \
--
enable-libaom \
--
enable-stripping \
--
enable-gpl \
--
enable-nonfree \
--
enable-logging \
--
disable-doc \
--
enable-pic \
--
enable-optimizations \
--
enable-ffmpeg \
--
enable-avdevice \
--
enable-avcodec \
--
enable-avformat \
--
enable-swscale \
--
enable-postproc \
--
enable-avfilter \
--
disable-devices \
--
enable-pthreads \
--
disable-w32threads \
--
enable-network \
--
disable-gnutls \
--
disable-gray \
--
enable-swscale-alpha \
--
disable-small \
--
enable-dct \
--
enable-fft \
--
enable-mdct \
--
enable-rdft \
--
disable-crystalhd \
--
disable-vaapi \
--
disable-vdpau \
--
enable-rkmpp \
--
enable-libdrm \
--
enable-version3 \
--
enable-runtime-cpudetect \
--
enable-hardcoded-tables \
--
enable-encoder=ac3 \
--
enable-encoder=aac \
--
enable-encoder=wmav2 \
--
enable-encoder=mjpeg \
--
enable-encoder=png \
--
enable-hwaccels \
--
enable-muxer=spdif \
--
enable-muxer=adts \
--
enable-muxer=asf \
--
enable-muxer=ipod \
--
enable-muxer=mpegts \
--
enable-demuxers \
--
enable-parsers \
--
enable-bsfs \
--
enable-filters \
--
enable-bzlib \
--
enable-libspeex \
--
enable-libx264 \
--
enable-libx265 \
--
enable-zlib \
--
enable-asm \
--
enable-neon \
--
enable-libass \
--
enable-libfdk-aac \
--
enable-libfreetype \
--
enable-libmp3lame \
--
enable-libopus \
--
enable-libvorbis \
--
enable-libvpx \
--
enable-openssl
then make -j6 && make install && ldconfig && cd ..
- Now only mpv left. To build mpv do this
cd mpv && wget -q --show-progress --no-use-server-timestamps http://www.freehackers.org/~tnagy/release/waf-2.0.13 && mv waf-* waf && chmod u+x waf && ./waf configure --enable-egl-drm && ./waf build -j6 && ./waf install && ldconfig && cd …
- With this you should have gstreamer and mpv. Now we need to create shortcuts (so there will be no need to type commands over and over again). To do this do:
For mpv
rm /usr/local/share/applications/mpv.desktop
echo "
[Desktop Entry]
Type=Application
Name=MPV
Icon=mpv
Exec=mpv --hwdec=rkmpp --vo=gpu --gpu-api=opengl --gpu-context=drm – %f
Icon=/usr/share/icons/gnome/48x48/categories/applications-multimedia.png
Terminal=true
Categories=AudioVideo;Audio;Player;Video;TV;
MimeType=application/ogg;application/x-ogg;application/mxf;application/sdp;application/smil;application/x-smil;application/streamingmedia;application/x-streamingmedia;application/vnd.rn-realmedia;application/vnd.rn-realmedia-vbr;audio/aac;audio/x-aac;audio/vnd.dolby.heaac.1;audio/vnd.dolby.heaac.2;audio/aiff;audio/x-aiff;audio/m4a;audio/x-m4a;application/x-extension-m4a;audio/mp1;audio/x-mp1;audio/mp2;audio/x-mp2;audio/mp3;audio/x-mp3;audio/mpeg;audio/mpeg2;audio/mpeg3;audio/mpegurl;audio/x-mpegurl;audio/mpg;audio/x-mpg;audio/rn-mpeg;audio/musepack;audio/x-musepack;audio/ogg;audio/scpls;audio/x-scpls;audio/vnd.rn-realaudio;audio/wav;audio/x-pn-wav;audio/x-pn-windows-pcm;audio/x-realaudio;audio/x-pn-realaudio;audio/x-ms-wma;audio/x-pls;audio/x-wav;video/mpeg;video/x-mpeg2;video/x-mpeg3;video/mp4v-es;video/x-m4v;video/mp4;application/x-extension-mp4;video/divx;video/vnd.divx;video/msvideo;video/x-msvideo;video/ogg;video/quicktime;video/vnd.rn-realvideo;video/x-ms-afs;video/x-ms-asf;audio/x-ms-asf;application/vnd.ms-asf;video/x-ms-wmv;video/x-ms-wmx;video/x-ms-wvxvideo;video/x-flic;video/fli;video/x-flc;video/flv;video/x-flv;video/x-theora;video/x-theora+ogg;video/x-matroska;video/mkv;audio/x-matroska;application/x-matroska;video/webm;audio/webm;audio/vorbis;audio/x-vorbis;audio/x-vorbis+ogg;video/x-ogm;video/x-ogm+ogg;application/x-ogm;application/x-ogm-audio;application/x-ogm-video;application/x-shorten;audio/x-shorten;audio/x-ape;audio/x-wavpack;audio/x-tta;audio/AMR;audio/ac3;audio/eac3;audio/amr-wb;video/mp2t;audio/flac;audio/mp4;application/x-mpegurl;video/vnd.mpegurl;application/vnd.apple.mpegurl;audio/x-pn-au;video/3gp;video/3gpp;video/3gpp2;audio/3gpp;audio/3gpp2;video/dv;audio/dv;audio/opus;audio/vnd.dts;audio/vnd.dts.hd;audio/x-adpcm;application/x-cue;audio/m3u;
X-KDE-Protocols=ftp,http,https,mms,rtmp,rtsp,sftp,smb"
> /usr/local/share/applications/mpv.desktop
For gst-play-1.0
echo "
[Desktop Entry]
Type=Application
Name=gst-play
Icon=mpv
Exec=gst-play-1.0 --gst-plugin-path=/usr/local/lib/gstreamer-1.0 --videosink=rkximagesink – %f
Icon=/usr/share/icons/gnome/48x48/categories/applications-multimedia.png
Terminal=true
Categories=Qt;AudioVideo;Player;Video;
MimeType=application/ogg;application/x-ogg;application/mxf;application/sdp;application/smil;application/x-smil;application/streamingmedia;application/x-streamingmedia;application/vnd.rn-realmedia;application/vnd.rn-realmedia-vbr;audio/aac;audio/x-aac;audio/vnd.dolby.heaac.1;audio/vnd.dolby.heaac.2;audio/aiff;audio/x-aiff;audio/m4a;audio/x-m4a;application/x-extension-m4a;audio/mp1;audio/x-mp1;audio/mp2;audio/x-mp2;audio/mp3;audio/x-mp3;audio/mpeg;audio/mpeg2;audio/mpeg3;audio/mpegurl;audio/x-mpegurl;audio/mpg;audio/x-mpg;audio/rn-mpeg;audio/musepack;audio/x-musepack;audio/ogg;audio/scpls;audio/x-scpls;audio/vnd.rn-realaudio;audio/wav;audio/x-pn-wav;audio/x-pn-windows-pcm;audio/x-realaudio;audio/x-pn-realaudio;audio/x-ms-wma;audio/x-pls;audio/x-wav;video/mpeg;video/x-mpeg2;video/x-mpeg3;video/mp4v-es;video/x-m4v;video/mp4;application/x-extension-mp4;video/divx;video/vnd.divx;video/msvideo;video/x-msvideo;video/ogg;video/quicktime;video/vnd.rn-realvideo;video/x-ms-afs;video/x-ms-asf;audio/x-ms-asf;application/vnd.ms-asf;video/x-ms-wmv;video/x-ms-wmx;video/x-ms-wvxvideo;video/x-flic;video/fli;video/x-flc;video/flv;video/x-flv;video/x-theora;video/x-theora+ogg;video/x-matroska;video/mkv;audio/x-matroska;application/x-matroska;video/webm;audio/webm;audio/vorbis;audio/x-vorbis;audio/x-vorbis+ogg;video/x-ogm;video/x-ogm+ogg;application/x-ogm;application/x-ogm-audio;application/x-ogm-video;application/x-shorten;audio/x-shorten;audio/x-ape;audio/x-wavpack;audio/x-tta;audio/AMR;audio/ac3;audio/eac3;audio/amr-wb;video/mp2t;audio/flac;audio/mp4;application/x-mpegurl;video/vnd.mpegurl;application/vnd.apple.mpegurl;audio/x-pn-au;video/3gp;video/3gpp;video/3gpp2;audio/3gpp;audio/3gpp2;video/dv;audio/dv;audio/opus;audio/vnd.dts;audio/vnd.dts.hd;audio/x-adpcm;application/x-cue;audio/m3u;"
> /usr/share/applications/gst-player.desktop
For QT player
For QT player
echo "
[Desktop Entry]
Type=Application
Name=QT-play
Icon=mpv
Exec=env GST_PLUGIN_PATH=/usr/local/lib/gstreamer-1.0 QT_GSTREAMER_WIDGET_VIDEOSINK=rkximagesink /usr/lib/aarch64-linux-gnu/qt5/examples/multimediawidgets/player/player %f
Icon=/usr/share/icons/gnome/48x48/categories/applications-multimedia.png
Terminal=true
Categories=Qt;AudioVideo;Player;Video;
MimeType=application/ogg;application/x-ogg;application/mxf;application/sdp;application/smil;application/x-smil;application/streamingmedia;application/x-streamingmedia;application/vnd.rn-realmedia;application/vnd.rn-realmedia-vbr;audio/aac;audio/x-aac;audio/vnd.dolby.heaac.1;audio/vnd.dolby.heaac.2;audio/aiff;audio/x-aiff;audio/m4a;audio/x-m4a;application/x-extension-m4a;audio/mp1;audio/x-mp1;audio/mp2;audio/x-mp2;audio/mp3;audio/x-mp3;audio/mpeg;audio/mpeg2;audio/mpeg3;audio/mpegurl;audio/x-mpegurl;audio/mpg;audio/x-mpg;audio/rn-mpeg;audio/musepack;audio/x-musepack;audio/ogg;audio/scpls;audio/x-scpls;audio/vnd.rn-realaudio;audio/wav;audio/x-pn-wav;audio/x-pn-windows-pcm;audio/x-realaudio;audio/x-pn-realaudio;audio/x-ms-wma;audio/x-pls;audio/x-wav;video/mpeg;video/x-mpeg2;video/x-mpeg3;video/mp4v-es;video/x-m4v;video/mp4;application/x-extension-mp4;video/divx;video/vnd.divx;video/msvideo;video/x-msvideo;video/ogg;video/quicktime;video/vnd.rn-realvideo;video/x-ms-afs;video/x-ms-asf;audio/x-ms-asf;application/vnd.ms-asf;video/x-ms-wmv;video/x-ms-wmx;video/x-ms-wvxvideo;video/fli;video/x-flc;video/flv;video/x-flv;video/x-theora;video/x-theora+ogg;video/x-matroska;video/mkv;audio/x-matroska;application/x-matroska;video/webm;audio/webm;audio/vorbis;audio/x-vorbis;audio/x-vorbis+ogg;video/x-ogm;video/x-ogm+ogg;application/x-ogm;application/x-ogm-audio;application/x-ogm-video;application/x-shorten;audio/x-shorten;audio/x-ape;audio/x-wavpack;audio/x-tta;audio/AMR;audio/ac3;audio/eac3;audio/amr-wb;video/mp2t;audio/flac;audio/mp4;application/x-mpegurl;video/vnd.mpegurl;application/vnd.apple.mpegurl;audio/x-pn-au;video/3gp;video/3gpp;video/3gpp2;audio/3gpp;audio/3gpp2;video/dv;audio/dv;audio/opus;audio/vnd.dts;audio/vnd.dts.hd;audio/x-adpcm;application/x-cue;audio/m3u;"
> /usr/local/share/applications/qt-player.desktop
Now we should have 3 players that can do up to 4k60fps VP9.
Notice: Not of the player support xvid videos. For xvid video you will need to use mpv --vo=x11 <videofile>
to get decent picture
To play any youtube file you will need to install youtube-dl with this command
wget https://yt-dl.org/latest/youtube-dl -O /usr/local/bin/youtube-dl
chmod a+x /usr/local/bin/youtube-dl
hash -r
Then do
mpv --hwdec=rkmpp --vo=gpu --gpu-api=opengl --gpu-context=drm <URL>
Then (depends on your network), wait a bit, while video loading. This will load best video and best sound. I.e. in high resolution and bitrate
Update: fixed wrong "
, '
– since forum changed them from "
to “” and ’ to ‘’ and --
to –
Upate 2: added support command for youtube 4k with mpv