gpt4 book ai didi

FFMPEG NVENC HEVC 转 H264

转载 作者:行者123 更新时间:2023-12-04 22:49:19 37 4
gpt4 key购买 nike

我尝试将 HEVC 4k 广播转码为 1080p H264。 HEVC 4K 到 HEVC 1080p 可以工作,但是当我尝试将 hevc 到 h264 时,我得到“没有找到支持 NVENC 的设备”

现在我想知道是否不可能将 HEVC 完全硬件转码为 H264?

使用的代码:

ffmpeg -timeout 10000000 -reconnect 1 -reconnect_at_eof 1 -reconnect_streamed 1 -reconnect_delay_max 2 -hwaccel_device 0 -hwaccel cuvid -vcodec hevc_cuvid -resize 1920x1080 -i 'http://inputstream' -max_muxing_queue_size 1024 -map 0:0 -map 0:2 -acodec libfdk_aac -b:a 96k -c:v h264_nvenc -gpu 0 -preset llhq -profile high -rc:v vbr -qmin:v 26 -qmax:v 32 -b:v 4M -maxrate 4M -bufsize 8M -threads 0 -r 25 -g 100 -f mpegts 'udp://127.0.0.1:6472' 

当我运行代码时:

[h264_nvenc @ 0x3bf42c0] 提供的设备不支持所需的 NVENC 功能
初始化输出流 0:0 时出错 - 打开输出流 #0:0 的编码器时出错 - 可能是不正确的参数,例如 bit_rate、rate、width 或 height
转换失败!

不能将 HEVC 转换回 H264 吗?

