[英]FFMPEG NVENC HEVC to H264
我嘗試將 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] 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!
不能將 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
似乎您的視頻卡不支持這種編碼,例如,當我嘗試在 nvidia M200 卡上轉換 10 位 HEVC 4k 視頻時,我得到了相同的錯誤,但是當我將卡轉換為 pascaul nvidia P2000 時,它正在工作
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.