简体   繁体   English

使用 GPU 和 scale_npp 将 hevc 转码为 h264

[英]Transcoding hevc to h264 using GPU and scale_npp

I am trying to transcode hevc to h264 using GPU.我正在尝试使用 GPU 将 hevc 转码为 h264。 Default input is 10 bit hevc but I also try it on 8 bit hevc.默认输入是 10 位 hevc,但我也在 8 位 hevc 上尝试过。 I use hevc_cuvid decoder and h264_nvenc encoder.我使用 hevc_cuvid 解码器和 h264_nvenc 编码器。 While scaling using CPU its correct.在使用 CPU 进行缩放时,它是正确的。 I was also using scale_npp=w=1280:h=720:format=yuv420p and scale_cuda - > no result.我也在使用 scale_npp=w=1280:h=720:format=yuv420p 和 scale_cuda -> 没有结果。

Working command without using GPU to scale:不使用 GPU 扩展的工作命令:

/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

But when I try to scale using GPU for example scale_cuda or scale_npp I get this error:但是,当我尝试使用 GPU 进行缩放时,例如 scale_cuda 或 scale_npp 我收到此错误:

Command:命令:

/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

Outputs:输出:

Error output with trace log level带有跟踪日志级别的错误输出

[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!

Full output with warning log level带有警告日志级别的完整输出

[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显卡:特斯拉 T4

System: Linux tgpu 4.19.0-17-amd64 #1 SMP Debian 4.19.194-3 (2021-07-18) x86_64 GNU/Linux系统: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 Nvcc 版本:nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2020 NVIDIA Corporation Built on Mon_Oct_12_20:09:46_PDT_2020 Cuda 编译工具,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 ?是否可以使用 GPU 扩展 hevc 以及如何解决这个问题? Thank You in advance.先感谢您。

Use scale_cuda filter.使用 scale_cuda 过滤器。 scale_npp does not support p010le. scale_npp 不支持 p010le。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM