Project

General

Profile

Cant't transcode with NVENC

Added by Andre-Guy Otis 3 months ago

Hello,

I tried to compile tvheadend from git but I can't get the NVENC transcoder working. I configure the build with --enable-nvenc

I was able to compile without error but once I tried to use the H264_NVENC, I got this error:

2021-01-28 19:48:48.248 transcode: 0001: 01:H264: [mpeg2video => h264_nvenc]: encode failed

I also tried the latest stable release for Debian Stretch TVH 4.2.8 and that one is working correctly. One thing I noticed is from the codec profile tab, the H264_NVENC preset is not present. However, this preset is available on TVH 4.2.8 version, see images in attachment.

I'm sure there is something wrong when I compile TVH from git but I don't know what I'm doing wrong. Can you guys give me an hint about this?


Replies (60)

RE: Cant't transcode with NVENC - Added by Lukas G about 2 months ago

KODI uses an HTSP (basic, advanced - no) stream, but you can use an htsp or pass streaming profile, or transcoded. In my case, nvenc.

RE: Cant't transcode with NVENC - Added by Andre-Guy Otis about 2 months ago

Kiril St. wrote:

Lukas G wrote:

I found that the memory is freed when playing via VLC player. If I use KODI, each program switch will increase the allocated GPU memory.

Good observation, thanks! I also confimed that behaivour! In kodi 19, tvheadend addon have option: "use http for streaming channels" .When use this option, and channel stops, vram is flushed! When is disabled, vram increase! Maybe this will help for developers to identify problem... Im not use nvidia card, but situation is exactly the same, with AMD GPU!

I also try this and it work but can't use timeshift with http and this is something that I rely on.

Flole Systems wrote:

In kodi there used to be a warning if a non-HTSP profile was specified. If someone removed that warning I don't understand why that was done. That explains why you might think that it's supported to configure it this way.

Some people apparently forced a user to a streaming profile and then used that for kodi transcoding, that's what I meant with "some hack". It seemed to work to some extend but obviously not completely. There is a reason why the HTSP profile exists and why it doesn't offer transcoding (because it's not properly implementer).

I use a streaming profile with kodi for years, since early 4.2 release and it always working fine until now. I don't remember to see such warning about the non-HTSP profile under Kodi.

RE: Cant't transcode with NVENC - Added by Lukas G about 2 months ago

That's right, in version 4.2 transcoding works properly. Each GPU-accelerated transcoding is correctly released in memory. This does not happen after upgrading to 4.3.

Now I've tested the downgrade to 4.2 from 4.3 and the transcoding works.

RE: Cant't transcode with NVENC - Added by Flole Systems about 2 months ago

I just checked and in the latest version of kodi that warning is indeed gone. Also I was able to reproduce this issue.

I submitted a PR for this and it seems to fix it but I have no idea if this is a proper fix so I won't merge it until either Jaroslav approves it or someone can explain to me why this is the proper way of doing it.

RE: Cant't transcode with NVENC - Added by Kiril St. about 2 months ago

Flole Systems, fix work perfect! Thanks!

RE: Cant't transcode with NVENC - Added by dorin ilut about 2 months ago

Kiril St. wrote:

Flole Systems, fix work perfect! Thanks!

indeed. thank you. it works perfect. closes the session after each channel change. now only the nvidia hardware transcoding :).

RE: Cant't transcode with NVENC - Added by Lukas G about 1 month ago

I tried the last 4.3.0 ~ pre + 202103120326-0 ~ built202103120420. And the problem is still the same. nvenc does not free memory when playing via htsp.

RE: Cant't transcode with NVENC - Added by Andre-Guy Otis about 1 month ago

Lukas G wrote:

I tried the last 4.3.0 ~ pre + 202103120326-0 ~ built202103120420. And the problem is still the same. nvenc does not free memory when playing via htsp.

Flole must check with Jaroslav before the fix get merge.

Flole Systems wrote:

I just checked and in the latest version of kodi that warning is indeed gone. Also I was able to reproduce this issue.

I submitted a PR for this and it seems to fix it but I have no idea if this is a proper fix so I won't merge it until either Jaroslav approves it or someone can explain to me why this is the proper way of doing it.

Flole, can we get an update regarding this fix?

RE: Cant't transcode with NVENC - Added by Flole Systems about 1 month ago

As you can see on GitHub in the PR it is not a proper fix. It causes crashes so it can not be merged and further investigating the issue is necessary.

RE: Cant't transcode with NVENC - Added by Kiril St. 28 days ago

I did some experiments. Replace all code in function profile_sharer_destoy from stable 4.2.8. Now htsp with transcoding work without any problems, but http with transcoding cause tvheadend to crash...

(51-60/60)