日志:
root@sambir-T5600:~# ffmpeg -timeout 10000000 -reconnect 1 -reconnect_at_eof 1 -reconnect_streamed 1 -reconnect_delay_max 2 -hwaccel_device 0 -hwaccel cuvid -vcodec hevc_cuvid -resize 1920x1080 -i 'http://192.168.1.12:8001/1:0:19:3FAC:7851:ABC:1A40000:0:0:0:' -max_muxing_queue_size 1024 -map 0:0 -map 0:2 -acodec libfdk_aac -b:a 96k -c:v h264_nvenc -gpu 0 -preset llhq -vprofile high -rc:v vbr -qmin:v 26 -qmax:v 35 -b:v 4M -maxrate 4M -bufsize 8M -threads 0 -r 25 -g 100 -f mpegts 'udp://127.0.0.1:6472'
ffmpeg version N-95090-g646799b Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.4)
configuration: --prefix=/root/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/root/ffmpeg_build/include --extra-ldflags=-L/root/ffmpeg_build/lib --bindir=/root/bin --enable-cuda-nvcc --enable-cuvid --enable-libnpp --extra-cflags=-I/usr/local/cuda/include/ --extra-ldflags=-L/usr/local/cuda/lib64/ --enable-gpl --enable-libass --enable-libfdk-aac --enable-libx264 --enable-libx265 --enable-pic --extra-libs='-lpthread -lm -lz -ldl' --enable-nvenc --enable-nonfree
libavutil 56. 35.100 / 56. 35.100
libavcodec 58. 59.100 / 58. 59.100
libavformat 58. 33.100 / 58. 33.100
libavdevice 58. 9.100 / 58. 9.100
libavfilter 7. 59.100 / 7. 59.100
libswscale 5. 6.100 / 5. 6.100
libswresample 3. 6.100 / 3. 6.100
libpostproc 55. 6.100 / 55. 6.100
[hevc @ 0x44d8000] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x44d8000] Error parsing NAL unit #2.
[hevc @ 0x44d8000] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x44d8000] Error parsing NAL unit #2.
[hevc @ 0x44d8000] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x44d8000] Error parsing NAL unit #2.
[hevc @ 0x44d8000] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x44d8000] Error parsing NAL unit #2.
[hevc @ 0x44d8000] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x44d8000] Error parsing NAL unit #2.
[hevc @ 0x44d8000] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x44d8000] Error parsing NAL unit #2.
[hevc @ 0x44d8000] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x44d8000] Error parsing NAL unit #2.
[hevc @ 0x44d8000] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x44d8000] Error parsing NAL unit #2.
[hevc @ 0x44d8000] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x44d8000] Error parsing NAL unit #2.
[hevc @ 0x44d8000] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x44d8000] Error parsing NAL unit #2.
[hevc @ 0x44d8000] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x44d8000] Error parsing NAL unit #2.
[hevc @ 0x44d8000] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x44d8000] Error parsing NAL unit #2.
[hevc @ 0x44d8000] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x44d8000] Error parsing NAL unit #2.
[hevc @ 0x44d8000] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x44d8000] Error parsing NAL unit #2.
[hevc @ 0x44d8000] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x44d8000] Error parsing NAL unit #2.
[hevc @ 0x44d8000] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x44d8000] Error parsing NAL unit #2.
[hevc @ 0x44d8000] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x44d8000] Error parsing NAL unit #2.
[hevc @ 0x44d8000] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x44d8000] Error parsing NAL unit #2.
[hevc @ 0x44d8000] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x44d8000] Error parsing NAL unit #2.
[hevc @ 0x44d8000] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x44d8000] Error parsing NAL unit #2.
[hevc @ 0x44d8000] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x44d8000] Error parsing NAL unit #2.
[hevc @ 0x44d8000] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x44d8000] Error parsing NAL unit #2.
[hevc @ 0x44d8000] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x44d8000] Error parsing NAL unit #2.
[hevc @ 0x44d8000] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x44d8000] Error parsing NAL unit #2.
[hevc @ 0x44d8000] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x44d8000] Error parsing NAL unit #2.
[hevc @ 0x44d8000] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x44d8000] Error parsing NAL unit #2.
[hevc @ 0x44d8000] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x44d8000] Error parsing NAL unit #2.
[hevc @ 0x44d8000] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x44d8000] Error parsing NAL unit #2.
[hevc @ 0x44d8000] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x44d8000] Error parsing NAL unit #2.
[hevc @ 0x44d8000] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x44d8000] Error parsing NAL unit #2.
[hevc @ 0x44d8000] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x44d8000] Error parsing NAL unit #2.
[hevc @ 0x44d8000] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x44d8000] Error parsing NAL unit #2.
[hevc @ 0x44d8000] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x44d8000] Error parsing NAL unit #2.
[hevc @ 0x44d8000] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x44d8000] Error parsing NAL unit #2.
[hevc @ 0x44d8000] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x44d8000] Error parsing NAL unit #2.
[hevc @ 0x44d8000] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x44d8000] Error parsing NAL unit #2.
[hevc @ 0x44d8000] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x44d8000] Error parsing NAL unit #2.
[hevc @ 0x44d8000] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x44d8000] Error parsing NAL unit #2.
[hevc @ 0x44d8000] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x44d8000] Error parsing NAL unit #2.
[hevc @ 0x44d8000] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x44d8000] Error parsing NAL unit #2.
[hevc @ 0x44d8000] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x44d8000] Error parsing NAL unit #2.
[hevc @ 0x44d8000] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x44d8000] Error parsing NAL unit #2.
[hevc @ 0x44d8000] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x44d8000] Error parsing NAL unit #2.
[hevc @ 0x44d8000] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x44d8000] Error parsing NAL unit #2.
[hevc @ 0x44d8000] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x44d8000] Error parsing NAL unit #2.
[hevc @ 0x44d8000] PPS id out of range: 0
Last message repeated 1 times
[hevc @ 0x44d8000] Error parsing NAL unit #2.
Input #0, mpegts, from 'http://192.168.1.12:8001/1:0:19:3FAC:7851:ABC:1A40000:0:0:0:':
Duration: N/A, start: 21829.677256, bitrate: N/A
Program 16300
Stream #0:0[0x12f7]: Video: hevc (Main 10) ([36][0][0][0] / 0x0024), yuv420p10le(tv), 3840x2160 [SAR 1:1 DAR 16:9], 50 fps, 50 tbr, 90k tbn, 50 tbc
Stream #0:1[0x135b]: Audio: eac3 ([6][0][0][0] / 0x0006), 48000 Hz, 5.1(side), fltp, 256 kb/s
Stream #0:2[0x13bf]: Audio: aac (HE-AAC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 80 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (hevc (hevc_cuvid) -> h264 (h264_nvenc))
Stream #0:2 -> #0:1 (aac (native) -> aac (libfdk_aac))
Press [q] to stop, [?] for help
[h264_nvenc @ 0x44df300] Provided device doesn't support required NVENC features
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Conversion failed!

最佳答案

没有那个文件来测试它,但我认为你得到了那个错误,因为 NVENC H264 不支持 yuv420p10le。尝试添加 -pix_fmt nv12到命令将其转换为它支持的格式。

在版本 4.2.1 上,ffmpeg -h encoder=nvenc_h264输出有关编码器的信息,包括:
Supported pixel formats: yuv420p nv12 p010le yuv444p p016le yuv444p16le bgr0 rgb0 cuda d3d11

关于FFMPEG NVENC HEVC 转 H264,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58660999/

37 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com