简体   繁体   中英

FFMPEG NVENC HEVC to H264

I try to transcode a HEVC 4k broadcast down to 1080p H264. HEVC 4K to HEVC 1080p works but when I try hevc to h264 i get "No NVENC capable devices found"

Now I am wondering is it not possible to fully hw transcode HEVC to H264?

Code used:

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' 

When I run the code:

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

Is it not possible to convert HEVC back to H264?

log:

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!

Dont have that file to test it, but I think you are getting that error because NVENC H264 doesnt support yuv420p10le. Try adding -pix_fmt nv12 to the command to convert it to a format it does support.

On version 4.2.1, ffmpeg -h encoder=nvenc_h264 outputs info about the encoder, including:

Supported pixel formats: yuv420p nv12 p010le yuv444p p016le yuv444p16le bgr0 rgb0 cuda d3d11

It Seems your video card dosn't support this encoding for example I got same eroor when i try to convert HEVC 4k video with 10bit on nvidia M200 card, but when i cnaged card to pascaul nvidia P2000 it's working

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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