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 saen acro almost 4 years ago

Spawn profile can be good alternative.
It's more flexible than buildin presents,
can be used VBR deinterlace by hardware etc.

RE: Cant't transcode with NVENC - Added by dorin ilut almost 4 years ago

Hi Saen,

Can you give an example please. I think that would be helpful al lot. I suppose this would be using the MPEG-TS Spawn profile right?

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

I recently noticed that issue aswell, it was working perfectly fine a while ago so the best way to figure out the cause and get a proper fix is to bisect and try to revert commits.

RE: Cant't transcode with NVENC - Added by dorin ilut almost 4 years ago

Flole Systems wrote:

I recently noticed that issue aswell, it was working perfectly fine a while ago so the best way to figure out the cause and get a proper fix is to bisect and try to revert commits.

for me it works if I use the external ffmpeg. I get the reduction in bitrate, and I do see some GPU usage, but also quite high CPU usage. If I enable hardware acceleration the whole thing breaks. I am trying to figure out a good spwan profile that will use the GPU, with hardware acceleration and maintain size while reducing the bandwidth. So far I have this:

/snap/bin/ffmpeg -hwaccel_output_format cuda -c:v h264_cuvid -i pipe:0 -c:a copy -c:v copy -preset llhq -rc cbr_hq -b:v 5M -maxrate 6M -bufsize 3M -zerolatency 1 -flags +global_header -f mpegts -async 1 -vsync 1 pipe:1

This works, but it does not reduce the bandwidth, but i see the offload on the GPU.

I was hoping to get some guindance, but I will continue reading and hopefully figure it out step by step.

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

