Bug #4661

Transcoding hevc_nvenc: libav: AVCodecContext: No NVENC capable devices found

Added by Stefan Dietzel 13 days ago. Updated 8 days ago.

Status:FixedStart date:2017-10-09
Priority:NormalDue date:
Assignee:John Törnblom% Done:

100%

Category:Transcoding
Target version:-
Found in version:4.3-554~ga37d5bc6e Affected Versions:

Description

Hi,

transcoding with nvidia pascal gpu via nvenc is not possible for hevc. H264 works good but with hevc I only get audio and no video:

2017-10-09 22:57:09.793 http: 192.168.0.21: using ticket 0C15DF498AA1EEBC686C81F97B91F1DDB66CB865 for /stream/channel/e8fde3763c04ec904273c3522e2b1b7a
2017-10-09 22:57:09.793 subscription: 0063: "HTTP" subscribing on channel "RTL Television", weight: 100, adapter: "SAT>IP DVB-C Tuner #1 (192.168.0.1)", network: "Unitymedia", mux: "394MHz", provider: "Unitymedia", service: "RTL Television", profile="h265", hostname="192.168.0.21", client="VLC/2.2.6 LibVLC/2.2.6"
2017-10-09 22:57:09.876 transcode: 0005: 01:MPEG2VIDEO: > Using profile h265_nvenc
2017-10-09 22:57:09.876 transcode: 0005: 02:MPEG2AUDIO: > Using profile aac_audio
2017-10-09 22:57:09.876 transcode: 0005: 03:AC3: > Filtered out
2017-10-09 22:57:09.876 transcode: 0005: 05:DVBSUB: > Filtered out
2017-10-09 22:57:10.447 vaapi: VA-API version 0.40.0
2017-10-09 22:57:10.447 vaapi: va_getDriverName() returns -1
2017-10-09 22:57:10.447 vaapi: va_getDriverName() failed with unknown libva error,driver_name=(null)
2017-10-09 22:57:10.447 libav: AVHWDeviceContext: Failed to initialise VAAPI connection: -1 (unknown libva error).
2017-10-09 22:57:10.447 vaapi: failed to create a context for device: /dev/dri/renderD128
2017-10-09 22:57:10.581 libav: AVCodecContext: No NVENC capable devices found

By google I found the following information. I guess this might be the same problem tvheadend has at the moment:
https://stackoverflow.com/questions/43244894/no-nvenc-capable-devices-found

Best regards
Stefan

h265_nvenc_working.png - Screen with codec info from VLC (573 KB) Stefan Dietzel, 2017-10-10 13:19

h265_codec_profile_nvenc.PNG - h265 profile in tvheadend (21.2 KB) Stefan Dietzel, 2017-10-10 13:19

Associated revisions

Revision b9cfeee3
Added by Jaroslav Kysela 12 days ago

transcode: fix nvenc_hevc (set 'bf' to zero), fixes #4661

History

#1 Updated by Stefan Dietzel 13 days ago

More error text:

2017-10-09 22:56:25.856 http: 192.168.0.21: using ticket 0C15DF498AA1EEBC686C81F97B91F1DDB66CB865 for /stream/channel/e8fde3763c04ec904273c3522e2b1b7a
2017-10-09 22:56:25.856 subscription: 0062: "HTTP" subscribing on channel "RTL Television", weight: 100, adapter: "SAT>IP DVB-C Tuner #1 (192.168.0.1)", network: "Unitymedia", mux: "394MHz", provider: "Unitymedia", service: "RTL Television", profile="h265", hostname="192.168.0.21", client="VLC/2.2.6 LibVLC/2.2.6"
2017-10-09 22:56:25.924 transcode: 0004: 01:MPEG2VIDEO: > Using profile h265_nvenc
2017-10-09 22:56:25.924 transcode: 0004: 02:MPEG2AUDIO: > Using profile aac_audio
2017-10-09 22:56:25.924 transcode: 0004: 03:AC3: > Filtered out
2017-10-09 22:56:25.924 transcode: 0004: 05:DVBSUB: > Filtered out
2017-10-09 22:56:26.283 libav: AVCodecContext: Invalid frame dimensions 0x0.
2017-10-09 22:56:26.343 libav: AVCodecContext: Invalid frame dimensions 0x0.
2017-10-09 22:56:26.374 libav: AVCodecContext: Invalid frame dimensions 0x0.
2017-10-09 22:56:26.375 libav: AVCodecContext: Invalid frame dimensions 0x0.
2017-10-09 22:56:26.423 libav: AVCodecContext: Invalid frame dimensions 0x0.
2017-10-09 22:56:26.445 libav: AVCodecContext: Invalid frame dimensions 0x0.
2017-10-09 22:56:26.476 libav: AVCodecContext: Invalid frame dimensions 0x0.
2017-10-09 22:56:26.506 libav: AVCodecContext: Invalid frame dimensions 0x0.
2017-10-09 22:56:26.526 libav: AVCodecContext: Invalid frame dimensions 0x0.
2017-10-09 22:56:26.566 libav: AVCodecContext: Invalid frame dimensions 0x0.
2017-10-09 22:56:26.715 vaapi: VA-API version 0.40.0
2017-10-09 22:56:26.715 vaapi: va_getDriverName() returns -1
2017-10-09 22:56:26.715 vaapi: va_getDriverName() failed with unknown libva error,driver_name=(null)
2017-10-09 22:56:26.715 libav: AVHWDeviceContext: Failed to initialise VAAPI connection: -1 (unknown libva error).
2017-10-09 22:56:26.715 vaapi: failed to create a context for device: /dev/dri/renderD128
2017-10-09 22:56:26.982 libav: AVCodecContext: No NVENC capable devices found

