Jump to content

Moonlight Embedded on Orange Pi


Maor545

Recommended Posts

Hi, recently moonlight embedded has been added support for VDPAU. git repo

I tried to compile it with no success. Unfortunately I dont have enough knowledge to make it work.

I used Orange Pi one and armbian 5.30 legacy, getting error no video available and no VDPAU.

 

Does anybody managed to run moonlight on Orange Pi?

Link to comment
Share on other sites

I have succesfully installed few dependencies, so I am able to run cmake, but when running make, I have error:

[ 61%] Building C object CMakeFiles/moonlight.dir/src/video/ffmpeg_vaapi.c.o
/root/moonlight-embedded/src/video/ffmpeg_vaapi.c:23:33: fatal error: libavutil/hwcontext.h: No such file or directory
compilation terminated.
CMakeFiles/moonlight.dir/build.make:422: recipe for target 'CMakeFiles/moonlight.dir/src/video/ffmpeg_vaapi.c.o' failed
make[2]: *** [CMakeFiles/moonlight.dir/src/video/ffmpeg_vaapi.c.o] Error 1
CMakeFiles/Makefile2:68: recipe for target 'CMakeFiles/moonlight.dir/all' failed
make[1]: *** [CMakeFiles/moonlight.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

I tried to make empty hwconfig.h file and hwconfig_vaapi.h and got folowing error:

 

Quote

root@orangepione:~/moonlight-embedded/build# make
[ 38%] Built target moonlight-common
[ 59%] Built target gamestream
[ 61%] Building C object CMakeFiles/moonlight.dir/src/video/ffmpeg_vaapi.c.o
/root/moonlight-embedded/src/video/ffmpeg_vaapi.c:24:39: fatal error: libavutil/hwcontext_vaapi.h: No such file or directory
compilation terminated.
CMakeFiles/moonlight.dir/build.make:422: recipe for target 'CMakeFiles/moonlight.dir/src/video/ffmpeg_vaapi.c.o' failed
make[2]: *** [CMakeFiles/moonlight.dir/src/video/ffmpeg_vaapi.c.o] Error 1
CMakeFiles/Makefile2:68: recipe for target 'CMakeFiles/moonlight.dir/all' failed
make[1]: *** [CMakeFiles/moonlight.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
root@orangepione:~/moonlight-embedded/build# make
[ 38%] Built target moonlight-common
[ 59%] Built target gamestream
[ 61%] Building C object CMakeFiles/moonlight.dir/src/video/ffmpeg_vaapi.c.o
/root/moonlight-embedded/src/video/ffmpeg_vaapi.c: In function ‘va_get_format’:
/root/moonlight-embedded/src/video/ffmpeg_vaapi.c:32:25: warning: implicit declaration of function ‘av_hwframe_ctx_alloc’ [-Wimplicit-function-declaration]
   AVBufferRef* hw_ctx = av_hwframe_ctx_alloc(device_ref);
                         ^
/root/moonlight-embedded/src/video/ffmpeg_vaapi.c:32:25: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
/root/moonlight-embedded/src/video/ffmpeg_vaapi.c:38:3: error: unknown type name ‘AVHWFramesContext’
   AVHWFramesContext* fr_ctx = (AVHWFramesContext*) hw_ctx->data;
   ^
/root/moonlight-embedded/src/video/ffmpeg_vaapi.c:38:32: error: ‘AVHWFramesContext’ undeclared (first use in this function)
   AVHWFramesContext* fr_ctx = (AVHWFramesContext*) hw_ctx->data;
                                ^
/root/moonlight-embedded/src/video/ffmpeg_vaapi.c:38:32: note: each undeclared identifier is reported only once for each function it appears in
/root/moonlight-embedded/src/video/ffmpeg_vaapi.c:38:50: error: expected expression before ‘)’ token
   AVHWFramesContext* fr_ctx = (AVHWFramesContext*) hw_ctx->data;
                                                  ^
/root/moonlight-embedded/src/video/ffmpeg_vaapi.c:39:9: error: request for member ‘format’ in something not a structure or union
   fr_ctx->format = AV_PIX_FMT_VAAPI;
         ^
/root/moonlight-embedded/src/video/ffmpeg_vaapi.c:40:9: error: request for member ‘sw_format’ in something not a structure or union
   fr_ctx->sw_format = AV_PIX_FMT_NV12;
         ^
/root/moonlight-embedded/src/video/ffmpeg_vaapi.c:41:9: error: request for member ‘width’ in something not a structure or union
   fr_ctx->width = context->coded_width;
         ^
/root/moonlight-embedded/src/video/ffmpeg_vaapi.c:42:9: error: request for member ‘height’ in something not a structure or union
   fr_ctx->height = context->coded_height;
         ^
/root/moonlight-embedded/src/video/ffmpeg_vaapi.c:43:9: error: request for member ‘initial_pool_size’ in something not a structure or union
   fr_ctx->initial_pool_size = MAX_SURFACES + 1;
         ^
/root/moonlight-embedded/src/video/ffmpeg_vaapi.c:45:7: warning: implicit declaration of function ‘av_hwframe_ctx_init’ [-Wimplicit-function-declaration]
   if (av_hwframe_ctx_init(hw_ctx) < 0) {
       ^
/root/moonlight-embedded/src/video/ffmpeg_vaapi.c:51:10: error: ‘AVCodecContext {aka struct AVCodecContext}’ has no member named ‘hw_device_ctx’
   context->hw_device_ctx = device_ref;
          ^
/root/moonlight-embedded/src/video/ffmpeg_vaapi.c:52:10: error: ‘AVCodecContext {aka struct AVCodecContext}’ has no member named ‘hw_frames_ctx’
   context->hw_frames_ctx = hw_ctx;
          ^
/root/moonlight-embedded/src/video/ffmpeg_vaapi.c: In function ‘va_get_buffer’:
/root/moonlight-embedded/src/video/ffmpeg_vaapi.c:58:10: warning: implicit declaration of function ‘av_hwframe_get_buffer’ [-Wimplicit-function-declaration]
   return av_hwframe_get_buffer(context->hw_frames_ctx, frame, 0);
          ^
/root/moonlight-embedded/src/video/ffmpeg_vaapi.c:58:39: error: ‘AVCodecContext {aka struct AVCodecContext}’ has no member named ‘hw_frames_ctx’
   return av_hwframe_get_buffer(context->hw_frames_ctx, frame, 0);
                                       ^
/root/moonlight-embedded/src/video/ffmpeg_vaapi.c: In function ‘vaapi_init_lib’:
/root/moonlight-embedded/src/video/ffmpeg_vaapi.c:62:10: warning: implicit declaration of function ‘av_hwdevice_ctx_create’ [-Wimplicit-function-declaration]
   return av_hwdevice_ctx_create(&device_ref, AV_HWDEVICE_TYPE_VAAPI, ":0", NULL
          ^
/root/moonlight-embedded/src/video/ffmpeg_vaapi.c:62:46: error: ‘AV_HWDEVICE_TYPE_VAAPI’ undeclared (first use in this function)
   return av_hwdevice_ctx_create(&device_ref, AV_HWDEVICE_TYPE_VAAPI, ":0", NULL
                                              ^
/root/moonlight-embedded/src/video/ffmpeg_vaapi.c: In function ‘vaapi_queue’:
/root/moonlight-embedded/src/video/ffmpeg_vaapi.c:72:3: error: unknown type name ‘AVHWDeviceContext’
   AVHWDeviceContext* device = (AVHWDeviceContext*) device_ref->data;
   ^
/root/moonlight-embedded/src/video/ffmpeg_vaapi.c:72:32: error: ‘AVHWDeviceContext’ undeclared (first use in this function)
   AVHWDeviceContext* device = (AVHWDeviceContext*) device_ref->data;
                                ^
/root/moonlight-embedded/src/video/ffmpeg_vaapi.c:72:50: error: expected expression before ‘)’ token
   AVHWDeviceContext* device = (AVHWDeviceContext*) device_ref->data;
                                                  ^
/root/moonlight-embedded/src/video/ffmpeg_vaapi.c:73:3: error: unknown type name ‘AVVAAPIDeviceContext’
   AVVAAPIDeviceContext *va_ctx = device->hwctx;
   ^
/root/moonlight-embedded/src/video/ffmpeg_vaapi.c:73:40: error: request for member ‘hwctx’ in something not a structure or union
   AVVAAPIDeviceContext *va_ctx = device->hwctx;
                                        ^
/root/moonlight-embedded/src/video/ffmpeg_vaapi.c:74:22: error: request for member ‘display’ in something not a structure or union
   vaPutSurface(va_ctx->display, surface, win, 0, 0, dec_frame->width, dec_frame
                      ^
CMakeFiles/moonlight.dir/build.make:422: recipe for target 'CMakeFiles/moonlight.dir/src/video/ffmpeg_vaapi.c.o' failed
make[2]: *** [CMakeFiles/moonlight.dir/src/video/ffmpeg_vaapi.c.o] Error 1
CMakeFiles/Makefile2:68: recipe for target 'CMakeFiles/moonlight.dir/all' failed
make[1]: *** [CMakeFiles/moonlight.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
 

 

Edited by Martin Košťál
additional info
Link to comment
Share on other sites

I have to compile ffmpeg or libavutil from source to get recent version.  Xenial repo has too old libraries.

So I try

 

git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg
cd ffmpeg
./configure
make
sudo make install

getting error:

 

CC      libavcodec/vp9recon.o
gcc: internal compiler error: Killed (program cc1)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-5/README.Bugs> for instructions.
ffbuild/common.mak:60: recipe for target 'libavcodec/vp9recon.o' failed
make: *** [libavcodec/vp9recon.o] Error 4

file README.Bugs is empty
 

Link to comment
Share on other sites

I have tried to backport ffmpeg from artful following  this guide. Any idea what to do next?

 

root@orangepione:~# backportpackage -u ppa:maor545/orangepi ffmpeg
backportpackage: Downloading ffmpeg_3.2.6.orig.tar.xz from archive.ubuntu.com (7.657 MiB)
backportpackage: Downloading ffmpeg_3.2.6-1.debian.tar.xz from archive.ubuntu.com (0.037 MiB)
gpgv: Signature made Wed 21 Jun 2017 08:52:28 PM UTC using RSA key ID 6EA71993
gpgv: Can't check signature: public key not found
dpkg-source: warning: failed to verify signature on ./ffmpeg_3.2.6-1.dsc
dpkg-source: info: extracting ffmpeg in ffmpeg-xenial
dpkg-source: info: unpacking ffmpeg_3.2.6.orig.tar.xz
dpkg-source: info: unpacking ffmpeg_3.2.6-1.debian.tar.xz
libdistro-info-perl is not installed, Debian release names are not known.
libdistro-info-perl is not installed, Ubuntu release names are not known.
dch warning: Unable to determine if xenial is a valid Ubuntu release.
dch warning: new version (7:3.2.6-1~ubuntu16.04.1~ppa1) is less than
the current version number (7:3.2.6-1).
 dpkg-buildpackage -rfakeroot -d -us -uc -S -nc -sa -v7:2.8.11-0ubuntu0.16.04.1
dpkg-buildpackage: warning: using a gain-root-command while being root
dpkg-buildpackage: error: gain-root-commmand 'fakeroot' not found
debuild: fatal error at line 1376:
dpkg-buildpackage -rfakeroot -d -us -uc -S -nc -sa -v7:2.8.11-0ubuntu0.16.04.1 failed
backportpackage: Error: debuild returned 29.

 

Link to comment
Share on other sites

I managed to compile moonlight on an OrangePi PC (but it's has 1G ram) and the good news is that it works out of the box with VDPAU acceleration, it works well even 1080 with 60fps. Also, had to compile ffmpeg  and used the vdpau driver provided by apt-get, so no need to compile from source. Another idea is to compile ffmpeg by subcomponents, like libavutil, but I don't know if it can be done easy... anyway, I've attached my version of compiled ffmpeg on OrangePI PC.

 

The dependencies needed by moonlight on OrangePi besides the ones from the github wiki, these are specific to OrangePi:

 

sudo apt-get install vdpau-driver-all
sudo apt-get install libvdpau-dev

 

-- compile ffmpeg (version x.y.z - latest available from releases)

sudo apt-get install pkg-config
wget http://ffmpeg.org/releases/ffmpeg-x.y.z.tar.bz2
tar xjvf ffmpeg-x.y.z.tar.bz2
cd ffmpeg-x.y.z
./configure --enable-shared
make
sudo make install
--- end

 

--also missing dependencies for moonlight
sudo apt-get install libegl1-mesa-dev
sudo apt-get install libmali-sunxi-dev
sudo apt-get install libenet-dev

 

.. and finally, the moonlight source has a small bug, even if VA acceleration is not available, the code is used and you get a link error, I've added a fix with this in my fork, nothing complicated just added the missing #ifdefs:  https://github.com/adriancuzman/moonlight-embedded

 

The compiled ffmpeg version: https://wetransfer.com/downloads/a9d1eb073ded6448552773a7d9767ee120170726095854/c95368541c802e6e94437504f28527ab20170726095854/e5d737

 

 

Link to comment
Share on other sites

I came back to this, I tried with clean install Armbian 5.37.171221 with mainline kernel.

I compiled ffmpeg 3.4.1 according to instruscions from Adrian @ many thanks for that.

 

Installed dependencies:

sudo apt-get install libssl-dev libopus-dev libasound2-dev libudev-dev libavahi-client-dev libcurl4-openssl-dev libevdev-dev mercurial libexpat1-dev cmake libgtk-3-dev uuid-dev libenet-dev

the libegl1-mesa-dev and libmali-sunxi-dev are already part of the Armbian images, so I left it as is.

 

I am still missing something

test@orangepiplus2e:~/moonlight-embedded/build$ cmake ../
-- The C compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Found ALSA: /usr/lib/arm-linux-gnueabihf/libasound.so (found version "1.1.0") 
-- Found Opus: /usr/lib/arm-linux-gnueabihf/libopus.so  
-- Could NOT find Broadcom (missing:  BROADCOM_INCLUDE_DIR VCOS_LIBRARY VCHIQ_LIBRARY OPENMAXIL_LIBRARY BCM_HOST_LIBRARY) 
-- Could NOT find Freescale (missing:  FREESCALE_INCLUDE_DIR KERNEL_INCLUDE_DIR VPU_LIBRARY) 
-- Could NOT find Amlogic (missing:  AMLOGIC_INCLUDE_DIR AMCODEC_LIBRARY AMADEC_LIBRARY AMAVUTILS_LIBRARY) 
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") 
-- Checking for module 'libevdev'
--   Found libevdev, version 1.4.6
-- Checking for module 'libudev'
--   Found libudev, version 229
-- Checking for module 'sdl2>=2.0.4'
--   
-- Checking for module 'libavcodec'
--   Found libavcodec, version 57.107.100
-- Checking for module 'libavutil'
--   Found libavutil, version 55.78.100
-- Checking for module 'x11'
--   Found x11, version 1.6.3
-- Checking for module 'vdpau'
--   Found vdpau, version 1.1.1
-- Checking for module 'libva'
--   No package 'libva' found
-- Checking for module 'libva-x11'
--   No package 'libva-x11' found
-- Checking for module 'libpulse-simple'
--   No package 'libpulse-simple' found
-- Checking for module 'libcec>=4'
--   
-- Checking for module 'egl'
--   Found egl, version 17.0.7
-- Checking for module 'glesv2'
--   No package 'glesv2' found
-- Checking for one of the modules 'uuid'
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found CURL: /usr/lib/arm-linux-gnueabihf/libcurl.so (found version "7.47.0") 
-- Found OpenSSL: /usr/lib/arm-linux-gnueabihf/libssl.so;/usr/lib/arm-linux-gnueabihf/libcrypto.so (found suitable version "1.0.2g", minimum required is "1.0.2") 
-- Found EXPAT: /usr/lib/arm-linux-gnueabihf/libexpat.so (found version "2.1.0") 
-- Checking for module 'avahi-client'
--   Found avahi-client, version 0.6.32-rc
-- Checking for module 'libenet'
--   Found libenet, version 1.3.12
CMake Error at CMakeLists.txt:156 (message):
  No video output available


-- Configuring incomplete, errors occurred!

 

CMakeError.log

CMakeOutput.log

Link to comment
Share on other sites

So I did some more digging and installed "libgles2-mesa-dev", with that I have been able to compile, but when running moonlight, I get error.

moonlight: error while loading shared libraries: libgamestream.so.2: cannot open shared object file: No such file or directory

I suppose that is caused by unmet dependencies such as: libcec4.

Unfortunately, the available library in 16.04 repos is only libcec3 and when I tried to pin the lib from bionic, I get error: Depends: libp8-platform-dev but it is not installable.

compiling the libcec4 from source does not have enough instructions

 

Link to comment
Share on other sites

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

Important Information

Terms of Use - Privacy Policy - Guidelines