ffmpeg -re -copytb 1 -strict strict -hwaccel cuvid -hwaccel_device 0 -hwaccel_output_format cuda \
    -probesize 10M -analyzeduration 10M -fflags discardcorrupt+genpts+igndts+sortdts+nobuffer \
    -c:v h264_cuvid -gpu 0 -fifo_size 356962 -overrun_nonfatal 1 -buffer_size 67108864 \
    -i udp://127.0.0.1:55142 \
    -filter_complex [0:i:0x9d2]yadif_cuda,split=outputs=1[map:v:0] -map [map:v:0] -c:v:0 h264_nvenc \
    -profile:v:0 high -b:v:0 3000k -maxrate:v:0 3600k -bufsize:v:0 7200k -g 250 \
    -flags:v +global_header+cgop -preset:v llhq -gpu 0 -map 0:i:0xe38 -c:a:0 libfdk_aac -b:a:0 96k -ac 2.0 -ar 44100 \
    -metadata service_name=X HD -metadata service_provider=DP Y -max_muxing_queue_size 512 \
    -f tee [select=\'v:0,a:0\':bsfs/v=dump_extra=freq=keyframe:f=mpegts]mmcb:cache/stream/2/index.ts?buffer_size=1048576&mode=write \
    -nostdin -hide_banner -loglevel info

replace input and output for pipe

RE: Cant't transcode with NVENC - Added by dorin ilut almost 4 years ago

ok...getting closer

/snap/bin/ffmpeg -y -vsync 0 -hwaccel_output_format cuda -i pipe:0 -preset fast -c:a:1 copy -c:v h264_nvenc -c:s copy -maxrate 3M -f mpegts pipe:1 -nostdin -hide_banner -loglevel info

still need to sort the following: it takes very long to start the whole thing. for example:

2021-01-31 17:45:51.183 spawn: Executing "/snap/bin/ffmpeg" 
2021-01-31 17:45:51.188 subscription: 0073: "HTTP" subscribing on channel "AMC", weight: 100, adapter: "HDHomeRun DVB-C Tuner #2 (192.168.1.202)", network: "rcs", mux: "514MHz", provider: "DIGI Hungary", service: "AMC", profile="dt_spawn", hostname="188.60.141.85", client="VLC/3.0.11 LibVLC/3.0.11" 
2021-01-31 17:45:51.249 spawn: Error: unable to open display 
2021-01-31 17:46:01.334 spawn: [mpeg2video @ 0x55f04b775b80] Invalid frame dimensions 0x0.
2021-01-31 17:46:01.335 spawn:     Last message repeated 6 times
2021-01-31 17:46:01.335 spawn: [mp3float @ 0x55f04b776e40] Header missing
2021-01-31 17:46:01.335 spawn: [mp3float @ 0x55f04b7783c0] Header missing
2021-01-31 17:46:01.341 spawn: Input #0, mpegts, from 'pipe:0':
2021-01-31 17:46:01.341 spawn:   Duration: N/A, start: 28620.965222, bitrate: N/A
2021-01-31 17:46:01.341 spawn:   Program 1 
2021-01-31 17:46:01.341 spawn:     Metadata:
2021-01-31 17:46:01.341 spawn:       service_name    : AMC
2021-01-31 17:46:01.341 spawn:       service_provider: DIGI Hungary
2021-01-31 17:46:01.341 spawn:     Stream #0:1[0xe61]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, top first), 720x576 [SAR 64:45 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
2021-01-31 17:46:01.341 spawn:     Side data:
2021-01-31 17:46:01.341 spawn:       cpb: bitrate max/min/avg: 8000000/0/0 buffer size: 1818624 vbv_delay: N/A
2021-01-31 17:46:01.341 spawn:     Stream #0:2[0xe62](qaa): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 192 kb/s
2021-01-31 17:46:01.341 spawn:     Stream #0:3[0xe63](hun): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 192 kb/s
2021-01-31 17:46:01.341 spawn:     Stream #0:4[0xe66](rum): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)
2021-01-31 17:46:01.341 spawn:   No Program
2021-01-31 17:46:01.341 spawn:     Stream #0:0[0x12]: Data: epg
2021-01-31 17:46:01.343 spawn: Stream mapping:
2021-01-31 17:46:01.343 spawn:   Stream #0:1 -> #0:0 (mpeg2video (native) -> h264 (h264_nvenc))
2021-01-31 17:46:01.343 spawn:   Stream #0:2 -> #0:1 (mp2 (native) -> mp2 (native))
2021-01-31 17:46:01.343 spawn:   Stream #0:4 -> #0:2 (copy)
2021-01-31 17:46:01.420 spawn: [mp2 @ 0x55f04b7efd40] Header missing
2021-01-31 17:46:01.420 spawn: Error while decoding stream #0:2: Invalid data found when processing input
2021-01-31 17:46:01.421 spawn: Output #0, mpegts, to 'pipe:1':
2021-01-31 17:46:01.421 spawn:   Metadata:
2021-01-31 17:46:01.421 spawn:     encoder         : Lavf58.45.100
2021-01-31 17:46:01.421 spawn:     Stream #0:0: Video: h264 (h264_nvenc) (Main), yuv420p(top coded first (swapped)), 720x576 [SAR 64:45 DAR 16:9], q=-1--1, 2000 kb/s, 25 fps, 90k tbn, 25 tbc
2021-01-31 17:46:01.421 spawn:     Metadata:
2021-01-31 17:46:01.421 spawn:       encoder         : Lavc58.91.100 h264_nvenc
2021-01-31 17:46:01.421 spawn:     Side data:
2021-01-31 17:46:01.421 spawn:       cpb: bitrate max/min/avg: 3000000/0/2000000 buffer size: 4000000 vbv_delay: N/A
2021-01-31 17:46:01.421 spawn:     Stream #0:1(qaa): Audio: mp2, 48000 Hz, stereo, s16, 384 kb/s
2021-01-31 17:46:01.421 spawn:     Metadata:
2021-01-31 17:46:01.421 spawn:       encoder         : Lavc58.91.100 mp2
2021-01-31 17:46:01.421 spawn:     Stream #0:2(rum): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)
2021-01-31 17:46:01.906 spawn: frame=  247 fps=0.0 q=18.0 size=      13kB time=00:00:10.28 bitrate=  10.2kbits/s speed=19.5x    
2021-01-31 17:46:02.440 spawn: frame=  259 fps=244 q=18.0 size=     105kB time=00:00:10.76 bitrate=  79.7kbits/s speed=10.1x    
2021-01-31 17:46:02.907 spawn: frame=  272 fps=174 q=17.0 size=     423kB time=00:00:11.28 bitrate= 307.3kbits/s speed=7.22x    
2021-01-31 17:46:03.471 spawn: frame=  285 fps=136 q=17.0 size=     621kB time=00:00:11.80 bitrate= 430.9kbits/s speed=5.64x    
2021-01-31 17:46:03.970 spawn: frame=  296 fps=113 q=22.0 size=     724kB time=00:00:12.24 bitrate= 484.7kbits/s speed=4.66x    
2021-01-31 17:46:04.502 spawn: frame=  307 fps= 97 q=22.0 size=     854kB time=00:00:12.68 bitrate= 551.5kbits/s speed=4.01x    
2021-01-31 17:46:05.077 spawn: frame=  324 fps= 88 q=22.0 size=    1082kB time=00:00:13.36 bitrate= 663.5kbits/s speed=3.61x    
2021-01-31 17:46:05.649 spawn: frame=  336 fps= 79 q=23.0 size=    1261kB time=00:00:13.84 bitrate= 746.6kbits/s speed=3.27x    
2021-01-31 17:46:06.179 spawn: frame=  350 fps= 73 q=23.0 size=    1348kB time=00:00:14.40 bitrate= 766.7kbits/s speed=   3x    
2021-01-31 17:46:06.672 spawn: frame=  367 fps= 69 q=22.0 size=    1554kB time=00:00:15.08 bitrate= 844.1kbits/s speed=2.83x    
2021-01-31 17:46:07.247 spawn: frame=  377 fps= 64 q=23.0 size=    1682kB time=00:00:15.48 bitrate= 890.4kbits/s speed=2.62x    
2021-01-31 17:46:07.780 spawn: frame=  389 fps= 61 q=25.0 size=    1872kB time=00:00:15.96 bitrate= 960.9kbits/s speed=2.49x    
2021-01-31 17:46:08.334 spawn: frame=  402 fps= 58 q=24.0 size=    2012kB time=00:00:16.48 bitrate=1000.0kbits/s speed=2.38x    
2021-01-31 17:46:08.830 spawn: frame=  414 fps= 55 q=26.0 size=    2136kB time=00:00:16.96 bitrate=1031.9kbits/s speed=2.27x    
2021-01-31 17:46:09.372 spawn: frame=  431 fps= 54 q=24.0 size=    2298kB time=00:00:17.64 bitrate=1067.4kbits/s speed= 2.2x    
2021-01-31 17:46:09.480 spawn: av_interleaved_write_frame(): Connection reset by peer
2021-01-31 17:46:09.481 spawn: Error writing trailer of pipe:1: Connection reset by peer
2021-01-31 17:46:09.481 spawn: frame=  432 fps= 53 q=23.0 Lsize=    2298kB time=00:00:17.68 bitrate=1065.0kbits/s speed=2.17x    
2021-01-31 17:46:09.481 spawn: video:4408kB audio:816kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
2021-01-31 17:46:09.507 spawn: Conversion failed!
2021-01-31 17:46:09.515 subscription: 0073: "HTTP" unsubscribing from "AMC", hostname="188.60.141.85", client="VLC/3.0.11 LibVLC/3.0.11" 

the good thing is that CPU usage is down a loooot. even below VAAPI.

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

remove that snap and use native way faster

RE: Cant't transcode with NVENC - Added by dorin ilut almost 4 years ago

thanks saen. switched to /usr/bin/ffmpeg...it is indeed much faster.

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

It should be working again on latest master now. Please let me know if this fixes it.

RE: Cant't transcode with NVENC - Added by dorin ilut almost 4 years ago

Will test in a few and report back. Did you test with internal or external ffmpeg? Or it should not make a difference?

Thank you again for all your work with this.

RE: Cant't transcode with NVENC - Added by dorin ilut almost 4 years ago

using a build with external ffmpeg i get this:

2021-02-21 08:46:08.318 subscription: 0003: "188.60.141.85 [ dorin | Kodi Media Center ]" subscribing on channel "AXN HD", weight: 100, adapter: "HDHomeRun DVB-C Tuner #3 (192.168.1.202)", network: "rcs", mux: "338MHz", provider: "DIGI TV", service: "AXN HD", profile="dt_nvenc", hostname="188.60.141.85", username="dorin", client="Kodi Media Center"
2021-02-21 08:46:09.039 transcode: 0001: 01:H264: > Using profile dt_nvenc
2021-02-21 08:46:09.039 transcode: 0001: 02:MPEG2AUDIO: > Copy
2021-02-21 08:46:09.039 transcode: 0001: 03:MPEG2AUDIO: > Copy
2021-02-21 08:46:09.039 transcode: 0001: 04:AC3: > Copy
2021-02-21 08:46:09.039 transcode: 0001: 05:AC3: ==> Copy
2021-02-21 08:46:09.199 parser: rcs/338MHz/AXN HD: MPEG2AUDIO #3613: DTS and PCR diff is very big (689153)
2021-02-21 08:46:09.212 parser: rcs/338MHz/AXN HD: MPEG2AUDIO
#3612: DTS and PCR diff is very big (680949)
2021-02-21 08:46:09.985 libav: TVHGraph: Impossible to convert between the formats supported by the filter 'Parsed_deinterlace_vaapi_0' and the filter 'auto_scaler_0'
2021-02-21 08:46:09.985 transcode: 0001: 01:H264: [h264 => h264_nvenc]: filters: failed to config filter graph
2021-02-21 08:46:11.213 parser: rcs/338MHz/AXN HD: MPEG2AUDIO #3613: DTS and PCR diff is very big (686471)
2021-02-21 08:46:11.226 parser: rcs/338MHz/AXN HD: MPEG2AUDIO
#3612: DTS and PCR diff is very big (681431)
2021-02-21 08:46:13.227 parser: rcs/338MHz/AXN HD: MPEG2AUDIO #3613: DTS and PCR diff is very big (686964)
2021-02-21 08:46:13.241 parser: rcs/338MHz/AXN HD: MPEG2AUDIO
#3612: DTS and PCR diff is very big (681924)
2021-02-21 08:46:15.247 parser: rcs/338MHz/AXN HD: MPEG2AUDIO #3613: DTS and PCR diff is very big (687459)
2021-02-21 08:46:15.261 parser: rcs/338MHz/AXN HD: MPEG2AUDIO
#3612: DTS and PCR diff is very big (682419)
2021-02-21 08:46:17.254 parser: rcs/338MHz/AXN HD: MPEG2AUDIO #3613: DTS and PCR diff is very big (687920)
2021-02-21 08:46:17.267 parser: rcs/338MHz/AXN HD: MPEG2AUDIO
#3612: DTS and PCR diff is very big (682880)
2021-02-21 08:46:19.279 parser: rcs/338MHz/AXN HD: MPEG2AUDIO #3613: DTS and PCR diff is very big (688394)
2021-02-21 08:46:19.292 parser: rcs/338MHz/AXN HD: MPEG2AUDIO
#3612: DTS and PCR diff is very big (680201)
2021-02-21 08:46:21.295 parser: rcs/338MHz/AXN HD: MPEG2AUDIO #3613: DTS and PCR diff is very big (688881)
2021-02-21 08:46:21.308 parser: rcs/338MHz/AXN HD: MPEG2AUDIO
#3612: DTS and PCR diff is very big (680683)

the profile is set like in the screenshot below.

When I disable hardware acceleration i get image, and I can see the process in nvidia-smi, but the CPU usage is quite high.

Can you please share your profile setup?

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

Is that with the latest ffmpeg master?

Also you're mixing vaapi and nvenc there, I guess that's what's going on there.

RE: Cant't transcode with NVENC - Added by dorin ilut almost 4 years ago

so for ffmpeg:

dorin@dorin:~$ ffmpeg
ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)