#3 Updated by Stefan Dietzel 13 days ago

libva info: VA-API version 0.40.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/nvidia_drv_video.so
libva info: Found init function __vaDriverInit_0_39
libva info: va_openDriver() returns 0
vainfo: VA-API version: 0.40 (libva )
vainfo: Driver version: Splitted-Desktop Systems VDPAU backend for VA-API - 0.7.4
vainfo: Supported profile and entrypoints
VAProfileMPEG2Simple : VAEntrypointVLD
VAProfileMPEG2Main : VAEntrypointVLD
VAProfileMPEG4Simple : VAEntrypointVLD
VAProfileMPEG4AdvancedSimple : VAEntrypointVLD
VAProfileH264Baseline : VAEntrypointVLD
VAProfileH264Main : VAEntrypointVLD
VAProfileH264High : VAEntrypointVLD
VAProfileVC1Simple : VAEntrypointVLD
VAProfileVC1Main : VAEntrypointVLD
VAProfileVC1Advanced : VAEntrypointVLD

lspci v -s $(lspci | grep ' VGA ' | cut -d" " -f 1)
01:00.0 VGA compatible controller: NVIDIA Corporation GP107 [GeForce GTX 1050] (rev a1) (prog-if 00 [VGA controller])
Subsystem: NVIDIA Corporation GP107 [GeForce GTX 1050]
Flags: bus master, fast devsel, latency 0, IRQ 319
Memory at de000000 (32-bit, non-prefetchable) [size=16M]
Memory at c0000000 (64-bit, prefetchable) [size=256M]
Memory at d0000000 (64-bit, prefetchable) [size=32M]
I/O ports at e000 [size=128]
[virtual] Expansion ROM at 000c0000 [disabled] [size=128K]
Capabilities: [60] Power Management version 3
Capabilities: [68] MSI: Enable+ Count=1/1 Maskable
64bit+
Capabilities: [78] Express Legacy Endpoint, MSI 00
Capabilities: [100] Virtual Channel
Capabilities: [250] Latency Tolerance Reporting
Capabilities: [128] Power Budgeting
Capabilities: [420] Advanced Error Reporting
Capabilities: [600] Vendor Specific Information: ID=0001 Rev=1 Len=024
Capabilities: [900] #19
Kernel driver in use: nvidia
Kernel modules: nouveau, nvidia_drm, nvidia

nvidia-smi -q

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

Timestamp : Tue Oct 10 07:57:18 2017
Driver Version : 384.81

