bmegli / realsense-network-hardware-video-encoder

Realsense hardware encoded color/ir H.264 and color/ir/depth HEVC streaming
Mozilla Public License 2.0
23 stars 3 forks source link

initialisation fail on ubuntu 18.04, on M3-8100Y model of the lattepanda alpha #8

Closed Changliu52 closed 4 years ago

Changliu52 commented 4 years ago

Hi @bmegli I can compile the package with no problem. but when I ran ./realsense-nhve-h264 127.0.0.1 9766 infrared 640 480 30 5 /dev/dri/renderD128

The terminal outputs the error as below:

[AVHWDeviceContext @ 0x56125936bd20] Opened VA display via DRM device /dev/dri/renderD128.
[AVHWDeviceContext @ 0x56125936bd20] libva: VA-API version 1.1.0
[AVHWDeviceContext @ 0x56125936bd20] libva: va_getDriverName() returns 0
[AVHWDeviceContext @ 0x56125936bd20] libva: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
[AVHWDeviceContext @ 0x56125936bd20] libva: Found init function __vaDriverInit_1_1
[AVHWDeviceContext @ 0x56125936bd20] libva: /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so init failed
[AVHWDeviceContext @ 0x56125936bd20] libva: va_openDriver() returns -1
[AVHWDeviceContext @ 0x56125936bd20] Failed to initialise VAAPI connection: -1 (unknown libva error).
hve: failed to create a VAAPI device
nhve: failed to initalize hardware encoder
unable to initalize, try to specify device e.g:

./realsense-nhve-h264 127.0.0.1 9766 color 640 360 30 5 /dev/dri/renderD128
./realsense-nhve-h264 127.0.0.1 9766 infrared 640 360 30 5 /dev/dri/renderD128

The vainfo outputs the same error

libva info: VA-API version 1.1.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_1_1
libva error: /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so init failed
libva info: va_openDriver() returns -1
vaInitialize failed with error code -1 (unknown libva error),exit

Note, I'm using the new M3-8100Y model of the lattepanda alpha. Please advice possible solutions

bmegli commented 4 years ago

Hi @Changliu52,

Just curious, do you have both M3-7Y30 and M3-8100Y?

I confirm the problem on Amber Lake Y M3-8100Y on Ubuntu 18.04

I have M3-8100Y GPD Win2 as remote robot controller (but I used 19.04 MATE, which had support for GPD Win2 other hardware).

The situation on AmberLake Y with default OS configuration seems to be funny:

More details in HVE issue

I am looking into that.

This is doable:

There are some hacky workarounds for CoffeLake, like here, this example is too hacky to use but shows that problem and workaround should exist.

Edit:

Changliu52 commented 4 years ago

Just curious, do you have both M3-7Y30 and M3-8100Y?

Yes, Just got the M3-8100Y delivered last weekend, so was trying out different setups on the new one, while leaving the old one for some of my old stuffs.

Since it is quite empty now, so I can try different OS and setup. So for the time being, I think I will get the reinstallation on the M3-7Y30 with 18.04, and test out different configurations on M3-8100Y following https://github.com/bmegli/hardware-video-encoder/issues/21.

Thank you so much for the clarification!

bmegli commented 4 years ago

Good news.

20.04 has both drivers (iHD and i965). M3-8100Y works with both drivers.

Initial testing with HVE shows that it is enough to force i965 with environment variable and everything seems to work.

Like this:

LIBVA_DRIVER_NAME=i965 ./hve-encode-raw-hevc10 10 /dev/dri/renderD128

See more details in HVE if you are interested.

Looks like 20.04 is the future. Go figure!

Changliu52 commented 4 years ago

That's fantastic! Great work @bmegli ! Would you think the bitrate control can work well also?

bmegli commented 4 years ago

Would you think the bitrate control can work well also?

It works.

You run it like this:

LIBVA_DRIVER_NAME=i965 ./realsense-nhve-hevc 192.168.0.100 9768 depth 848 480 30 500 /dev/dri/renderD128 8000000 0.000015625
Changliu52 commented 3 years ago

Hi @bmegli I was testing the on the 20.04 on M3-8100Y. I have set LIBVA_DRIVER_NAME=i965

