gstreamer-vaapi

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

gstreamer-vaapi

Nick Kallen


Hi,

I’m trying to get gstreamer-vaapi installed on an Amazon ec2 GPU instance. When I installed gstreamer on an Ubuntu AMI through apt-get, all gstreamer decoding and encoding commands gave me an error like 'gstreamer-vaapi cannot load library’ (I forget the exact error message). vainfo errored that I didn’t have an x-server running.

I assumed I needed a newer version of gstreamer so I tried to build from source using cerbero on a redhat AMI. Cerbero built everything successfully (after I installed yasm by hand). I don’t know how to install the cerbero generated packages on my system (rpm -i *.rpm seemed to have no effect). If someone could explain that to me I would appreciate it.

But in any case, I ran 'cerbero shell' and I noticed gstreamer-vaapi was not automatically installed. I’m having difficulty compiling gstreamer-vaapi because of missing dependencies and I just have no idea if I’m on the wrong track to getting this all working together. Can I use cerbero to compile gstreamer-vaapi? What is the right way to build all of this together and install it properly on a machine?

Thanks!!

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: gstreamer-vaapi

Baby Octopus
Administrator
I'm not sure if vaapi has support for addon GPU. It works for Intel's onboard graphics now. Check if the onboard graphics supports hardware decode/encode

Also, check if vaapi would work on a VM. How would the Intel GMA be shared across multiple VM on a bare metal hypervisor?

There seem to be many variable :)

Reply | Threaded
Open this post in threaded view
|

Re: gstreamer-vaapi

Victor Jaquez
In reply to this post by Nick Kallen
On 01/17/17 at 11:06am, Nick Kallen wrote:
> Hi,
>
> I’m trying to get gstreamer-vaapi installed on an Amazon ec2 GPU instance.
> When I installed gstreamer on an Ubuntu AMI through apt-get, all gstreamer
> decoding and encoding commands gave me an error like 'gstreamer-vaapi
> cannot load library’ (I forget the exact error message). vainfo errored
> that I didn’t have an x-server running.

The first thing would be to get working vainfo. What kind of GPU does Amazon
provide? VAAPI works well on Intel GPUs and some other GPU using the gallium
drivers.

vainfo should work without an X server running, just it warns about it.

If vainfo doesn't work, which is the most basic libva tool, gstreamer-vaapi
won't work either.

vmjl

>
> I assumed I needed a newer version of gstreamer so I tried to build from
> source using cerbero on a redhat AMI. Cerbero built everything successfully
> (after I installed yasm by hand). I don’t know how to install the cerbero
> generated packages on my system (rpm -i *.rpm seemed to have no effect). If
> someone could explain that to me I would appreciate it.
>
> But in any case, I ran 'cerbero shell' and I noticed gstreamer-vaapi was
> not automatically installed. I’m having difficulty compiling
> gstreamer-vaapi because of missing dependencies and I just have no idea if
> I’m on the wrong track to getting this all working together. Can I use
> cerbero to compile gstreamer-vaapi? What is the right way to build all of
> this together and install it properly on a machine?
>
> Thanks!!

> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: gstreamer-vaapi

Nick Kallen
> I’m trying to get gstreamer-vaapi installed on an Amazon ec2 GPU instance.
> When I installed gstreamer on an Ubuntu AMI through apt-get, all gstreamer
> decoding and encoding commands gave me an error like 'gstreamer-vaapi
> cannot load library’ (I forget the exact error message). vainfo errored
> that I didn’t have an x-server running.

The first thing would be to get working vainfo. What kind of GPU does Amazon
provide? VAAPI works well on Intel GPUs and some other GPU using the gallium
drivers.

vainfo should work without an X server running, just it warns about it.

If vainfo doesn't work, which is the most basic libva tool, gstreamer-vaapi
won't work either.

Here is some info about these machines:


I naively thought this would be easy. I am clearly in over my head :(

Back to Ubuntu: After install 'apt install vainfo', it coredumps when I run it.

(gdb) run

Starting program: /usr/bin/vainfo 

[Thread debugging using libthread_db enabled]

Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

error: can't connect to X server!

error: failed to initialize display


Program received signal SIGABRT, Aborted.

0x00007ffff6cd2428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54

54 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.

(gdb) 


I installed the nvidia drivers successfully FWIW


ubuntu@ip-172-31-9-90:~$ nvidia-smi -q | head


==============NVSMI LOG==============


Timestamp                           : Tue Jan 17 17:36:42 2017

Driver Version                      : 367.57


Attached GPUs                       : 1

GPU 0000:00:03.0

    Product Name                    : GRID K520

    Product Brand                   : Grid


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: gstreamer-vaapi

Tim Müller
On Tue, 2017-01-17 at 12:38 -0500, Nick Kallen wrote:

Hi,

> I’m trying to get gstreamer-vaapi installed on an Amazon ec2 GPU instance.

... (snip) ...

I installed the nvidia drivers successfully FWIW


ubuntu@ip-172-31-9-90:~$ nvidia-smi -q | head


==============NVSMI LOG==============


Timestamp                           : Tue Jan 17 17:36:42 2017

Driver Version                      : 367.57


Attached GPUs                       : 1

GPU 0000:00:03.0

    Product Name                    : GRID K520

    Product Brand                   : Grid

For encoding you should be able to use the 'nvenc' plugin from gst-plugins-bad on these machines, once you've downloaded and installed the nvidia sdk.

Cheers
 -Tim

-- 
Tim Müller, Centricular Ltd - http://www.centricular.com

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: gstreamer-vaapi

Nick Kallen
Hi Tim,

For encoding you should be able to use the 'nvenc' plugin from gst-plugins-bad on these machines, once you've downloaded and installed the nvidia sdk.

I’m sorry if this is a dumb question, but even after following the README instructions here ( https://cgit.freedesktop.org/gstreamer/gst-plugins-bad/tree/sys/nvenc/README ) I can’t find the element nvenc

gst-launch-1.0 rtmpsrc location=rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov ! decodebin ! nvenc

WARNING: erroneous pipeline: no element “nvenc"


But I have gstreamer-plugins-bad installed:


libgstreamer-plugins-bad1.0-0 is already the newest version (1.8.2-1ubuntu0.2).

libgstreamer-plugins-bad1.0-dev is already the newest version (1.8.2-1ubuntu0.2).


As far as I can tell, nothing in the sys/ directory of gstreamer-plugins-bad is available on my ubuntu distribution.


Any suggestions?


Thanks!


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: gstreamer-vaapi

Tim Müller
On Wed, 2017-01-18 at 05:33 -0500, Nick Kallen wrote:

Hi Nick,

> > For encoding you should be able to use the 'nvenc' plugin from gst-
> > plugins-bad on these machines, once you've downloaded and installed
> > the nvidia sdk.
>
> I’m sorry if this is a dumb question, but even after following the
> README instructions here ( https://cgit.freedesktop.org/gstreamer/gst
> -plugins-bad/tree/sys/nvenc/README ) I can’t find the element nvenc
> gst-launch-1.0 rtmpsrc
> location=rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k
> .mov ! decodebin ! nvenc
> WARNING: erroneous pipeline: no element “nvenc"
>
> But I have gstreamer-plugins-bad installed:
>
> libgstreamer-plugins-bad1.0-0 is already the newest version (1.8.2-
> 1ubuntu0.2).
> libgstreamer-plugins-bad1.0-dev is already the newest version (1.8.2-
> 1ubuntu0.2).
>
> As far as I can tell, nothing in the sys/ directory of gstreamer-
> plugins-bad is available on my ubuntu distribution.

Yes, ubuntu doesn't ship the nvenc plugin by default (they can't
because it needs to be compiled against the nvidia headers + libs which
are not FLOSS software).

So you'd have to compile gst-plugins-bad yourself - it's enough to
configure it and then cd sys/nvenc; make; make install in there - no
need for all the other plugins.

Then by default the plugin will be installed into a different prefix,
so you either need to copy it into /usr/lib/../gstreamer-1.0/ manually
or set the GST_PLUGIN_PATH variable to where it was installed, so that
GStreamer finds it.

It's a bit fiddly I'm afraid, but I can assure you it'll work :)

Cheers
 -Tim

--
Tim Müller, Centricular Ltd - http://www.centricular.com
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: gstreamer-vaapi

Nick Kallen
Hi

So you'd have to compile gst-plugins-bad yourself - it's enough to 
configure it and then cd sys/nvenc; make; make install in there - no 
need for all the other plugins. 

Then by default the plugin will be installed into a different prefix, 
so you either need to copy it into /usr/lib/../gstreamer-1.0/ manually 
or set the GST_PLUGIN_PATH variable to where it was installed, so that 
GStreamer finds it. 

I’m stuck again, sorry :( . I configured with the nvidia libraries:

LDFLAGS="-L/usr/lib/nvidia-367" ./configure --with-cuda-prefix='/usr/local/cuda’


But building nvenc fails when it tries to make the gl module. Here is the error when I try to make gl directly:


~/gst-plugins-bad-1.8.3/gst-libs/gst/gl$ make

Making all in glprototypes

make[1]: Entering directory '/home/ubuntu/gst-plugins-bad-1.8.3/gst-libs/gst/gl/glprototypes'

make[1]: Nothing to be done for 'all'.

make[1]: Leaving directory '/home/ubuntu/gst-plugins-bad-1.8.3/gst-libs/gst/gl/glprototypes'

Making all in x11

make[1]: Entering directory '/home/ubuntu/gst-plugins-bad-1.8.3/gst-libs/gst/gl/x11'

make[1]: Nothing to be done for 'all'.

make[1]: Leaving directory '/home/ubuntu/gst-plugins-bad-1.8.3/gst-libs/gst/gl/x11'

make[1]: Entering directory '/home/ubuntu/gst-plugins-bad-1.8.3/gst-libs/gst/gl'

  CC       libgstgl_1.0_la-gstglcontext.lo

gstglcontext.c: In function ‘gst_gl_context_get_current_gl_api’:

gstglcontext.c:607:22: error: GL_CONTEXT_PROFILE_MASK’ undeclared (first use in this function)

         GetIntegerv (GL_CONTEXT_PROFILE_MASK, &context_flags);

                      ^

gstglcontext.c:607:22: note: each undeclared identifier is reported only once for each function it appears in

gstglcontext.c:608:29: error: GL_CONTEXT_CORE_PROFILE_BIT’ undeclared (first use in this function)

         if (context_flags & GL_CONTEXT_CORE_PROFILE_BIT)

                             ^

gstglcontext.c:610:29: error: GL_CONTEXT_COMPATIBILITY_PROFILE_BIT’ undeclared (first use in this function)

         if (context_flags & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT)

                             ^

gstglcontext.c: In function ‘_create_context_info’:

gstglcontext.c:990:23: error: GL_SHADING_LANGUAGE_VERSION’ undeclared (first use in this function)

   if (!gl->GetString (GL_SHADING_LANGUAGE_VERSION)) {

                       ^

Makefile:1125: recipe for target 'libgstgl_1.0_la-gstglcontext.lo' failed

make[1]: *** [libgstgl_1.0_la-gstglcontext.lo] Error 1

make[1]: Leaving directory '/home/ubuntu/gst-plugins-bad-1.8.3/gst-libs/gst/gl'

Makefile:1403: recipe for target 'all-recursive' failed

make: *** [all-recursive] Error 1


For what it’s worth, there is a libGL.so in the /usr/lib/nvidia-367 



_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: gstreamer-vaapi

Nick Kallen
Hi,

I miraculously got it to compile, replacing everywhere it said

# include <GL/gl.h>

with 

# include <GL/gl.h>
# include <GL/glext.h>

"sudo make install" put the libraries in /usr/local/lib/gstreamer-1.0

however, simply copying the files libgstnvenc.la  libgstnvenc.so into /usr/lib/x86_64-linux-gnu/gstreamer-1.0/ or /usr/lib/x86_64-linux-gnu doesn’t seem to install the plugin:

gst-launch-1.0 fakesrc ! nvenc


WARNING: erroneous pipeline: no element "nvenc"


On January 18, 2017 at 1:34:29 PM, Nick Kallen ([hidden email]) wrote:

Hi

So you'd have to compile gst-plugins-bad yourself - it's enough to 
configure it and then cd sys/nvenc; make; make install in there - no 
need for all the other plugins. 

Then by default the plugin will be installed into a different prefix, 
so you either need to copy it into /usr/lib/../gstreamer-1.0/ manually 
or set the GST_PLUGIN_PATH variable to where it was installed, so that 
GStreamer finds it. 

I’m stuck again, sorry :( . I configured with the nvidia libraries:

LDFLAGS="-L/usr/lib/nvidia-367" ./configure --with-cuda-prefix='/usr/local/cuda’


But building nvenc fails when it tries to make the gl module. Here is the error when I try to make gl directly:


~/gst-plugins-bad-1.8.3/gst-libs/gst/gl$ make

Making all in glprototypes

make[1]: Entering directory '/home/ubuntu/gst-plugins-bad-1.8.3/gst-libs/gst/gl/glprototypes'

make[1]: Nothing to be done for 'all'.

make[1]: Leaving directory '/home/ubuntu/gst-plugins-bad-1.8.3/gst-libs/gst/gl/glprototypes'

Making all in x11

make[1]: Entering directory '/home/ubuntu/gst-plugins-bad-1.8.3/gst-libs/gst/gl/x11'

make[1]: Nothing to be done for 'all'.

make[1]: Leaving directory '/home/ubuntu/gst-plugins-bad-1.8.3/gst-libs/gst/gl/x11'

make[1]: Entering directory '/home/ubuntu/gst-plugins-bad-1.8.3/gst-libs/gst/gl'

  CC       libgstgl_1.0_la-gstglcontext.lo

gstglcontext.c: In function ‘gst_gl_context_get_current_gl_api’:

gstglcontext.c:607:22: error: GL_CONTEXT_PROFILE_MASK’ undeclared (first use in this function)

         GetIntegerv (GL_CONTEXT_PROFILE_MASK, &context_flags);

                      ^

gstglcontext.c:607:22: note: each undeclared identifier is reported only once for each function it appears in

gstglcontext.c:608:29: error: GL_CONTEXT_CORE_PROFILE_BIT’ undeclared (first use in this function)

         if (context_flags & GL_CONTEXT_CORE_PROFILE_BIT)

                             ^

gstglcontext.c:610:29: error: GL_CONTEXT_COMPATIBILITY_PROFILE_BIT’ undeclared (first use in this function)

         if (context_flags & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT)

                             ^

gstglcontext.c: In function ‘_create_context_info’:

gstglcontext.c:990:23: error: GL_SHADING_LANGUAGE_VERSION’ undeclared (first use in this function)

   if (!gl->GetString (GL_SHADING_LANGUAGE_VERSION)) {

                       ^

Makefile:1125: recipe for target 'libgstgl_1.0_la-gstglcontext.lo' failed

make[1]: *** [libgstgl_1.0_la-gstglcontext.lo] Error 1

make[1]: Leaving directory '/home/ubuntu/gst-plugins-bad-1.8.3/gst-libs/gst/gl'

Makefile:1403: recipe for target 'all-recursive' failed

make: *** [all-recursive] Error 1


For what it’s worth, there is a libGL.so in the /usr/lib/nvidia-367 



_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: gstreamer-vaapi

Tim Müller
On Wed, 2017-01-18 at 09:46 -0500, Nick Kallen wrote:

> however, simply copying the files libgstnvenc.la  libgstnvenc.so
> into /usr/lib/x86_64-linux-gnu/gstreamer-1.0/ or /usr/lib/x86_64-
> linux-gnu doesn’t seem to install the plugin:
>
> gst-launch-1.0 fakesrc ! nvenc
>
> WARNING: erroneous pipeline: no element "nvenc"

/usr/lib/x86_64-linux-gnu/gstreamer-1.0/ is the right directory, and
you just need to copy the .so file.

Start by running gst-inspect-1.0 on the .so file with the absolute
path, i.e.

gst-inspect-1.0 /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstnvenc.so

and see what it says.

Cheers
 -Tim

--
Tim Müller, Centricular Ltd - http://www.centricular.com
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: gstreamer-vaapi

Nick Kallen

On January 18, 2017 at 3:48:52 PM, Tim Müller ([hidden email]) wrote:

Start by running gst-inspect-1.0 on the .so file with the absolute 
path, i.e. 

gst-inspect-1.0 /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstnvenc.so 

and see what it says. 


ubuntu@ip-172-31-9-90:~/gst-plugins-bad-1.8.3/sys/nvenc$ gst-inspect-1.0 /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstnvenc.so 

Plugin Details:

  Name                     nvenc

  Description              GStreamer NVENC plugin

  Filename                 /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstnvenc.so

  Version                  1.8.3

  License                  LGPL

  Source module            gst-plugins-bad

  Source release date      2016-08-19

  Binary package           GStreamer Bad Plug-ins source release

  Origin URL               Unknown package origin



  0 features:


That doesn’t look good :(


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: gstreamer-vaapi

Tim Müller

Plugin Details:

  Name                     nvenc


  0 features:


That doesn’t look good :(


Probably means NvEncodeAPICreateInstance() failed. Might be a case of driver not being loaded or wrong driver version or something. Or some incompatibility of the SDK and the distro/version you use. It's all a bit painful sadly, the joy of proprietary hardware drivers.

Cheers
-Tim

-- 
Tim Müller, Centricular Ltd - http://www.centricular.com

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel