Selur's Little Message Board

Full Version: NVEnc (ffmpeg) crasht beim h264 encoding
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi Selur,

Könnte vielleicht daran liegen:

Code:
1 - level 9: FFmpeg output: [h264_nvenc @ 0x55c46d50d180] InitializeEncoder failed: invalid param (8): Presets P1 to P7 are not supported with older 2 Pass RC Modes(CBR_HQ, VBR_HQ) and cbr lowdelay.

bye ggrub

[attachment=1547]
Hmm, bei 'NVEnc (FFmpeg)' werden keine checks bzgl. Sinnigkeit der Paramter gemacht, da ffmpeg anders als NVEncC keine Möglichkeit gibt zu sehen was die GPU unterstützt, bin also nicht verwundert, das da was nicht geht. Smile


7: lossless
Aktuell verwendet hybrid
  • "1-pass constant quantizer"
    Code:
    -rc constqp -qp <QUANTIZER> -2pass 0
  • "1-pass constant quality"
    Code:
    -rc vbr_hq -cq <QUALITY> -b:v 0k -2pass 0
  • "1-pass variable bitrate"
    Code:
    -rc vbr -2pass 0 -b:v <BITRATE>
  • "1-pass constant bitrate"
    Code:
    -rc cbr -2pass 0 -b:v <BITRATE>
  • "1-pass variable bitrate (2pass optimization)"
    Code:
    -rc vbr_hq 1 -2pass 1 -b:v <BITRATE>

Wenn ich den Fehler lese:
Quote:Presets P1 to P7 are not supported with older 2 Pass RC Modes(CBR_HQ, VBR_HQ) and cbr lowdelay.
Frage ich mich:
a. gibt es nen neue 2 Pass RC Modes ? (die Presets machen ja eigentlich immer Sinn,..)
b. reichte es dann einfach das preset bei '1-pass variable bitrate (2pass optimization)' weg zu lassen?
Wenn Du Deinen Aufruf:
Code:
"/home/user/.hybrid-bin/ffmpeg" -y -noautorotate -nostdin -threads 8 -i "/media/b3_HOME/Downloads/test.mkv" -map 0:0 -an -sn -vf  scale=in_range=tv:out_range=tv -pix_fmt yuv420p -vsync 0 -vcodec h264_nvenc -preset 1 -profile:v 2 -level 0 -rc vbr_hq -2pass 1 -qmin 0 -qmax 51 -b:v 9000k -spatial-aq 1 -aq-strength 4 -rc-lookahead 32 -surfaces 42 -no-scenecut 1 -refs 4 -nonref_p 1 -strict_gop 0 -bf 4 -g 30 -b_adapt:v 0 -maxrate:v 14M -bufsize:v 9M -bsf:v h264_mp4toannexb -metadata encoding_tool="Hybrid 2021.08.23.1" "/media/b2_TMP/tmp/test_2021-09-21@15_27_18_3010_04.264"
ohne '-preset 1', verwendest, klappt er dann?

Cu Selur
Klappt auch ohne '-preset 1' nicht.

Code:
ffmpeg version git-2021-07-17-c320b78 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
  configuration: --disable-debug --pkg-config-flags=--static --extra-cflags='-O3 -ffunction-sections -fdata-sections -I/home/selur/workspace/HybridDeploy/tools/build/build/libs/include' --extra-ldflags='-Wl,--gc-sections -pthread -L/home/selur/workspace/HybridDeploy/tools/build/build/libs/lib' --ld=g++ --enable-gpl --enable-version3 --disable-ffplay --disable-ffprobe --disable-doc --enable-frei0r --enable-libass --enable-libbluray --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-libtheora --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libkvazaar --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-cuvid --enable-libxcb --enable-libxcb-shm --enable-libxcb-xfixes --enable-libxcb-shape --enable-vaapi --enable-vdpau --enable-openal --enable-libpulse --disable-libjack
  libavutil      57.  0.100 / 57.  0.100
  libavcodec    59.  3.101 / 59.  3.101
  libavformat    59.  4.100 / 59.  4.100
  libavdevice    59.  0.100 / 59.  0.100
  libavfilter    8.  0.103 /  8.  0.103
  libswscale      6.  0.100 /  6.  0.100
  libswresample  4.  0.100 /  4.  0.100
  libpostproc    56.  0.100 / 56.  0.100
