Accelerated H.264 and HEVC video decoding with Cedrus
#1
Starting with Kernel 3.10.65-2-pine64-longsleep-43 the media modules are included. This means one could use the hardware video engine on the SoC. So i felt why not try it - and surprisingly it worked Smile.

Pine64 decodes 1080p H.264 and HEVC just fine and smooth with Cedrus from linux-sunxi community.

You can do it yourself following the Cedrus build instructions on http://linux-sunxi.org/Cedrus

HEVC bbb-1920x1080-cfg02.mkv
Code:
MPlayer 1.2.1 (Debian), built with gcc-5.3.1 (C) 2000-2016 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing bbb-1920x1080-cfg02.mkv.
libavformat version 56.40.101 (external)
libavformat file format detected.
[lavf] stream 0: video (hevc), -vid 0
[lavf] stream 1: audio (aac), -aid 0
VIDEO:  [HEVC]  1920x1080  0bpp  60.000 fps    0.0 kbps ( 0.0 kbyte/s)
Clip info:
encoder: libebml v1.3.0 + libmatroska v1.4.1
creation_time: 2014-04-22 08:46:13
Load subtitles in ./
[VDPAU SUNXI] VE version 0x1689 opened
[VDPAU SUNXI] OSD disabled!
==========================================================================
Forced video codec: ffmpeg12vdpau
Forced video codec: ffh264vdpau
Forced video codec: ffhevcvdpau
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
libavcodec version 56.60.100 (external)
Selected video codec: [ffhevcvdpau] vfm: ffmpeg (FFmpeg HEVC / H.265 (VDPAU))
==========================================================================
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 48000 Hz, 6 ch, floatle, 0.0 kbit/0.00% (ratio: 0->1152000)
Selected audio codec: [ffaac] afm: ffmpeg (FFmpeg AAC (MPEG-2/MPEG-4 Audio))
==========================================================================
AO: [pulse] Init failed: Connection refused
Failed to initialize audio driver 'pulse'
AO: [alsa] 48000Hz 2ch floatle (4 bytes per sample)
Starting playback...
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
VO: [vdpau] 1920x1080 => 1920x1080 HEVC VDPAU acceleration
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
VO: [vdpau] 1920x1080 => 1920x1080 HEVC VDPAU acceleration
A:   1.9 V:   0.8 A-V:  1.089 ct:  0.056   0/  0 86% 135%  7.5% 50 0


H.264 big_buck_bunny_1080p_H264_AAC_25fps_7200K.MP4
Code:
MPlayer 1.2.1 (Debian), built with gcc-5.3.1 (C) 2000-2016 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing big_buck_bunny_1080p_H264_AAC_25fps_7200K.MP4.
libavformat version 56.40.101 (external)
libavformat file format detected.
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fb6fd8688]Protocol name not provided, cannot determine if input is local or a network protocol, buffers and access patterns cannot be configured optimally without knowing the protocol
[lavf] stream 0: video (h264), -vid 0
[lavf] stream 1: audio (aac), -aid 0, -alang und
VIDEO:  [H264]  1920x1080  24bpp  25.000 fps  7254.9 kbps (885.6 kbyte/s)
Clip info:
major_brand: mp42
minor_version: 1
compatible_brands: isommp423gp5
creation_time: 2011-08-04 01:51:12
title: big_buck_bunny_1080p_surround.avi_006.AVI.MP4
artist: created with SUPER(C).v2011.bld.49
encoder: eRightSoft
comment: 09:51:32
Load subtitles in ./
[VDPAU SUNXI] VE version 0x1689 opened
[VDPAU SUNXI] OSD disabled!
==========================================================================
Forced video codec: ffmpeg12vdpau
Forced video codec: ffh264vdpau
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
libavcodec version 56.60.100 (external)
Selected video codec: [ffh264vdpau] vfm: ffmpeg (FFmpeg H.264 (VDPAU))
==========================================================================
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 44100 Hz, 2 ch, floatle, 96.1 kbit/3.40% (ratio: 12009->352800)
Selected audio codec: [ffaac] afm: ffmpeg (FFmpeg AAC (MPEG-2/MPEG-4 Audio))
==========================================================================
AO: [pulse] Init failed: Connection refused
Failed to initialize audio driver 'pulse'
AO: [alsa] 44100Hz 2ch floatle (4 bytes per sample)
Starting playback...
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
VO: [vdpau] 1920x1080 => 1920x1080 H.264 VDPAU acceleration
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
VO: [vdpau] 1920x1080 => 1920x1080 H.264 VDPAU acceleration
A:   7.5 V:   6.7 A-V:  0.776 ct:  0.071   0/  0 60% 42%  1.4% 50 0


Pine64 SoC temperature is stable at around 70C while decoding HEVC 1080p (without a heat sink, no enclosure).

For easy mplayer launches with the correct parameters feel free to use https://github.com/longsleep/build-pine6...er-play.sh


I will not support this overly much, but it confirms that the BSP Kernel has everything which is needed to use the media decoder in the Pine64.

