Project

General

Profile

Cant't transcode with NVENC

Added by Andre-Guy Otis almost 4 years 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 (92)

RE: Cant't transcode with NVENC - Added by dorin ilut over 3 years ago

I just did a build using the internal ffmpeg. It works great with nvidia, if you do not select hardware accelerated. I can see the GPU working, CPU level is low, picture quality is great. if HW accelerated is clicked it does the error with filters.

The only issue I see is that dvbsub is not passed when using copy on the streaming profile on VLC based players (tested on IOS and windows with VLC). Oddly enough it works in KODI.

RE: Cant't transcode with NVENC - Added by Kiril St. over 3 years ago

dorin ilut wrote:

The only issue I see is that dvbsub is not passed when using copy on the streaming profile on VLC based players (tested on IOS and windows with VLC). Oddly enough it works in KODI.

I read somewhere, that this is bug in vlc player, try SMPlayer, works perfect!

RE: Cant't transcode with NVENC - Added by saen acro over 3 years ago

Kiril St. wrote:

dorin ilut wrote:

The only issue I see is that dvbsub is not passed when using copy on the streaming profile on VLC based players (tested on IOS and windows with VLC). Oddly enough it works in KODI.

I read somewhere, that this is bug in vlc player, try SMPlayer, works perfect!

Or show output of stream in ffprobe

RE: Cant't transcode with NVENC - Added by dorin ilut over 3 years ago

all working quite well. i am noticing these in the log (viewing experience is not affected). just putting this here as a FYI.

2021-05-21 13:26:19.535 tsfix: transport stream MPEG2VIDEO, DTS discontinuity. DTS = 1495606907, last = 1495624907
2021-05-21 13:26:19.546 transcode: 0002: 01:H264: [mpeg2video => h264_nvenc]: Invalid pts (1495610507) <= last (1495624907), dropping frame
2021-05-21 13:26:19.550 transcode: 0002: 01:H264: [mpeg2video => h264_nvenc]: Invalid pts (1495614107) <= last (1495624907), dropping frame
2021-05-21 13:26:19.636 transcode: 0002: 01:H264: [mpeg2video => h264_nvenc]: Invalid pts (1495621307) <= last (1495624907), dropping frame
2021-05-21 13:26:19.640 transcode: 0002: 01:H264: [mpeg2video => h264_nvenc]: Invalid pts (1495624907) <= last (1495624907), dropping frame
2021-05-21 13:26:19.972 tsfix: transport stream MPEG2VIDEO, DTS discontinuity. DTS = 1495650107, last = 1495664507
2021-05-21 13:26:19.975 transcode: 0002: 01:H264: [mpeg2video => h264_nvenc]: Invalid pts (1495650107) <= last (1495664507), dropping frame
2021-05-21 13:26:19.978 transcode: 0002: 01:H264: [mpeg2video => h264_nvenc]: Invalid pts (1495653707) <= last (1495664507), dropping frame
2021-05-21 13:26:20.125 transcode: 0002: 01:H264: [mpeg2video => h264_nvenc]: Invalid pts (1495657307) <= last (1495664507), dropping frame
2021-05-21 13:26:20.130 transcode: 0002: 01:H264: [mpeg2video => h264_nvenc]: Invalid pts (1495664507) <= last (1495664507), dropping frame
2021-05-21 13:26:20.392 tsfix: transport stream MPEG2VIDEO, DTS discontinuity. DTS = 1495693307, last = 1495700507
2021-05-21 13:26:20.403 transcode: 0002: 01:H264: [mpeg2video => h264_nvenc]: Invalid pts (1495693307) <= last (1495700507), dropping frame
2021-05-21 13:26:20.426 transcode: 0002: 01:H264: [mpeg2video => h264_nvenc]: Invalid pts (1495700507) <= last (1495700507), dropping frame
2021-05-21 13:26:20.872 transcode: 0002: 01:H264: [mpeg2video => h264_nvenc]: Invalid pts (1495736507) <= last (1495736507), dropping frame
2021-05-21 13:26:29.928 tsfix: transport stream MPEG2VIDEO, DTS discontinuity. DTS = 1496557307, last = 1496560907
2021-05-21 13:26:29.937 transcode: 0002: 01:H264: [mpeg2video => h264_nvenc]: Invalid pts (1496557307) <= last (1496560907), dropping frame
2021-05-21 13:26:29.984 transcode: 0002: 01:H264: [mpeg2video => h264_nvenc]: Invalid pts (1496560907) <= last (1496560907), dropping frame
2021-05-21 13:26:41.941 transcode: 0002: 01:H264: [mpeg2video => h264_nvenc]: Invalid pts (1497637307) <= last (1497637307), dropping frame
2021-05-21 13:28:02.112 transcode: 0002: 01:H264: [mpeg2video => h264_nvenc]: Invalid pts (1504851707) <= last (1504851707), dropping frame

