Jump to content

RK3328 Media Script (Rock64, Renegade)


Recommended Posts

Posted

THE MEDIA SCRIPT IS NOW DEPRECATED, IN FAVOR OF THE OFFICIAL MULTIMEDIA FRAMEWORK. PLEASE REFER TO THIS TOPIC:

 

 

And, for last,  the first version of:

The UN-official, UN-supported, UN-expected

RK3328 MEDIA TESTING SCRIPT

 

This is the first release of the RK3328 media testing script. The script provides a functionality similar to its RK3288/3399 equivalents, except for the OpenCL related stuff, which is not supported by the SoC. So it includes:

  • Installing all the libraries and system configurations necessary for GPU accelerated X desktop, Chromium WebGL, full VPU video play acceleration up to 4k@60 10-bit HEVC (the maximum supported by the SoC), and GLES 2.0 support.
  • Three video players supporting full VPU acceleration (RKMPP) and KMS display (GBM or a X11 DRM "hack", as described by the authors), namely: MPV, Gstreamer and Kodi.
  • A library that will act as an OpenGL to OpenGL-ES wrapper, allowing you to run programs that use OpenGL 1.5-2.0.
  • Two additional features, that have no big interest from the Armbian development prospective, but I find them interesting to play with:
    • Chromium browser with support for Flash and DRM-protected commercial web video streaming (tested with Amazon Prime, should also work with Netflix, Hulu, etc.),
    • and a simple Pulseaudio GTK equalizer using LADSPA.

 

Here is a more thorough documentation:

Spoiler


ARMBIAN UNOFFICIAL RK3328 MEDIA TESTING SCRIPT
----------------------------------------------
v1.0 Bionic - 2019/01/13


This script will install several multimedia-related software pieces in a
RK3328 Ubuntu Bionic Armbian desktop default image (kernel 4.4.y).
Currently it only supports the installation of the features, while
uninstall must be performed manually.

The script must be run in a command line from the same directory it was
unpacked (./media-rk3328.sh), and will ask for superuser privileges if
not launched with "sudo". Each subfolder contains, in addition to the
packages needed for installation, a text file with information about the
sources for those packages.

The script will present the user with a menu where they can select the
features to be installed. Here is a brief description of each option:

- System: This option will install the base libraries, X server packages
          and system files configuration. It must be run at least once
          before installing any of the other features, or after any
          system upgrade that modified X or Chromium configuration.
          Enabling system config will also present the user with the
          choice of two different versions of the Rockchip X server:
            · Glamor: The tweaked X server that you can download from 
              Rockchip repos, with a few additional tweaks. It will use
              Glamor for GPU acceleration, providing good 3D performance
              and complete vsync, but giving a very laggy experience in 
              general desktop usage.
            · Armsoc: An updated version of the xf86 Armsoc driver. It
              only supports fullscreen vsync, but on the other hand the
              overall desktop experience is much snappier.
           
- Devel: When this option is enabled, the script will install the 
         development libraries for every other option that is selected.
         So, for example, if in your first run of the script you keep 
         this option disabled and enable the rest, it will install all 
         the features but without any devel lib. If eventually you need,
         e.g., to compile some app requiring Gstreamer development libs,
         then you can run again the script, and select only "Devel" and
         "Gstreamer", so in that run it will only install Gstreamer with
         the development libraries, without touching the rest.
         
- MPV: This is a RKMPP accelerated version of MPV. In order to use the 
       hardware acceleration, it needs to make use of KMS for display,
       which means that it will ignore the X server if it is running,
       and play video in a full-screen overlay, using keyboard or LIRC
       to control the player. Type "man mpv" for a list of keyboard
       controls (tip: shift+Q will save position and exit).
       Alternatively, you can also use software decoding, and output to
       a X window with mouse support. It will still have some display
       acceleration through X11/EGL, though not as efficient as GBM/KMS.
         · To use the X, non-RKMPP version, just type "mpv <file>" in
           the console, or use the launcher labeled simply "MPV".
         . To use the GBM+RKMPP version, type "mpv-gbm <file>", or use
           the "MPV (GBM)" launcher.
         · You can use the player even in a console-only session.

