Nvidia Docker not always using hardware

I have nvidia docker working and can see the thread with nvidia-smi on the host, but it doesn't always use hardware. Can you explain why? Here are my logs:

2025/03/14 23:34:47.257864 [TNR] Opened connection to 10A4180E/2 for ch5.1 KTTZ-HD
2025/03/14 23:34:47.257929 [HLS] Starting live stream for channel 5.1 from 172.30.0.22
2025/03/14 23:34:47.878007 [HLS] Probed live stream in 619.957455ms: mpeg2video 1920x1080 tt 6526993bps
2025/03/14 23:34:49.431570 [HLS] Session ch5.1-dANY-1033c586e61f started in 2.173556726s
2025/03/14 23:34:49.433009 [ENC] Starting encoder for ch5.1 in /shares/DVR/Streaming/ch5.1-dANY-1033c586e61f-1559184106/encoder-1-1262217311 at 1 (1.013656) (encoder=h264_nvenc, codec=h264, acodec=aac, resolution=1080, deinterlacer=hardware, bitrate=9232, segment_size=0.01)
2025/03/14 23:35:07.157659 [HLS] Stopping transcoder session ch5.1-dANY-1033c586e61f (out=19.965933s finished=false first_seq=1 last_seq=18)
2025/03/14 23:35:07.167488 [TNR] Closed connection to 10A4180E/2 for ch5.1 KTTZ-HD
2025/03/14 23:35:07.204453 [ENC] Stopped encoder for ch5.1 in /shares/DVR/Streaming/ch5.1-dANY-1033c586e61f-1559184106/encoder-1-1262217311 after encoding 1 to 17
2025/03/14 23:35:07.204472 [SNR] Statistics for ch5.1 KTTZ-HD: ss=100% snq=100% seq=100% bps=12597838,11830464-14445920 pps=1078,1013-1237
2025/03/14 23:35:07.204482 [SNR] Buffer statistics for ch5.1 KTTZ-HD: buf=0% drop=0%
2025/03/14 23:35:21.153264 [TNR] Opened connection to M3U-Threadfin for ch1501 ESPN 2
2025/03/14 23:35:21.153309 [HLS] Starting live stream for channel 1501 from 172.30.0.22
2025/03/14 23:35:21.379551 [HLS] Probed live stream in 226.169881ms: h264 1280x720 progressive 9288318bps
2025/03/14 23:35:21.389415 [HLS] ffmpeg: ch1501-dANY-1033c586e61f-remux: [h264 @ 0xa6bb240] Increasing reorder buffer to 2
2025/03/14 23:35:21.406895 [HLS] ffmpeg: ch1501-dANY-1033c586e61f-remux: [hls @ 0xa8397c0] Timestamps are unset in a packet for stream 1. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
2025/03/14 23:35:21.510051 [HLS] Session ch1501-dANY-1033c586e61f started in 356.659488ms
2025/03/14 23:35:53.703575 [HLS] Stopping transcoder session ch1501-dANY-1033c586e61f (out=44.494533s finished=false first_seq=1 last_seq=47)
2025/03/14 23:35:53.703707 [TNR] Closed connection to M3U-Threadfin for ch1501 ESPN 2
2025/03/14 23:35:53.705336 [SNR] Buffer statistics for ch1501 ESPN 2: buf=0% drop=0%
2025/03/14 23:36:00.210111 [TNR] Opened connection to M3U-Threadfin for ch1500 ESPN
2025/03/14 23:36:00.210170 [HLS] Starting live stream for channel 1500 from 172.30.0.22
2025/03/14 23:36:00.341337 [HLS] ffmpeg: ch1500-dANY-1033c586e61f-remux: [h264 @ 0x18e2e240] Increasing reorder buffer to 2
2025/03/14 23:36:00.358235 [HLS] ffmpeg: ch1500-dANY-1033c586e61f-remux: [hls @ 0x18e5fb00] Timestamps are unset in a packet for stream 1. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
2025/03/14 23:36:00.418785 [HLS] Session ch1500-dANY-1033c586e61f started in 208.567196ms
2025/03/14 23:36:00.454885 [HLS] Probed live stream in 244.630431ms: h264 1280x720 progressive 4854992bps
2025/03/14 23:36:32.641710 [HLS] Stopping transcoder session ch1500-dANY-1033c586e61f (out=43.801156s finished=false first_seq=1 last_seq=29)
2025/03/14 23:36:32.641826 [TNR] Closed connection to M3U-Threadfin for ch1500 ESPN
2025/03/14 23:36:32.643637 [SNR] Buffer statistics for ch1500 ESPN: buf=0% drop=0%