the encoder seems to still have problem to initialise. The console output is:

AVHWDeviceContext @ 0x55af43cac0c0] Trying to use DRM render node for device 0.
[AVHWDeviceContext @ 0x55af43cac0c0] libva: VA-API version 1.7.0
[AVHWDeviceContext @ 0x55af43cac0c0] libva: User environment variable requested driver 'i965'
[AVHWDeviceContext @ 0x55af43cac0c0] libva: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
[ INFO] [1599692843.153209344]: Device with serial number 938422076491 was found.

[ INFO] [1599692843.153343191]: Device with physical ID 2-2-2 was found.
[ INFO] [1599692843.153456225]: Device with name Intel RealSense D435 was found.
[ INFO] [1599692843.153897987]: Device with port number 2-2 was found.
[ INFO] [1599692843.156157938]: getParameters...
[AVHWDeviceContext @ 0x55af43cac0c0] libva: Found init function __vaDriverInit_1_6
[AVHWDeviceContext @ 0x55af43cac0c0] libva: va_openDriver() returns 0
[AVHWDeviceContext @ 0x55af43cac0c0] Initialised VAAPI connection: version 1.7
[AVHWDeviceContext @ 0x55af43cac0c0] VAAPI driver: Intel i965 driver for Intel(R) Kaby Lake - 2.4.0.
[AVHWDeviceContext @ 0x55af43cac0c0] Driver not found in known nonstandard list, using standard behaviour.
[h264_vaapi @ 0x55af43cf9680] Input surface format is nv12.
[h264_vaapi @ 0x55af43cf9680] Using VAAPI profile VAProfileH264ConstrainedBaseline (13).
[h264_vaapi @ 0x55af43cf9680] Using VAAPI entrypoint VAEntrypointEncSlice (6).
[h264_vaapi @ 0x55af43cf9680] Using VAAPI render target format YUV420 (0x1).
[h264_vaapi @ 0x55af43cf9680] RC mode: VBR.
[h264_vaapi @ 0x55af43cf9680] RC target: 50% of 2000000 bps over 500 ms.
[h264_vaapi @ 0x55af43cf9680] RC buffer: 1000000 bits, initial fullness 750000 bits.
[h264_vaapi @ 0x55af43cf9680] RC framerate: 30/1 (30.00 fps).
[h264_vaapi @ 0x55af43cf9680] Using intra and P-frames (supported references: 4 / 1).
[h264_vaapi @ 0x55af43cf9680] All wanted packed headers available (wanted 0xd, found 0x1f).
[AVHWDeviceContext @ 0x55af43d1d580] Trying to use DRM render node for device 0.
[AVHWDeviceContext @ 0x55af43d1d580] libva: VA-API version 1.7.0
[AVHWDeviceContext @ 0x55af43d1d580] libva: User environment variable requested driver 'i965'
[AVHWDeviceContext @ 0x55af43d1d580] libva: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
[AVHWDeviceContext @ 0x55af43d1d580] libva: Found init function __vaDriverInit_1_6
[AVHWDeviceContext @ 0x55af43d1d580] libva: va_openDriver() returns 0
[AVHWDeviceContext @ 0x55af43d1d580] Initialised VAAPI connection: version 1.7
[AVHWDeviceContext @ 0x55af43d1d580] VAAPI driver: Intel i965 driver for Intel(R) Kaby Lake - 2.4.0.
[AVHWDeviceContext @ 0x55af43d1d580] Driver not found in known nonstandard list, using standard behaviour.
[h264_vaapi @ 0x55af43d3ee40] Input surface format is bgr0.
[h264_vaapi @ 0x55af43d3ee40] No usable encoding profile found.
hve: cannot open video encoder codec
nhve: failed to initalize hardware encoder
[ERROR] [1599692843.173446829]: nhve is unable to initialise!
Changliu52 commented 3 years ago

referencing to new issue https://github.com/bmegli/realsense-network-hardware-video-encoder/issues/25

bmegli commented 2 years ago

@Changliu52

We now have working m3-8100Y in 18.04, tested with ffmpeg_image_transport.