- Gstreamer: These are the Rockchip Gstreamer plugins for media playback
             and capture.
             Notice that the Gstreamer plugin is the only method that
             allows full RKMMP+KMS acceleration associated to a X 
             window.
               · To play a video in a X session, use the launcher "Rock-
                 chip Gst Player".
               . From the command line, in a X session, type:
                 "gst-play-1.0 --videosink=rkximagesink <file>"
               . From a console-only session, type:
                 "gst-play-1.0 --videosink=kmssink <file>"

- GL4ES: An Opengl-ES wrapper library that will allow you to use OpenGL
         1.5-2.0 compatible programs with hardware acceleration. 
         More info: https://github.com/ptitSeb/gl4es.
         · In order to make it easier to use the library, we have
           included a script called "glrun", that will set the proper
           environment variables. Launch your OpenGL program like this:
           "glrun <command>"
         
- Streaming: This will install Chromium with the Widevine DRM and
             Pepper-Flash libraries enabled, allowing you to watch 
             videos from sites such as Netflix, Amazon Prime or Hulu.
             It will also install the h264ify addon, which will force
             all Youtube videos to use the H.264 codec.
             Since those libraries are only available for 32-bit ARM,
             the script will install a whole armhf docker container,
             with a minimal ubuntu and Chromium installation on it. It
             will also install a wrapper for running commands inside the
             docker container called "armhf-run":
               · Type "armhf-run chromium-browser" to launch the 32-bit
                 Chromium in regular mode.
               . Type "armhf-run chromium-streaming" to launch it in
                 streaming mode (may cause problems with non-streaming
                 webpages).
             The script will also install desktop entries for both 
             options.

- Equalizer: A GTK-based equalizer for PulseAudio, using LADSPA. You
             need to enable it through the menu entry, and select the
             desired preset or tweak your own settings. The "Boosted"
             preset is recommended for everyday use.
             This package is old and unmaintained, but I still find it
             useful.

- Kodi: Kodi 18.0 Leia rc4. This version is supposed to be stable
        enough for normal use. But the main purpose of including Kodi in
        the script is to test the new RKMPP+KMS implementation. We don't
        intend to offer a full-fledged distribution of Kodi. For that, I
        recommend using LibreELEC.
        It cannot be launched from an active X session, you need to
        switch to a virtual terminal and stop the X server first.
        · The "Kodi" desktop launcher will do the whole process for you.
        · From the command line, type: "kodi-gbm-wrapper".

All the RKMPP accelerated players should handle up to 4K@60 10-bit HEVC 
with perfect smoothness.	


Please report bugs and suggestions in the thread dedicated to this
script at the Armbian Forum. Enjoy!

JMCC.

 

 

 

 

>>> DOWNLOAD LINK <<<

 

Prerequisites:

You need a fresh Armbian Bionic desktop image with default kernel installed. 

 

Instructions:

  1. Download the file above
  2. Untar it: tar xvf media-rk3328_*.txz
  3. cd media-script
  4. ./media-rk3328.sh

 

Notes:

  • This script is not officially supported by the Armbian project. It is just a community effort to help the development of the main build, by experimenting with a possible implementation of the media capabilities of this particular SoC.
  • Therefore, questions about the script should not be laid out as support requests, but as commentaries or community peer-to-peer assistance.
  • That being said, all commentaries/suggestions/corrections are very welcome. In the same way, I will do my best to help solve any difficulty that may arise regarding the script.

 

Enjoy!

Posted

Some side notes:

  • In my tests, I have noticed that desktop in general feels quicker than RK3399, probably because the Armsoc driver is optimized for Mali 4x0. Remember to play full-screen for better video performance.
  • MPV and Gstreamer players seem to have some problems with certain HDR files, that Kodi handles perfectly. I still need to find the cause.
  • The 32-bit Chromium for streaming is supposed to be better optimized in this version than the previous RK3399 script. Though, since my poor Renegade has only 1Gb of RAM, I cannot test it extensively, because it crashes when I load something too heavy, likely because of lack of RAM. So feedback here is welcome.
  • JMCC pinned this topic
