gstreamer-java / gst1-java-core

Java bindings for GStreamer 1.x
GNU Lesser General Public License v3.0
194 stars 72 forks source link

VAAPI invalid chip id or driver is being used. #254

Closed Nycrera closed 2 years ago

Nycrera commented 2 years ago

Hey, I am trying to get gstreamer to stream an mpegts stream over udp with hardware accelerated encoding on video using VAAPI. With intel integrated GPU. Basically I can run this command in command line to do this and it works without any problems.

gst-launch-1.0 ximagesrc ! video/x-raw,framerate=30/1 ! timeoverlay ! videoconvert ! vaapih264enc ! queue ! mpegtsmux name=m ! rtpmp2tpay ! udpsink host=127.0.0.1 port=1234 sync=false alsasrc device=hw:0 ! audioconvert ! fdkaacenc ! m.

But when I am using gstreamer-java with a simple parselaunch test:

Gst.init(Version.BASELINE);
Pipeline pipeline = (Pipeline) Gst.parseLaunch("ximagesrc ! video/x-raw,framerate=30/1 ! timeoverlay ! videoconvert ! vaapih264enc ! queue ! mpegtsmux name=m ! rtpmp2tpay ! udpsink host=127.0.0.1 port=1234 sync=false alsasrc device=hw:0 ! audioconvert ! fdkaacenc ! m.");
pipeline.play();

As you can see both pipelines are identical. However I am getting an error from gstreamer:

DRM_IOCTL_I915_GEM_APERTURE failed: Invalid argument
Assuming 131072kB available aperture size.
May lead to reduced performance or incorrect rendering.
get chip id failed: -1 [22]
param: 4, val: 0

Now my idea is that, somehow VAAPI is using the wrong driver while working in JVM but the correct one in command line. There is this Environment variable that needs to be set for the VAAPI to tell which driver to use: LIBVA_DRIVER_NAME, which I have set to correct value for my GPU, as, LIBVA_DRIVER_NAME=iHD. Is there a possibility that when gstreamer is ran through this library, this environment variable is not passed to the gstreamer process?

I can see the environment variable using System.getenv("LIBVA_DRIVER_NAME")

OR Is this absolutely unrelated to this?

Nycrera commented 2 years ago

Basically what makes me paranoid is the line: DRM_IOCTL_I915_GEM_APERTURE failed: Invalid argument the "I915" makes me think that the wrong driver is being used. Because the commonly used driver for Intel gpu's seems to be the I915 one. Maybe this is the default?

I have set up my VAAPI following the https://wiki.archlinux.org/title/Hardware_video_acceleration#Intel

But in the end why would it work on command line and not work on the library with a simple parseLaunch as this.

Nycrera commented 2 years ago

I have updated to Gst.init(Version.of(1,20)) No change.