XUELK-AN-006: Video playing on i.MX6UL-based platforms

From DAVE Developer's Wiki
Jump to: navigation, search
Info Box
AXEL ULite-top.png Applies to AXEL ULite
SBC Lynx-top.png Applies to SBC Lynx

History

Version Date Notes
1.0.0 May 2017 First release

Introduction

As known, i.MX6UL SoC is not designed to implement rich complex user interfaces (UI), even though it integrates an LCD controller. However, even simple UIs might require playing some sort of low-resolution videos.

This application note describes some tests that were performed on an AXELULite-based platform to evaluate the capabilities and the performances of the i.MXUL when it comes to playing such videos. The test bed was based on Debian Jessie distribution, as described here.

gstreamer

Starting from original Debian root file system provided here, more packages need to be added for using the well known multimedia framework gstreamer

More info about gstreamer can be found here and on Github gstreamer server


We assume that network interface has been already configured as described on XUELK-AN-002: Running Debian distribution.

Adding gstreamer packages

It is possibile to install the complete gstreamer 1.0 suite (easy way to have the richest rfs configuration for gstreamer usage)

root@arm:~# apt-get install gstreamer1.0
Reading package lists... Done
Building dependency tree
Reading state information... Done
...
The following NEW packages will be installed:
...
  gstreamer1.0-clutter gstreamer1.0-doc gstreamer1.0-fluendo-mp3
  gstreamer1.0-gnonlin gstreamer1.0-gnonlin-dbg gstreamer1.0-gnonlin-doc
  gstreamer1.0-libav gstreamer1.0-libav-dbg gstreamer1.0-nice
  gstreamer1.0-packagekit gstreamer1.0-plugins-bad
  gstreamer1.0-plugins-bad-dbg gstreamer1.0-plugins-bad-doc
  gstreamer1.0-plugins-base gstreamer1.0-plugins-base-apps
  gstreamer1.0-plugins-base-dbg gstreamer1.0-plugins-base-doc
  gstreamer1.0-plugins-good gstreamer1.0-plugins-good-dbg
  gstreamer1.0-plugins-good-doc gstreamer1.0-plugins-ugly
  gstreamer1.0-plugins-ugly-dbg gstreamer1.0-plugins-ugly-doc
...
  usb-modeswitch usb-modeswitch-data usbmuxd va-driver-all x11-common
  x11-utils xkb-data
0 upgraded, 517 newly installed, 0 to remove and 32 not upgraded.
Need to get 252 MB of archives.
After this operation, 713 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y

as it's shown on installation log, apt-get asks for installing 713MB of additional packages. In case you are looking for a reduced space installation, you may need to select the minimum required packages for video decoding.

Tipically, it is enough to install:

gstreamer1.0-tools
gstreamer1.0-plugins-base
gstreamer1.0-plugins-good
gstreamer1.0-plugins-bad
gstreamer1.0-plugins-ugly
gstreamer1.0-videosink

but required packages are strictly related to the gstreamer pipeline invoked and what kind of video/audio stream want to be decoded.

gstreamer pipeline

The pipeline used is the easiest one for decoding a local file on rfs

gst-launch-1.0 -vvv playbin uri=file:///root/<local_filename> video-sink=fbdevsink

Test bed

  • iMX6UL cpu has 3 scaling frequencies availables requested by cpu load
root@arm:~# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
interactive
root@arm:~# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies 
198000 396000 528000
  • iMX6UL cpu is running at 528MHz when decoding
root@arm:~# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
528000
  • system DRAM is 256MB
  • lcd panel is 800x480

Results

Use case #1: MPEG4 640x360@24fps

  • file: BigBuckBunny_640x360.mp4
  • video: MPEG-4 video 4:2:0 @ 640x360 resolution
  • pipeline:
gst-launch-1.0 -vvv playbin uri=file:///root/video/BigBuckBunny_640x360.mp4 video-sink=fbdevsink
  • top process shows that cpu is running at 99%
top - 08:24:14 up  1:28,  2 users,  load average: 0.19, 0.18, 0.38
Tasks:  60 total,   1 running,  59 sleeping,   0 stopped,   0 zombie
%Cpu(s): 98.4 us,  1.3 sy,  0.0 ni,  0.0 id,  0.0 wa,  0.0 hi,  0.3 si,  0.0 st
KiB Mem:    247172 total,   244012 used,     3160 free,    30660 buffers
KiB Swap:        0 total,        0 used,        0 free.   123020 cached Mem

  PID USER      PR  NI    VIRT    RES    SHR S %CPU %MEM     TIME+ COMMAND
11998 root      20   0  121480  18880   6180 S 99.4  7.6   0:09.77 gst-launch-1.0
11997 root      20   0    2980   1068    756 R  0.7  0.4   0:00.20 top
    1 root      20   0   25840   2972   1880 S  0.0  1.2   0:14.17 systemd
    2 root      20   0       0      0      0 S  0.0  0.0   0:00.01 kthreadd
...

This is the reasonable maximum video resolution that can be fully decoded in software (this is due to iMX6UL absence of 3D hardware accelerator)

Use case #2: MPEG4 320x180@24fps

This use case is similar to the previous one, but the same video file has been scaled to 1/4 the original dimension (0.5 horizontal and 0.5 vertical)

  • file: BigBuckBunny_320x180.mp4
  • video: MPEG-4 video 4:2:0 @ 320x180 resolution
gst-launch-1.0 -vvv playbin uri=file:///root/video/BigBuckBunny_320x180.mp4 video-sink=fbdevsink
  • top process shows that cpu is running at 42%
top - 08:26:59 up  1:31,  2 users,  load average: 1.21, 0.68, 0.54
Tasks:  60 total,   1 running,  59 sleeping,   0 stopped,   0 zombie
%Cpu(s): 41.1 us,  1.7 sy,  0.0 ni, 57.2 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem:    247172 total,   243736 used,     3436 free,    30796 buffers
KiB Swap:        0 total,        0 used,        0 free.   125184 cached Mem

  PID USER      PR  NI    VIRT    RES    SHR S %CPU %MEM     TIME+ COMMAND
12004 root      20   0  121068  17116   6372 S 42.4  6.9   0:10.00 gst-launch-1.0
11997 root      20   0    2980   1068    756 R  0.7  0.4   0:01.29 top
   30 root      rt   0       0      0      0 S  0.3  0.0   0:03.86 cfinteractive
11610 root      20   0       0      0      0 S  0.3  0.0   0:02.05 kworker/0:0
...

This can be a more real use case where the cpu is partially devoted to video decoding and can perform the other usual tasks (graphics, user interaction, peripherals controls, etc.) without major impacts.

Demo on youtube

Video MPEG and QT5.9 running on i.MX6 UL