Перекодирование hevc в h264 с использованием GPU и scale_npp

#ffmpeg #gpu #scale #hevc

Вопрос:

Я пытаюсь перекодировать hevc в h264 с помощью графического процессора. По умолчанию вводится 10-битный hevc, но я также пробую его на 8-битном hevc. Я использую декодер hevc_cuvid и кодер h264_nvenc. При масштабировании с использованием процессора это правильно. Я также использовал scale_npp=w=1280:h=720:формат=yuv420p и scale_cuda — > без результата.

Рабочая команда без использования графического процессора для масштабирования:

 /usr/local/bin/ffmpeg -y -v warning -c:v hevc_cuvid -an -sn -dn -reconnect_at_eof 1 -reconnect_streamed 1 -reconnect_on_network_error 1 -i http://1.2.3.4:8794 -c:v h264_nvenc -pix_fmt yuv420p -vf scale=1280:720 test_hevc.mp4
 

Но когда я пытаюсь масштабировать с помощью графического процессора, например, scale_cuda или scale_npp, я получаю эту ошибку:

Команда:

 /usr/local/bin/ffmpeg -y -v warning -c:v hevc_cuvid -an -sn -dn -reconnect_at_eof 1 -reconnect_streamed 1 -reconnect_on_network_error 1 -i http://1.2.3.4:8794 -c:v h264_nvenc -pix_fmt yuv420p -vf scale_npp=1280:720 test_hevc.mp4
 

Выходы:

Вывод ошибок с уровнем журнала трассировки

 [graph 0 input from stream 0:0 @ 0x56164efb6b40] w:3840 h:2160 pixfmt:p010le tb:1/90000 fr:50/1 sar:1/1
[format @ 0x56164efb7940] Setting ‘pix_fmts’ to value ‘yuv420p’
[auto_scale_0 @ 0x56164efb9940] w:iw h:ih flags:’’ interl:0
[Parsed_scale_npp_0 @ 0x56164efb58c0] auto-inserting filter ‘auto_scale_0’ between the filter ‘graph 0 input from stream 0:0’ and the filter ‘Parsed_scale_npp_0’
Impossible to convert between the formats supported by the filter ‘graph 0 input from stream 0:0’ and the filter ‘auto_scale_0’
Error reinitializing filters!
Failed to inject frame into filter network: Function not implemented
Error while processing the decoded data for stream #0:0
[AVIOContext @ 0x56164ea41300] Statistics: 0 seeks, 0 writeouts
[AVIOContext @ 0x56164ea39c80] Statistics: 15357720 bytes read, 0 seeks
[AVHWDeviceContext @ 0x56164ea68480] Calling cu->cuCtxDestroy(hwctx->cuda_ctx)
Conversion failed!
 

Полный вывод с уровнем журнала предупреждений

 [hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[hevc @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x555bd6e9f0c0] Error parsing NAL unit #2.
[mpegts @ 0x555bd6e85dc0] Could not find codec parameters for stream 0 (Video: hevc (HEVC / 0x43564548), none): unspecified size
Consider increasing the value for the ‘analyzeduration’ (0) and ‘probesize’ (5000000) options
[NULL @ 0x555bd6e9f0c0] PPS id out of range: 0
Last message repeated 66 times
Impossible to convert between the formats supported by the filter ‘graph 0 input from stream 0:0’ and the filter ‘auto_scale_0’
Error reinitializing filters!
Failed to inject frame into filter network: Function not implemented
Error while processing the decoded data for stream #0:0

Additional informations:

My FFmpeg Version below:

ffmpeg version N-103630-g06de593303 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 8 (Debian 8.3.0-6)
configuration: --prefix=/usr/local --enable-libtwolame --enable-libzvbi --enable-nonfree --enable-cuda-nvcc --nvccflags=’-gencode arch=compute_75,code=sm_75 -O2’ --enable-libnpp --extra-cflags=-I/usr/local/cuda/include --extra-ldflags=-L/usr/local/cuda/lib64
libavutil 57. 5.100 / 57. 5.100
libavcodec 59. 7.103 / 59. 7.103
libavformat 59. 5.100 / 59. 5.100
libavdevice 59. 0.101 / 59. 0.101
libavfilter 8. 9.100 / 8. 9.100
libswscale 6. 1.100 / 6. 1.100
libswresample 4. 0.100 / 4. 0.100
 

GPU: Tesla T4

System: Linux tgpu 4.19.0-17-amd64 #1 SMP Debian 4.19.194-3 (2021-07-18) x86_64 GNU/Linux

Nvcc version: nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2020 NVIDIA Corporation
Built on Mon_Oct_12_20:09:46_PDT_2020
Cuda compilation tools, release 11.1, V11.1.105
Build cuda_11.1.TC455_06.29190527_0

Is it possible to scale hevc using GPU and how to fix this ?
Thank You in advance.