Cheers
Simon
#2
This is a development that may please a lot of people, thank you for your efforts.
#3
(03-12-2016, 01:27 PM)longsleep Wrote: Starting with Kernel 3.10.65-2-pine64-longsleep-43 the media modules are included. This means one could use the hardware video engine on the SoC. So i felt why not try it - and surprisingly it worked Smile.
Yes, because Jens Kuske (jemk) has done the job, required for supporting Allwinner A64 - https://github.com/linux-sunxi/libvdpau-...e85f2c97c7 Wink
And it reused a lot of the earlier Allwinner H3 related code, that's why the Allwinner A64 patch is so small.
#4
(03-12-2016, 01:27 PM)longsleep Wrote: Pine64 SoC temperature is stable at around 70C while decoding HEVC 1080p.

For easy mplayer launches with the correct parameters feel free to use https://github.com/longsleep/build-pine6...er-play.sh

You should add that your Pine64+ is not even wearing a heatsink Smile

If you would spend the 50 Cent for an el cheapo heatsink then the temperature would be below 60°C already.

BTW: Using VDPAU you can then also use VLC (2.2.0 or above, no support for HEVC currently) or mpv to watch video HW accelerated (also in a desktop environment).
#5
(03-12-2016, 02:00 PM)Andrew2 Wrote: You should add that your Pine64+ is not even wearing a heatsink Smile

If you would spend the 50 Cent for an el cheapo heatsink then the temperature would be below 60°C already.

Done. I also forgot to mention that this temperature was HEVC 1080p@60FPS. Decoding spreed-1080p.mkv which is HEVC 1080p@29.97FPS is 55-60C around 65C (again without heat-sink).

(03-12-2016, 02:00 PM)Andrew2 Wrote: BTW: Using VDPAU you can then also use VLC (2.2.0 or above, no support for HEVC currently) or mpv to watch video HW accelerated (also in a desktop environment).

I tried VLC (from Ubuntu Xenial repository) and it does freeze with H.264 after a couple of seconds - so for now mplayer it is.
#6
(03-12-2016, 03:33 PM)longsleep Wrote: I tried VLC (from Ubuntu Xenial repository) and it does freeze with H.264 after a couple of seconds - so for now mplayer it is.

In Armbian we include an own mpv package since a few days:

Code:
tk@bananapi:~$ mpv --version
mpv 0.16.0-git-9d2980d (C) 2000-2016 mpv/MPlayer/mplayer2 projects
built on Sat Mar  5 16:11:21 EET 2016
ffmpeg library versions:
  libavutil       55.17.103
  libavcodec      57.24.102
  libavformat     57.25.100
  libswscale      4.0.100
  libavfilter     6.31.100
  libswresample   2.0.101
ffmpeg version: n3.0

I just tried it out with a desktop/GUI build for the old slow dual core A20, connected an USB disk that was lying around, double clicked a huge .mp4 and to my surprise even this 1080p/H.264 file was played absolutely smoothly on this old board. I will try to build a .deb for Pine64 the next days and post a link.
#7
(03-12-2016, 01:58 PM)ssvb Wrote:
(03-12-2016, 01:27 PM)longsleep Wrote: Starting with Kernel 3.10.65-2-pine64-longsleep-43 the media modules are included. This means one could use the hardware video engine on the SoC. So i felt why not try it - and surprisingly it worked Smile.
Yes, because Jens Kuske (jemk) has done the job, required for supporting Allwinner A64 - https://github.com/linux-sunxi/libvdpau-...e85f2c97c7 Wink
And it reused a lot of the earlier Allwinner H3 related code, that's why the Allwinner A64 patch is so small.

Thanks to jemk and longsleep.
... TL Lim
#8
Hi,
I'm really a n00b with this stuff, but I need to run RTMP stream smoothly on Pine64+ 2GB
Any suggestions how can I do this?
I've tried with mplayer, mpv, cvlc, and all of them are really slow, dropping frames and such.
I suppose any of them isn't HW accelerated?

Thanks! Smile

EDIT:
And I've tried to install vdpau, pixman and all dependencies.
And every time I get this error when trying to make and make install "libvdpau-sunxi": 
Code:
fatal error:"pixman.h: No such file or directory"

Any idea what's wrong? Thanks!
#9
I am probably stating the obvious but you are missing 'pixman.h' in the include path.
#10
(04-11-2016, 01:38 PM)longsleep Wrote: I am probably stating the obvious but you are missing 'pixman.h' in the include path.

Ye, kinda solved that.
But now when I try to play I get that this is missing: libvdpau_nvidia.so


Possibly Related Threads…
Thread Author Replies Views Last Post
  Video wall? monty1 2 5,263 04-12-2017, 04:34 PM
Last Post: monty1
  pine64 accelerated jpeg decoding jacklau 1 4,509 01-12-2017, 01:12 AM
Last Post: Trizna
  Pine64 accelerated H.264 encoding hngjms 7 13,784 10-18-2016, 03:15 AM
Last Post: pfeerick
  The sunxi transform module is very slow, how to do video rotation? jacklau 0 2,639 09-19-2016, 12:24 AM
Last Post: jacklau
  Video encoding h.265/HEVC tomaThoma 1 6,457 07-02-2016, 11:35 PM
Last Post: tllim
  Question about video acceleration BringItOn 10 17,055 06-23-2016, 10:33 AM
Last Post: ssvb
  Linux accelerated graphics nomadewolf 1 4,810 12-29-2015, 11:26 PM
Last Post: tllim

Forum Jump:


Users browsing this thread: 3 Guest(s)