I used the h264_nvenc codec.

codec setup

This is the stream profile:

stream profile

We using the settings as above, i get audio and no video:

2021-02-21 17:12:35.256 subscription: 0065: "188.60.141.85 [ dorin | Kodi Media Center ]" subscribing on channel "BBC Earth HD", weight: 100, adapter: "HDHomeRun DVB-C Tuner #3 (192.168.1.202)", network: "rcs", mux: "522MHz", provider: "Telenor", service: "BBC Earth HD", profile="dt_nvenc", hostname="188.60.141.85", username="dorin", client="Kodi Media Center"
2021-02-21 17:12:35.975 transcode: 0002: 01:H264: > Using profile dt_nvenc
2021-02-21 17:12:35.975 transcode: 0002: 02:MPEG2AUDIO: > Copy
2021-02-21 17:12:35.975 transcode: 0002: 03:MPEG2AUDIO: > Copy
2021-02-21 17:12:35.975 transcode: 0002: 04:AC3: > Copy
2021-02-21 17:12:35.975 transcode: 0002: 05:DVBSUB: ==> Copy
2021-02-21 17:12:37.032 libav: AVCodecContext: hw_frames_ctx must be set when using GPU frames as input.

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

That is an old ffmpeg version. There was a bug in ffmpeg (even in the latest Release) and only the latest master works. So use that (and make sure you use that ffmpeg version and not Tvheadend's statically compiled version).

RE: Cant't transcode with NVENC - Added by dorin ilut almost 4 years ago

Compiled ffmpeg.

dorin@dorin:~$ ffmpeg
ffmpeg version N-101194-g5ca40d6 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 7 (Ubuntu 7.5.0-6ubuntu2)
configuration: --prefix=/root/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/root/ffmpeg_build/include --extra-ldflags=-L/root/ffmpeg_build/lib --extra-libs='-lpthread -lm' --bindir=/root/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
libavutil 56. 66.100 / 56. 66.100
libavcodec 58.125.100 / 58.125.100
libavformat 58. 68.100 / 58. 68.100
libavdevice 58. 12.100 / 58. 12.100
libavfilter 7.107.100 / 7.107.100
libswscale 5. 8.100 / 5. 8.100
libswresample 3. 8.100 / 3. 8.100
libpostproc 55. 8.100 / 55. 8.100
Hyper fast Audio and Video encoder

still getting the same error. will try some more.

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

And you are also using Tvheadend with that ffmpeg version? It's not sufficient to just compile it and place it somewhere. Especially if you compiled Tvheadend with a static ffmpeg version built-in.

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

@ dorin ilut
this is not correct way to make ffmpeg for external usage

apt update
apt install autoconf automake build-essential cmake pkg-config texinfo wget yasm zlib1g-dev nasm
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/11.1.1/local_installers/cuda-repo-ubuntu1804-11-1-local_11.1.1-455.32.00-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1804-11-1-local_11.1.1-455.32.00-1_amd64.deb
sudo apt-key add /var/cuda-repo-ubuntu1804-11-1-local/7fa2af80.pub
sudo apt-get update
sudo apt-get -y install cuda

#First of all we install a few requirements:
apt install libx264-dev libx265-dev libnuma-dev libfdk-aac-dev
cd / opt
git clone https://git.ffmpeg.org/ffmpeg.git
git clone https://github.com/FFmpeg/nv-codec-headers
cd nv-codec-headers && make install && cd ..
cd ffmpeg

#Now we're building the actual FFMPEG binary with libfdk_aac, cuda, h264 and h265 support

./configure --enable-cuda-sdk --enable-cuda --enable-cuvid --enable-nvenc --enable-gpl --enable-nonfree --enable-libx264 --enable-libfreetype --enable-libfdk -aac --enable-cuda-nvcc --enable-libnpp --extra-cflags = -I /usr/local/cuda/include --extra-ldflags = -L /usr/local/cuda/lib64
make -j$(nproc)
make install

ffmpeg -version
#Output:
ffmpeg version N-98403-g04e06beb0a Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 7 (Ubuntu 7.5.0-3ubuntu1 ~ 18.04)
configuration: --enable-cuda-sdk --enable-cuda --enable-cuvid --enable-nvenc --enable-nonfree --enable-gpl --enable-libx264 --enable-libfreetype --enable-libfdk- aac --enable-cuda-nvcc --enable-libnpp --extra-cflags = -I /usr/local/cuda /include --extra-ldflags = -L /usr/local/cuda/lib64

libavutil 56. 55.100 / 56. 55.100
libavcodec 58.94.100 / 58.94.100
libavformat 58.48.100 / 58.48.100
libavdevice 58.11.101 / 58.11.101
libavfilter 7. 86.100 / 7. 86.100
libswscale 5,800 / 5,800
libswresample 3. 8,100 / 3. 8,100
libpostproc 55.8.100 / 55.8.100

then you need to use someting as this

#!/bin/ bash
f = "$ 1" # all args
name = "$ 2" 
        ffmpeg -y -loglevel verbose \
         -init_hw_device cuda = cuda \
         -hwaccel cuda \
         -filter_hw_device cuda \
         -hwaccel_output_format cuda -i "$ f" \
         -flags -global_header -filter_complex \
         "[0: v] hwdownload, format = p010le, hwupload_cuda" \
         -color_primaries bt2020 -color_trc smpte2084 -colorspace bt2020nc \
         -c: v hevc_nvenc -profile: v main10 -preset slow -qp 25 -format yuv420p10le \
         -map 0: m: language: ger -map 0: m: language: ger -map 0: m: language: ger -map 0: m: language: ger \
         -c: a: 1 copy -metadata: s: a: 0 title = "Original Audio" \
         -c: a: 2 libfdk_aac -ar: a 48000 -channel_layout: a 5.1 -ab: a 640k -metadata: s: a: 1 title = "AAC 5.1" \
         -c: a: 3 libfdk_aac -ab: a 384k -ar 48000 -metadata: s: a: 2 title = "AAC Stereo" \
         -c: a: 4 ac3 -ac 6 -ab 640k -metadata: s: a: 3 title = "AC3 5.1" \
         -sn "$ name" .mp4

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

This is about internal usage though which was fixed just yesterday and should work now properly.

RE: Cant't transcode with NVENC - Added by dorin ilut almost 4 years ago

still missing something, cause i'm probably to dumb for this:

root@dorin:/home/dorin/nvidia-patch# ffmpeg -hwaccels
ffmpeg version 4.3.2 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 7 (Ubuntu 7.5.0-6ubuntu2)
configuration: --enable-nonfree --enable-nvenc
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
Hardware acceleration methods:
vdpau
cuda
vaapi

still getting this message: libav: AVCodecContext: hw_frames_ctx must be set when using GPU frames as input when I try to run using hardware acceleration. Must be something really broken as I don't even see anything in nvidia-smi.

without hardware acceleration and pixel format set to auto I get an entry in nvidia-smi, but it is running with CPU high.

Will keep on trying :)

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

share command line with crash.
It seams that defined by you input type, is not equal to type of stream.

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

It is trying to use vaapi hardware acceleration, I wouldn't try to use that with nvenc. The patch that allows nvdec to be used is ready but not yet committed.

RE: Cant't transcode with NVENC - Added by dorin ilut almost 4 years ago

@saen acro: I am not trying to use any command line. this is just a profile build on the h264_nvenc codec. After Flole said it was pushed to git, I said I would give it a try. Then it was the whole ffmpeg building to the latest version, as I was supposed to use external ffmpeg.

Flole Systems: Thank you. then i will wait for that to be committed.

In all cases, thank you both for all the work you do and the assistance you provide.

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

Maybe there is someting with transcoding command construction in tvh,
mayby that's whay some softwares using Gstreamer.
link 1 link 2

https://tvheadend.org/issues/3131

(1-25/92)