Posted
6 hours ago, JMCC said:

The 32-bit Chromium for streaming is supposed to be better optimized in this version than the previous RK3399 script. Though, since my poor Renegade has only 1Gb of RAM, I cannot test it extensively, because it crashes when I load something too heavy, likely because of lack of RAM. So feedback here is welcome. 

If you give a link and an indication that you need to check, I will try to check it on my models of TV boxes with rk3328 (2\16 and 4\32).

By the way , I added a link to this topic in the section where we discuss TV boxes rk3328, there are users with different models. If you need help with different tests, feel free to write instructions on what to do. :)

Posted

Congratulations, great job. :)

 

Quick check on MVR9
the browser now shows videos in full screen all up to 4K, the only limitation is the channel in the Internet.
MPV-also shows everything in full screen
KODI -  not yet started up, complains that it is impossible to create the GUI (this is not critical, KODI is LE, everything works)

I haven't checked the rest yet.

 

 

Posted
47 minutes ago, balbes150 said:

complains that it is impossible to create the GUI

Yes, I noticed that if you launch it just like "kodi", it won't start here, unlike the RK3399 where it worked.

 

The cause seems to be that "standard" mali midgard T86x binaries have the necessary GBM symbols that Kodi uses, while in the case of utgard 450 you need to use the specific binaries for GBM.

 

Solution: launch it in one of these two ways:

LD_LIBRARY_PATH=/opt/libmali-gbm kodi

or:

kodi-gbm-wrapper

 

Posted

Testing on A5X Max 4gb ram

ARMBIAN 5.67 user-built Ubuntu 18.04.1 LTS 4.4.154-rk3328-tv

Installed System, MPV, Gstreamer, GL4ES and Streaming from media-rk3328_1.0.txz

 

1. General desktop does not feel any smoother, feels quite laggy

2. Watching streaming video in firefox only good if window compositor off & certain encoding, can't determine which

3. Chromium streaming crashes page upon playing

4. glxgears - libGL error: unable to load driver: rockchip_dri.so

417 frames in 5.0 seconds = 83.309 FPS

glrun glxgears

297 frames in 5.0 seconds = 59.256 FPS

5. xorg log: (EE) AIGLX error: dlopen of /usr/lib/aarch64-linux-gnu/dri/armsoc_dri.so failed (/usr/lib/aarch64-linux-gnu/dri/armsoc_dri.so: cannot open shared object file: No such file or directory)

 

Posted

Where do you turn off window compositor?

 

I tried Armbian_5.71_Rk3328-tv_Ubuntu_bionic_default_4.4.154_desktop_20190115.img.xz(https://yadi.sk/d/DSO6euzB3ahemo/ARMBIAN/5.71/Armbian_5.71_Rk3328-tv_Ubuntu_bionic_default_4.4.154_desktop_20190115.img.xz) on MVR9 and installed the media script but

Moving windows around still have a lot of tearing and corruption and is not smooth.

MPV Player can't seem to detect external storage drives, but will use Gstreamer instead then.

Using Chromium browser 32-bit optimised for streaming, eg. Youtube loads very slowly with tearing and videos in a window or fullscreen is not watchable.

 

How do you run Kodi correctly, is there simple instructions to create a new shortcut with 'kodi-gbm-wrapper'?

It says it must kill the desktop to run then it boots to a command prompt to login.

 

On a clean install, the sound doesn't work, you must change the HDMI sound in the volume manager first, maybe just a small bug.

 

Is the script perhaps incompatible with the kernel used in this Armbian desktop image or something I'm doing wrong?

 

Thanks

Posted
2 hours ago, mo123 said:

Moving windows around still have a lot of tearing and corruption and is not smooth.

Try running the script again and selecting the second version of GLAMOUR drivers for x11 to install.

Posted
22 hours ago, amirul said:

Testing on A5X Max 4gb ram

I have for MVR9, browser and other programs (used in the script) are noticeably better than the MX10 (it's the same A5X max). Perhaps the reason is that another dtb is used, without optimization.

Posted
19 minutes ago, balbes150 said:

Try running the script again and selecting the second version of GLAMOUR drivers for x11 to install.

Thanks, I'll test again later.

Posted
48 minutes ago, balbes150 said:

I have for MVR9, browser and other programs (used in the script) are noticeably better than the MX10 (it's the same A5X max). Perhaps the reason is that another dtb is used, without optimization.

I use rk3328-evb.dtb thats in the image. Where can I download this optimised dtb that you speak of? :)

Posted
Just now, amirul said:

I use rk3328-evb.dtb thats in the image. Where can I download this optimised dtb that you speak of?

So far it is only a guess and there are no files.

Posted
1 hour ago, amirul said:

Which dtb do you use? 

MVR9 -> rk3328-box-trn9.dtb

MX10 -> rk3328-mx10.dtb

Just change the comment on the desired line:) by the way, MVR9 works with the file for MX10 (but no LAN Wifi BT). On the contrary-does not work, because MVR9 uses the best iron (similar to Renegade).

Perhaps the dtb from MVR9 will also work on Renegade

https://github.com/150balbes/Build-Armbian/blob/master/packages/bsp/rk3328-tv/extlinux.conf

Posted
17 hours ago, balbes150 said:

MVR9 -> rk3328-box-trn9.dtb

MX10 -> rk3328-mx10.dtb

Just change the comment on the desired line:) by the way, MVR9 works with the file for MX10 (but no LAN Wifi BT). On the contrary-does not work, because MVR9 uses the best iron (similar to Renegade).