RE: Cant't transcode with NVENC - Added by Jonathan Young over 3 years ago

Just like to say that it works for me too (after applying the fix to profile.c) in Kodi.

However, I can't get the codec preset to work correctly. I think nvenc now needs p1 ... p7 rather than Slow, Medium or Fast etc. The only option that does not throw a warning is Default.

Would it be possible to add these options when using nvenc?

RE: Cant't transcode with NVENC - Added by dorin ilut over 3 years ago

Did the update to 4.3-1966~g04853f0da. it's running well. still getting the same messages as my previous post, but it's running.

RE: Cant't transcode with NVENC - Added by kosacik 1 over 3 years ago

I am facing same issues using NVENC transcoding. My tvh version is tvheadend_4.3-1975, but the same is with 1940.
I thought, it is an nvidia driver issue, so i tried few versions. But it is always the same. Then i found, that if Watching via kodi, it looks like session is not exited correctly and remains running in gpu memory (nvidia-smi), but When using vlc, memory is clearing itself fine (same profile). One session takes around 80MB, so after 50 chanell changes, only sound remains :-)

RE: Cant't transcode with NVENC - Added by Flole Systems over 3 years ago

So you aren't facing this issue but you're facing the "session not cleaned" issue? There's a patch for that on GitHub (which is not perfectly correct but works for now), so you might want to try that.

RE: Cant't transcode with NVENC - Added by saen acro over 3 years ago

When building FFMPEG with full nvidia hardware acceleration decode/encode/resize/deinterlace

--enable-cuda-nvcc
--enable-cuvid
--enable-nvenc
--enable-cuda-llvm
--enable-libnpp

!!! libnpp cannot be statically linked.
llbnpp need to be instaled on OS

@ Flole Systems can be maked more detailed check and informing message when some of them missing.

RE: Cant't transcode with NVENC - Added by Rene Wagler almost 3 years ago

Kiril St. wrote:

@ Flole Systems, I investigate a little more, and found that commit be37f9d (profile: reshuffle code in sharer destroy) is caused this problems! Im not familiar with github pull request features, so i provide working code in text file. Please check, and review. Tested wit http and htsp user on same channel, also 2 htsp users on same channel, work without problems!

WORKS! T H I S is the best job that ever been done!!!

This beatifull fix unfortunately is still NOT includet in official TVH git repo -.- why?? its 7 month ago ?

RE: Cant't transcode with NVENC - Added by Flole Systems almost 3 years ago

It's not beautiful and definitely not the best job ever done as the code is not thread-safe. That's why it's not included yet. If a proper fix is provided it can be reviewed and then possibly be merged.

RE: Cant't transcode with NVENC - Added by saen acro almost 3 years ago

Flole Systems wrote:

It's not beautiful and definitely not the best job ever done as the code is not thread-safe. That's why it's not included yet. If a proper fix is provided it can be reviewed and then possibly be merged.

Аre there any specific guidelines, or is this a general impression,
what exactly needs to change?
Exact direction.

The purpose of the exercise is to improve the product,
not to refuse developers to offer code due to unclear explanations.

I do not believe that anyone will mind if a corrective code of proposals is proposed.

Тeam work.

RE: Cant't transcode with NVENC - Added by Kiril St. almost 3 years ago

Rene Wagler wrote:

T H I S is the best job that ever been done!!!

This job is basically to revert specific change, a little tweaked to match current code. Thanks must go to Flole Systems for pointing right place, where we look!

RE: Cant't transcode with NVENC - Added by Rene Wagler almost 3 years ago

sooo when i say the most beautyfull code i mean im wayting for more than a Year of a fix like that. It was painfull. And now im happy that someone find a fix that workes as it should

RE: Cant't transcode with NVENC - Added by Kiril St. almost 3 years ago

Rene Wagler wrote:

It was painfull.

Agree with that. Great feature, but with this bug is useless!

RE: Cant't transcode with NVENC - Added by Jonathan Young over 2 years ago

Please Please Please can we get someone to look into this code so that it can be merged into the master branch? I need to use nvenc to transcode for my low powered Kodi client because spawn will not work with kodi htsp plugin.

Very grateful for all the hard work but there has not been any progress for a year now.

I am begging.

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

Should be fixed now.

(76-92/92)