Because when the hardware is not being used, it is merely "remuxing" the content, not transcoding. Basically, your Nvidia hardware is only used when the format or bitrate needs to change; for other situations the content is remuxed, meaning the video stream doesn't change, only the container it is in.

3 Likes

That makes sense. I am getting errors on some channels though when it does try to use hardware. I haven't found a commonality to the problem channels but here is the logs for the error:

2025/03/17 12:25:13.884867 [TNR] Opened connection to 10A4180E/2 for ch34.1 FOX34
2025/03/17 12:25:13.884902 [HLS] Starting live stream for channel 34.1 from 172.30.0.22
2025/03/17 12:25:15.329851 [HLS] Probed live stream in 1.444871263s: mpeg2video 1280x720 progressive 10313141bps
2025/03/17 12:25:18.071586 [HLS] Session ch34.1-dANY-1033c586e61f started in 4.186642909s
2025/03/17 12:25:18.072672 [ENC] Starting encoder for ch34.1 in /shares/DVR/Streaming/ch34.1-dANY-1033c586e61f-1189283285/encoder-1-1390722932 at 1 (1.729700) (encoder=h264_nvenc, codec=h264, acodec=aac, resolution=720, deinterlacer=hardware, bitrate=9488, segment_size=0.01)
2025/03/17 12:25:18.172735 [HLS] ffmpeg: ch34.1-dANY-1033c586e61f-1-h264-aac---9488-256-720-6-0--hardware-false-false-0.01-0: Error while decoding stream #0:2: Invalid data found when processing input
2025/03/17 12:25:18.180574 [HLS] ffmpeg: ch34.1-dANY-1033c586e61f-1-h264-aac---9488-256-720-6-0--hardware-false-false-0.01-0: Error while decoding stream #0:1: Invalid data found when processing input
2025/03/17 12:25:18.402826 [HLS] ffmpeg: ch34.1-dANY-1033c586e61f-1-h264-aac---9488-256-720-6-0--hardware-false-false-0.01-0: [mpeg2video @ 0xee83340] No decoder surfaces left
2025/03/17 12:25:18.402853 [HLS] ffmpeg: ch34.1-dANY-1033c586e61f-1-h264-aac---9488-256-720-6-0--hardware-false-false-0.01-0: Error while decoding stream #0:0: Cannot allocate memory
2025/03/17 12:25:18.405498 [HLS] ffmpeg: ch34.1-dANY-1033c586e61f-1-h264-aac---9488-256-720-6-0--hardware-false-false-0.01-0: [mpeg2video @ 0xee83340] No decoder surfaces left
2025/03/17 12:25:18.405518 [HLS] ffmpeg: ch34.1-dANY-1033c586e61f-1-h264-aac---9488-256-720-6-0--hardware-false-false-0.01-0: Error while decoding stream #0:0: Cannot allocate memory
2025/03/17 12:25:18.407353 [HLS] ffmpeg: ch34.1-dANY-1033c586e61f-1-h264-aac---9488-256-720-6-0--hardware-false-false-0.01-0: [mpeg2video @ 0xee83340] No decoder surfaces left
2025/03/17 12:25:18.407372 [HLS] ffmpeg: ch34.1-dANY-1033c586e61f-1-h264-aac---9488-256-720-6-0--hardware-false-false-0.01-0: Error while decoding stream #0:0: Cannot allocate memory
2025/03/17 12:25:18.410043 [HLS] ffmpeg: ch34.1-dANY-1033c586e61f-1-h264-aac---9488-256-720-6-0--hardware-false-false-0.01-0: [mpeg2video @ 0xee83340] No decoder surfaces left
2025/03/17 12:25:18.410058 [HLS] ffmpeg: ch34.1-dANY-1033c586e61f-1-h264-aac---9488-256-720-6-0--hardware-false-false-0.01-0: Error while decoding stream #0:0: Cannot allocate memory
2025/03/17 12:25:18.411808 [HLS] ffmpeg: ch34.1-dANY-1033c586e61f-1-h264-aac---9488-256-720-6-0--hardware-false-false-0.01-0: [mpeg2video @ 0xee83340] No decoder surfaces left
2025/03/17 12:25:18.411827 [HLS] ffmpeg: ch34.1-dANY-1033c586e61f-1-h264-aac---9488-256-720-6-0--hardware-false-false-0.01-0: Error while decoding stream #0:0: Cannot allocate memory
2025/03/17 12:25:18.415274 [HLS] ffmpeg: ch34.1-dANY-1033c586e61f-1-h264-aac---9488-256-720-6-0--hardware-false-false-0.01-0: [mpeg2video @ 0xee83340] No decoder surfaces left
2025/03/17 12:25:18.415283 [HLS] ffmpeg: ch34.1-dANY-1033c586e61f-1-h264-aac---9488-256-720-6-0--hardware-false-false-0.01-0: Error while decoding stream #0:0: Cannot allocate memory
2025/03/17 12:25:18.419926 [HLS] ffmpeg: ch34.1-dANY-1033c586e61f-1-h264-aac---9488-256-720-6-0--hardware-false-false-0.01-0: Failed to negotiate pixel format between 'Parsed_scale_cuda_1' and 'auto_scale_0':
2025/03/17 12:25:18.419946 [HLS] ffmpeg: ch34.1-dANY-1033c586e61f-1-h264-aac---9488-256-720-6-0--hardware-false-false-0.01-0: ↑ cuda
2025/03/17 12:25:18.419949 [HLS] ffmpeg: ch34.1-dANY-1033c586e61f-1-h264-aac---9488-256-720-6-0--hardware-false-false-0.01-0: Parsed_scale_cuda_1 (scale_cuda) [requires cuda]
2025/03/17 12:25:18.419951 [HLS] ffmpeg: ch34.1-dANY-1033c586e61f-1-h264-aac---9488-256-720-6-0--hardware-false-false-0.01-0: ↓ cuda
2025/03/17 12:25:18.419953 [HLS] ffmpeg: ch34.1-dANY-1033c586e61f-1-h264-aac---9488-256-720-6-0--hardware-false-false-0.01-0: :warning: hwdownload needed :warning:
2025/03/17 12:25:18.419955 [HLS] ffmpeg: ch34.1-dANY-1033c586e61f-1-h264-aac---9488-256-720-6-0--hardware-false-false-0.01-0: ↑ yuv420p, yuyv422, rgb24 (+179 more)
2025/03/17 12:25:18.419957 [HLS] ffmpeg: ch34.1-dANY-1033c586e61f-1-h264-aac---9488-256-720-6-0--hardware-false-false-0.01-0: auto_scale_0 (scale)
2025/03/17 12:25:18.419959 [HLS] ffmpeg: ch34.1-dANY-1033c586e61f-1-h264-aac---9488-256-720-6-0--hardware-false-false-0.01-0: ↓ yuv420p, yuyv422, rgb24 (+168 more)
2025/03/17 12:25:18.419961 [HLS] ffmpeg: ch34.1-dANY-1033c586e61f-1-h264-aac---9488-256-720-6-0--hardware-false-false-0.01-0: ↑ yuv420p, yuyv422, rgb24 (+179 more)
2025/03/17 12:25:18.419963 [HLS] ffmpeg: ch34.1-dANY-1033c586e61f-1-h264-aac---9488-256-720-6-0--hardware-false-false-0.01-0: scaler_out_0_0 (scale)
2025/03/17 12:25:18.419965 [HLS] ffmpeg: ch34.1-dANY-1033c586e61f-1-h264-aac---9488-256-720-6-0--hardware-false-false-0.01-0: ↓ yuv420p, yuyv422, rgb24 (+168 more)
2025/03/17 12:25:18.419967 [HLS] ffmpeg: ch34.1-dANY-1033c586e61f-1-h264-aac---9488-256-720-6-0--hardware-false-false-0.01-0: :warning: hwupload needed :warning:
2025/03/17 12:25:18.419969 [HLS] ffmpeg: ch34.1-dANY-1033c586e61f-1-h264-aac---9488-256-720-6-0--hardware-false-false-0.01-0: ↑ cuda
2025/03/17 12:25:18.419971 [HLS] ffmpeg: ch34.1-dANY-1033c586e61f-1-h264-aac---9488-256-720-6-0--hardware-false-false-0.01-0: format
2025/03/17 12:25:18.419973 [HLS] ffmpeg: ch34.1-dANY-1033c586e61f-1-h264-aac---9488-256-720-6-0--hardware-false-false-0.01-0: ↓ cuda
2025/03/17 12:25:18.419986 [HLS] ffmpeg: ch34.1-dANY-1033c586e61f-1-h264-aac---9488-256-720-6-0--hardware-false-false-0.01-0: ↑ cuda
2025/03/17 12:25:18.419989 [HLS] ffmpeg: ch34.1-dANY-1033c586e61f-1-h264-aac---9488-256-720-6-0--hardware-false-false-0.01-0: out_0_0 (buffersink)
2025/03/17 12:25:18.419993 [HLS] ffmpeg: ch34.1-dANY-1033c586e61f-1-h264-aac---9488-256-720-6-0--hardware-false-false-0.01-0: Impossible to convert between the formats supported by the filter 'Parsed_scale_cuda_1' and the filter 'auto_scale_0'
2025/03/17 12:25:18.420094 [HLS] ffmpeg: ch34.1-dANY-1033c586e61f-1-h264-aac---9488-256-720-6-0--hardware-false-false-0.01-0: Error reinitializing filters!
2025/03/17 12:25:18.420102 [HLS] ffmpeg: ch34.1-dANY-1033c586e61f-1-h264-aac---9488-256-720-6-0--hardware-false-false-0.01-0: Failed to inject frame into filter network: Function not implemented
2025/03/17 12:25:18.420106 [HLS] ffmpeg: ch34.1-dANY-1033c586e61f-1-h264-aac---9488-256-720-6-0--hardware-false-false-0.01-0: Error while processing the decoded data for stream #0:0
2025/03/17 12:25:18.435958 [HLS] ffmpeg: ch34.1-dANY-1033c586e61f-1-h264-aac---9488-256-720-6-0--hardware-false-false-0.01-0: [aac @ 0xee85380] 2 frames left in the queue on closing
2025/03/17 12:25:18.436023 [HLS] ffmpeg: ch34.1-dANY-1033c586e61f-1-h264-aac---9488-256-720-6-0--hardware-false-false-0.01-0: [aac @ 0xee82200] 2 frames left in the queue on closing
2025/03/17 12:25:18.689529 [ENC] Encoder stopped for ch34.1 in /shares/DVR/Streaming/ch34.1-dANY-1033c586e61f-1189283285/encoder-1-1390722932 after starting from 1 without encoding any segments

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.