Perhaps the dtb from MVR9 will also work on Renegade

https://github.com/150balbes/Build-Armbian/blob/master/packages/bsp/rk3328-tv/extlinux.conf

rk3328-box-trn9.dtb does not boot my box. Let me try the 5.71 image and see whether its any better

 

UPDATE: 5.71: rk3328-mx10.dtb, rk3328-evb.dtb boots to desktop, rk3328-box-trn9.dtb no

with armsoc xorg. glxgears 160 FPS, compositor off
Firefox video streaming some OK some not, with compositor off

Desktop sluggish

Posted

@balbes150

Can you make a Rk3328-tv_Ubuntu_bionic_default_desktop image that uses a 4.4.167 kernel like the default Armbian Rock64 image with working media script also included?

It seems the media script was made for this kernel and nightly Armbian images and 4.4.154 kernel is used in your images.

 

I tried again Armbian_5.71_Rk3328-tv_Ubuntu_bionic_default_4.4.154_desktop_20190115.img.xz

But before the media script install the desktop was running about 5 times faster and no tearing and slowness when moving windows.

Browser video playback still 3 times slower with the script installed then before.

I looked and armsoc driver is used after the script is installed.

I also changed etc/x11/* file to use glamor driver but then all windows of apps just have outlines and the inside of windows are just blank.

Apps also constantly close by itself like the browsers.

I changed default dtb from MX10 to mvr9 also.

Posted
57 minutes ago, mo123 said:

Can you make a Rk3328-tv_Ubuntu_bionic_default_desktop image that uses a 4.4.167 kernel like the default Armbian Rock64 image with working media script also included?


We are already working several months to adopt build system to be ready for such integration. Since there is very little help and huge demand from the community side, we are moving very slow.

Posted
6 hours ago, mo123 said:

But before the media script install the desktop was running about 5 times faster and no tearing and slowness when moving windows.

Yes, actually "Desktop acceleration" means here "Desktop GPU integration". Ironically, when using the X server, that very often means that the Desktop will be slower and laggier when "accelerated". It even happens on my desktop Intel Core i7 computer :). It's a fault of the terribly outdated X protocol; just imagine all Windows 10 graphic stack was running on top of the Windows 3.1 graphic system: that's something similar to what we are doing today in Linux.

 

That is precisely the reason why Wayland appeared. Now it is getting more mature, and is without any doubt the future for Linux desktop in general. And even more in embedded systems, which don't support the full OpenGL API, but only a reduced version (OpenGL for Embedded Systems), designed basically to run Android and similar OSes. On the other hand, Wayland is much more similar to the Android graphics API, which is what those SoC's are designed for.

 

So, in short: X server sucks, even more when it comes down to acceleration, and even more when you want to perform that acceleration with a device that only supports OpenGL-ES (i.e. a Mali GPU). Right now, I'm working on Amlogic X acceleration, and I'm getting more and more convinced that we need to move to Wayland if we want to get serious about accelerated desktop.

Posted
10 hours ago, mo123 said:

Can you make a Rk3328-tv_Ubuntu_bionic_default_desktop image that uses a 4.4.167 kernel like the default Armbian Rock64 image with working media script also included?

https://yadi.sk/d/3dNcIyJC_Pet6A

 

Only the reason is not in the core. By the way, with the kernel 4.4.154 by my tests, the system works faster with video. Perhaps because it uses sources from LE (where working with video is better optimized).

Posted
On 1/19/2019 at 5:48 PM, balbes150 said:

https://yadi.sk/d/3dNcIyJC_Pet6A

 

Only the reason is not in the core. By the way, with the kernel 4.4.154 by my tests, the system works faster with video. Perhaps because it uses sources from LE (where working with video is better optimized).

This seems to run much better. Noticed that cpu frequencies 1.39GHz and 1.51Ghz are available,  Although cpufreq-info reports that hardware limits: 408 MHz - 1.51 GHz, still can't hit 1.51GHz though

Posted
16 minutes ago, amirul said:

still can't hit 1.51GHz though

Did you edit  "/etc/default/cpufrequtils"?

Posted
6 hours ago, JMCC said:

Did you edit  "/etc/default/cpufrequtils"?

No. MAX_SPEED=1510000 was already in there.

Doing cpufreq-set -f 1.51GHz did not push to 1.5GHz either, only to 1.39Ghz

 

EDIT: changed MAX_SPEED=1510000 to MAX_SPEED=1512000 then can hit 1.51GHz

refer to

 

Posted

Thanks for working on this JMCC!

 

I have tested 1.0 of this script on my 4 GB rock 64. The script successfully got the X driver installed so that OGLES works accelerated by the Mali driver under Armbian bionic but I was unable to get any of the video players to work properly, at 4K anyway.

 

Does playback of 4K h264 videos @4K res work on the renegade with mpv-gbm because it doesn't on the rock64? r64 4k playback with mpv-gbm only works when output at 1080/FullHD. Trying to play 4K @4K results in very jerky playback and lots or horizontal green bars so this limitation should be added to the README / 1st post here. Did you say elsewhere that 4K playback with mpv is possible under Wayland on RK3328? I'd love to see support for that added to this script or a guide to setting that up.

 

gstreamer, when ran like so:

 

$ gst-play-1.0 --videosink=rkximagesink video.mp4

 

Suffers the same issue as mpv-gbm - very jerky playback with lots of horizontal green bars. I also tried --videosink=kmssink from a VT but that complained about a missing library and so didn't work at all.

kodi-gbm-wrapper was the only kodi binary I could get to run of the 3 included in the kodi package this script installs but it is even more unstable than libreelec, crashing or rebooting after only a few seconds so I was unable to play any videos with kodi.

 

The first time I ran the script I ran it as a normal user because I hadn't read the readme. It seemed to be running OK at first but my screen went black (X crashed?) part way through installing the gstreamer stuff. I ran it again with the same options but as root and it completed fine.

 

I should note these results are with the armsoc driver, I have not tried the glamor driver yet. Does the choice of driver affect hw accelerated video playback? If so, I'd like to see ths added to the driver description in the installer and in the README. "vsync" doesn't mean anything to non graphics geeks.

 

I am using an official rock64 PSU and I have a heatsink on my r64 CPU.

Posted

I have tried the glamor driver now and its highly unstable on my rock64 4GB. It lasts less than 5 seconds after showing the XFCE desktop before it crashes.

Posted

I wonder if its the codec used by my MP4s thats causing problems? Could you give me the mediainfo output or a link to a 4K h264 video that plays fine (at 4K) for you under gstreamer rk3328 please JMCC? Ideally you'd also tell me how to transcode to the preferred format with ffmpeg or whatever too but I should be able to work that bit out if you don't know.

 

The h264 MP4 vids I'm trying to play play fine under Libreelec on the rock64 and under mpv on my laptop but I've never had libreelec (r64) run for more than 15m or so before it crashes or restarts. Overheating issues? Maybe my r64 is faulty or maybe ALL r64s are faulty? I have already attached a heatsink and I'm using an official PSU.

Posted

I got the glamor driver 'working' for long enough to test with gstreamer but it didn't work at all - it complained about a missing device so it definitely seems armsoc is the way to go for r64 users.

 

I also ran glmark2-es2 when running glamor and although it seemed to detect the driver, the framerate was rock bottom (geddit?), much lower than running with the llvmpipe software driver.

Posted

You recommend fullscreen playback for videos but it seems that both gst-launch-1.0 and gst-play-1.0 don't support proper fullscreen playback so we need to get something like totem working. I just tried running totem with the armsoc driver and this scripts gstreamer packages and when I try to start totem I get the error:

 

libGL error: unable to load driver: rockchip_dri.so

 

I have tried running totem prefixing it like so:

 

LD_LIBRARY_PATH=/opt/libmali-gbm:$LD_LIBRARY_PATH totem

 

but that didn't help, nor did creating a symbolic link from rockchip_dri.so to libmali.so

Posted

I would also like to thank JMCC for this script.  It is exactly what I need for my project.

 

I have also been testing this script on my Rock 64, and I am not experiencing any problems with the 4k playback.

 

Rock64, 4 GB version

Clean build of armbian bionic desktop from https://www.armbian.com/rock64/

Installation of the media script (I installed everything)

Installed libgstreamer1.0-dev

Installed gtk 2.0 and 3.0 ( a bunch of files!), thinking I needed these for full screen video.  I don't think this impacted the gst install, but I'm not sure.

ran update and upgrade

 

I can run

        gst-play-1.0 test.mp4

        gst-launch-1.0 playbin uri=file:///home/rock64/gs/test.mp4
            note the use of playbin.  This was key to getting it to work - see dma error notes below

I did not have to specify using rkximagesink.

 

I am using two test files, both of them mp4 files

      1920 x 1080 at 29.97 Hz, identified by ffmpeg as Video: h264 (Constrained Baseline), 23 seconds

      3840 x 2160 at 29.97 Hz, identified by ffmpeg as Video: h264 (High), 2 minutes 38 seconds (yes, a >500MB file)

 

Both videos run smoothly with no artifacts. 

I am not seeing any noticeable cpu heating after the 2+ minute video. (50 C before playing, 58 C after)

 

When played on a 1080p monitor

    both videos play full screen when I hide the ldxe panel

When played on a 4k monitor

   the 1080 video plays in a window

   the 4k video plays full screen

 

I can also compile a simple c++ file using a playbin construct. 

 

I should note that I saw a bunch of failures trying to build the gstreamer pipeline manually, both with gst-launch-1.0 and the c++ code
(it started throwing "gst_dmabuf_memory_get_fd" errors).  Using playbin seems to bypass all of this.

 

Hope this provides a clue.

 

 

 

Posted
17 hours ago, danboid said:

Does playback of 4K h264 videos @4K res work on the renegade with mpv-gbm because it doesn't on the rock64? r64 4k playback with mpv-gbm only works when output at 1080/FullHD. Trying to play 4K @4K results in very jerky playback and lots or horizontal green bars so this limitation should be added to the README / 1st post here. Did you say elsewhere that 4K playback with mpv is possible under Wayland on RK3328? I'd love to see support for that added to this script or a guide to setting that up.

 

You have the same problems as the MX10. But MVR9 these problems there.

 

 

Posted

Jeff R:

 

That's great to hear that you have got 4K playback working with gstreamer on the r64 but I need more info about your 4K h264 file. Last night I used handbrake to try converting some of my problematic videos to see if it would help. The h265 transcode showed less green horizontal lines than the different h264 file I created but playback was still problematic with both.

 

Could you please install mediainfo and run it on your 4K h264 file so I can see the full details and try to replicate them?

 

Thanks

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines