FFMPEG NVENC HEVC до H264 - PullRequest
       59

FFMPEG NVENC HEVC до H264

0 голосов
/ 01 ноября 2019

Я пытаюсь транскодировать трансляцию HEVC 4k до 1080p H264. HEVC 4K в HEVC 1080p работает, но когда я пробую hevc в h264, я получаю «Устройства с поддержкой NVENC не найдены»

Теперь мне интересно, не получается ли полностью hw транскодировать 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 - возможно, неправильные параметры, такие как битовая скорость, скорость, ширина или высота Преобразование не удалось!

Не возможно преобразовать HEVC обратно в 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!

1 Ответ

0 голосов
/ 02 ноября 2019

Нет этого файла для тестирования, но я думаю, что вы получаете эту ошибку, потому что 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

...