Attached GPUs : 1
GPU 00000000:01:00.0
Product Name : GeForce GTX 1050
Product Brand : GeForce
Display Mode : Enabled
Display Active : Enabled
Persistence Mode : Enabled
Accounting Mode : Disabled
Accounting Mode Buffer Size : 1920
Driver Model
Current : N/A
Pending : N/A
Serial Number : N/A
GPU UUID : GPU-6c9e081b-f5a0-5f43-8486-70c68d8b49c4
Minor Number : 0
VBIOS Version : 86.07.25.00.0C
MultiGPU Board : No
Board ID : 0x100
GPU Part Number : N/A
Inforom Version
Image Version : G001.0000.01.04
OEM Object : 1.1
ECC Object : N/A
Power Management Object : N/A
GPU Operation Mode
Current : N/A
Pending : N/A
GPU Virtualization Mode
Virtualization mode : None
PCI
Bus : 0x01
Device : 0x00
Domain : 0x0000
Device Id : 0x1C8110DE
Bus Id : 00000000:01:00.0
Sub System Id : 0x1C8110DE
GPU Link Info
PCIe Generation
Max : 3
Current : 1
Link Width
Max : 16x
Current : 16x
Bridge Chip
Type : N/A
Firmware : N/A
Replays since reset : 0
Tx Throughput : 0 KB/s
Rx Throughput : 0 KB/s
Fan Speed : 30 %
Performance State : P8
Clocks Throttle Reasons
Idle : Active
Applications Clocks Setting : Not Active
SW Power Cap : Not Active
HW Slowdown : Not Active
Sync Boost : Not Active
SW Thermal Slowdown : Not Active
FB Memory Usage
Total : 1998 MiB
Used : 83 MiB
Free : 1915 MiB
BAR1 Memory Usage
Total : 256 MiB
Used : 4 MiB
Free : 252 MiB
Compute Mode : Default
Utilization
Gpu : 1 %
Memory : 5 %
Encoder : 0 %
Decoder : 0 %
Encoder Stats
Active Sessions : 0
Average FPS : 0
Average Latency : 0
Ecc Mode
Current : N/A
Pending : N/A
ECC Errors
Volatile
Single Bit
Device Memory : N/A
Register File : N/A
L1 Cache : N/A
L2 Cache : N/A
Texture Memory : N/A
Texture Shared : N/A
CBU : N/A
Total : N/A
Double Bit
Device Memory : N/A
Register File : N/A
L1 Cache : N/A
L2 Cache : N/A
Texture Memory : N/A
Texture Shared : N/A
CBU : N/A
Total : N/A
Aggregate
Single Bit
Device Memory : N/A
Register File : N/A
L1 Cache : N/A
L2 Cache : N/A
Texture Memory : N/A
Texture Shared : N/A
CBU : N/A
Total : N/A
Double Bit
Device Memory : N/A
Register File : N/A
L1 Cache : N/A
L2 Cache : N/A
Texture Memory : N/A
Texture Shared : N/A
CBU : N/A
Total : N/A
Retired Pages
Single Bit ECC : N/A
Double Bit ECC : N/A
Pending : N/A
Temperature
GPU Current Temp : 25 C
GPU Shutdown Temp : 102 C
GPU Slowdown Temp : 99 C
GPU Max Operating Temp : N/A
Memory Current Temp : N/A
Memory Max Operating Temp : N/A
Power Readings
Power Management : Supported
Power Draw : 35.30 W
Power Limit : 75.00 W
Default Power Limit : 75.00 W
Enforced Power Limit : 75.00 W
Min Power Limit : 52.50 W
Max Power Limit : 75.00 W
Clocks
Graphics : 164 MHz
SM : 164 MHz
Memory : 405 MHz
Video : 544 MHz
Applications Clocks
Graphics : N/A
Memory : N/A
Default Applications Clocks
Graphics : N/A
Memory : N/A
Max Clocks
Graphics : 1911 MHz
SM : 1911 MHz
Memory : 3504 MHz
Video : 1708 MHz
Max Customer Boost Clocks
Graphics : N/A
Clock Policy
Auto Boost : N/A
Auto Boost Default : N/A
Processes
Process ID : 4035
Type : G
Name : /usr/lib/xorg/Xorg
Used GPU Memory : 83 MiB

#4 Updated by Jaroslav Kysela 12 days ago

Could you try this patch?

diff --git a/src/transcoding/codec/codecs/libs/nvenc.c b/src/transcoding/codec/codecs/libs/nvenc.c
index fdbb59326..fe0f523e7 100644
--- a/src/transcoding/codec/codecs/libs/nvenc.c
+++ b/src/transcoding/codec/codecs/libs/nvenc.c
@@ -297,6 +297,7 @@ tvh_codec_profile_nvenc_hevc_open(tvh_codec_profile_nvenc_t *self,
     if (self->nvenc_profile != FF_PROFILE_UNKNOWN &&
         (s = val2str(self->nvenc_profile, profiletab)) != NULL)
       AV_DICT_SET(opts, "profile", s, 0);
+    AV_DICT_SET_INT(opts, "bf", 0, 0);
     return 0;
 }

#5 Updated by saen acro 12 days ago

Configuration > Stream > Codec Proflies
do you have gray profiles

#6 Updated by Stefan Dietzel 12 days ago

Jaroslav Kysela wrote:

Could you try this patch?

[...]

Hi, Jaroslav.

Success. This patch worked perfectly. Now H265 is working and using the nvidia card.

nvidia-smi

Tue Oct 10 13:18:28 2017
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 384.81                 Driver Version: 384.81                    |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 1050    On   | 00000000:01:00.0  On |                  N/A |
| 30%   28C    P0    35W /  75W |    124MiB /  1998MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0     14320      G   /usr/lib/xorg/Xorg                            32MiB |
|    0     23133      C   /usr/bin/tvheadend                            79MiB |
+-----------------------------------------------------------------------------+

I added two screenshots.

Best regards
Stefan

#7 Updated by Stefan Dietzel 12 days ago

Is it possible to add this patch permanently to the repository?

Best regards
Stefan

#8 Updated by saen acro 11 days ago

There is a bug in patch.
My 100% not working Intel QSV is marked as working (actually still not working)

#9 Updated by Jaroslav Kysela 8 days ago

  • Status changed from New to Fixed
  • % Done changed from 0 to 100

Also available in: Atom PDF