Input #0, matroska,webm, from '/media/b3_HOME/Downloads/test.mkv':
  Metadata:
    ENCODER        : Lavf58.76.100
  Duration: 00:43:07.03, start: 0.000000, bitrate: 1506 kb/s
  Stream #0:0(eng): Video: vp9 (Profile 0), yuv420p(tv, bt709), 1920x1080, SAR 1:1 DAR 16:9, 30 fps, 30 tbr, 1k tbn (default)
    Metadata:
      DURATION        : 00:43:06.966000000
  Stream #0:1(eng): Audio: aac (LC), 44100 Hz, stereo, fltp (default)
    Metadata:
      HANDLER_NAME    : ISO Media file produced by Google Inc.
      VENDOR_ID      : [0][0][0][0]
      DURATION        : 00:43:07.028000000
Stream mapping:
  Stream #0:0 -> #0:0 (vp9 (native) -> h264 (h264_nvenc))
[h264_nvenc @ 0x563404e02bc0] Specified rc mode is deprecated.
[h264_nvenc @ 0x563404e02bc0] Use -rc constqp/cbr/vbr, -tune and -multipass instead.
[h264_nvenc @ 0x563404e02bc0] InitializeEncoder failed: invalid param (8): Presets P1 to P7 are not supported with older 2 Pass RC Modes(CBR_HQ, VBR_HQ) and cbr lowdelay.
Enable NV_ENC_RC_PARAMS::multiPass flag for two pass encoding a
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!

Ich schau mir mal das Äquivalent mit aktuellen ffmpeg Optionen an. Da hat sich ja einiges bei ffmpeg geändert.
So sieht das bei ffmpeg (NVEnc h264) jetzt aus:
Code:
h264_nvenc AVOptions:
  -preset            <int>        E..V....... Set the encoding preset (from 0 to 18) (default p4)
    default        0            E..V.......
    slow            1            E..V....... hq 2 passes
    medium          2            E..V....... hq 1 pass
    fast            3            E..V....... hp 1 pass
    hp              4            E..V.......
    hq              5            E..V.......
    bd              6            E..V.......
    ll              7            E..V....... low latency
    llhq            8            E..V....... low latency hq
    llhp            9            E..V....... low latency hp
    lossless        10          E..V.......
    losslesshp      11          E..V.......
    p1              12          E..V....... fastest (lowest quality)
    p2              13          E..V....... faster (lower quality)
    p3              14          E..V....... fast (low quality)
    p4              15          E..V....... medium (default)
    p5              16          E..V....... slow (good quality)
    p6              17          E..V....... slower (better quality)
    p7              18          E..V....... slowest (best quality)
  -tune              <int>        E..V....... Set the encoding tuning info (from 1 to 4) (default hq)
    hq              1            E..V....... High quality
    ll              2            E..V....... Low latency
    ull            3            E..V....... Ultra low latency
    lossless        4            E..V....... Lossless
 

Was ich getestet habe; Bei "rc vbr_hq" keinen "Preset" zulassen, oder einfach die Möglichkeit haben "Preset" zu deaktivieren. Die Preset Optionen von 0-18 aber erweitern. "p7 int  18 slowest (best quality)" scheint z.B. sehr interessant zu sein. Und "tune" einfügen. Falls du das machen kannst teste ich das ausfürlicher.
Werde ich morgen nach der Arbeit mal draufschauen, sollte aber einfach zu implementieren sein.
Schick Dir dann vermutlich morgen Abend nen Link zu ner dev Version zum Testen.

Cu Selur
Alles klar, danke dir für die Mühe.

Vielleicht wäre es auch sinnvoll die Funktionen direkt auch beim hevc encoding einzufügen. Da sind die gleichen Änderungen (ffmpeg) vollzogen worden.
Werde ich machen.

Cu Selur