Opened 6 months ago

#9874 new defect

hevc_nvenc is missing b_adapt option

Reported by: lincutt Owned by:
Priority: normal Component: avcodec
Version: git-master Keywords: nvenc hevc b_adapt
Cc: lincutt Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
According to NVENC Video Encoder API Programming Guide,
nvenc should support -b_adapt with look -rc-lookahead.
h264_nvenc.c has -b_adapt option, but hevc_nvenc.c is not.

How to reproduce:
PS D:\rigaya hwenc> .\ffmpeg.exe -y -v verbose -strict 2 -hwaccel vulkan -i .\tmp2.mkv -filter_complex "[0:v][0:s]overlay[v]" -map "[v]" -map 0:a -b:v 0 -maxrate:v 16777216 -bufsize:v 67108864 -bf 5 -qmin 1 -qmax 51 -qdiff 5 -g 240 -c:v hevc_nvenc -preset p7 -profile:v main10 -tier high -rc:v vbr -cq 26 -rc-lookahead 32 -b_ref_mode each -multipass fullres -2pass true -spatial-aq true -temporal-aq true -nonref_p true -tune hq -init_qpI 26 -init_qpP 26 -init_qpB 26 -b_adapt true -c:a libopus -b:a 128k -ac 2 -pix_fmt p010le -color_primaries bt709 -color_trc bt709 -colorspace bt709 -color_range tv -tag:v? hvc1 -movflags +faststart -sn -map_metadata -1 -map_chapters -1 -metadata:s:v:0 language=chi -metadata:s:a:0 language=jpn -report test2.mp4
ffmpeg started on 2022-08-14 at 19:55:44
Report written to "ffmpeg-20220814-195544.log"
Log level: 48
ffmpeg version N-107780-g6ded80af92-20220813 Copyright (c) 2000-2022 the FFmpeg developers

built with gcc 12.1.0 (crosstool-NG 1.25.0.55_3defb7b)
configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-version3 --disable-debug --enable-shared --disable-static --disable-w32threads --enable-pthreads --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --disable-libpulse --enable-libvmaf --disable-libxcb --disable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librist --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libmfx --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --disable-libdrm --disable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags= --extra-libs=-lgomp --extra-version=20220813
libavutil 57. 33.100 / 57. 33.100
libavcodec 59. 42.101 / 59. 42.101
libavformat 59. 30.100 / 59. 30.100
libavdevice 59. 8.101 / 59. 8.101
libavfilter 8. 46.101 / 8. 46.101
libswscale 6. 8.102 / 6. 8.102
libswresample 4. 8.100 / 4. 8.100
libpostproc 56. 7.100 / 56. 7.100

Routing option strict to both codec and muxer layer
[matroska,webm @ 000001e6801fc080] max_analyze_duration 5000000 reached at 5005000 microseconds st:0
[matroska,webm @ 000001e6801fc080] Could not find codec parameters for stream 2 (Subtitle: hdmv_pgs_subtitle (pgssub)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Input #0, matroska,webm, from '.\tmp2.mkv':

Metadata:

ENCODER : Lavf59.27.100

Duration: 00:02:00.16, start: 0.000000, bitrate: 18004 kb/s
Stream #0:0: Video: hevc (Main 10), 1 reference frame, yuv420p10le(tv, bt709, left), 1920x1080, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 1k tbn (default)

Metadata:

DURATION : 00:02:00.161000000

Stream #0:1: Audio: flac, 48000 Hz, 7.1, s32 (24 bit) (default)

Metadata:

DURATION : 00:02:00.063000000

Stream #0:2: Subtitle: hdmv_pgs_subtitle

Metadata:

DURATION : 00:01:56.366000000

Codec AVOption b_adapt (When lookahead is enabled, set this to 0 to disable adaptive B-frame decision) specified for output file #0 (test2.mp4) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
[AVHWDeviceContext @ 000001e681f0d900] Supported validation layers:
[AVHWDeviceContext @ 000001e681f0d900] VK_LAYER_NV_optimus
[AVHWDeviceContext @ 000001e681f0d900] VK_LAYER_AMD_switchable_graphics
[AVHWDeviceContext @ 000001e681f0d900] VK_LAYER_OBS_HOOK
[AVHWDeviceContext @ 000001e681f0d900] VK_LAYER_VALVE_steam_overlay
[AVHWDeviceContext @ 000001e681f0d900] VK_LAYER_VALVE_steam_fossilize
[AVHWDeviceContext @ 000001e681f0d900] GPU listing:
[AVHWDeviceContext @ 000001e681f0d900] 0: AMD Radeon(TM) Graphics (integrated) (0x1638)
[AVHWDeviceContext @ 000001e681f0d900] 1: NVIDIA GeForce RTX 3050 Ti Laptop GPU (discrete) (0x25a0)
[AVHWDeviceContext @ 000001e681f0d900] Device 0 selected: AMD Radeon(TM) Graphics (integrated) (0x1638)
[AVHWDeviceContext @ 000001e681f0d900] Queue families:
[AVHWDeviceContext @ 000001e681f0d900] 0: graphics compute transfer sparse (queues: 1)
[AVHWDeviceContext @ 000001e681f0d900] 1: compute transfer sparse (queues: 2)
[AVHWDeviceContext @ 000001e681f0d900] 2: transfer sparse (queues: 1)
[AVHWDeviceContext @ 000001e681f0d900] Using device extension VK_KHR_sampler_ycbcr_conversion
[AVHWDeviceContext @ 000001e681f0d900] Using device extension VK_KHR_synchronization2
[AVHWDeviceContext @ 000001e681f0d900] Using device extension VK_EXT_external_memory_host
[AVHWDeviceContext @ 000001e681f0d900] Using device extension VK_KHR_external_memory_win32
[AVHWDeviceContext @ 000001e681f0d900] Using device extension VK_KHR_external_semaphore_win32
[AVHWDeviceContext @ 000001e681f0d900] Using device: AMD Radeon(TM) Graphics
[AVHWDeviceContext @ 000001e681f0d900] Alignments:
[AVHWDeviceContext @ 000001e681f0d900] optimalBufferCopyRowPitchAlignment: 1
[AVHWDeviceContext @ 000001e681f0d900] minMemoryMapAlignment: 64
[AVHWDeviceContext @ 000001e681f0d900] minImportedHostPointerAlignment: 4096
[AVHWDeviceContext @ 000001e681f0d900] Using queue family 0 (queues: 1) for graphics
[AVHWDeviceContext @ 000001e681f0d900] Using queue family 2 (queues: 1) for transfers
[AVHWDeviceContext @ 000001e681f0d900] Using queue family 1 (queues: 2) for compute
Stream mapping:

Stream #0:0 (hevc) -> overlay (graph 0)
Stream #0:2 (pgssub) -> overlay (graph 0)
overlay:default (graph 0) -> Stream #0:0 (hevc_nvenc)
Stream #0:1 -> #0:1 (flac (native) -> opus (libopus))

Press [q] to stop, ? for help
[graph 0 input from stream 0:0 @ 000001e68d667f00] w:1920 h:1080 pixfmt:yuv420p10le tb:1/1000 fr:24000/1001 sar:1/1
[matroska,webm @ 000001e6801fc080] sub2video: using 1920x1080 canvas
[graph 0 input from stream 0:2 @ 000001e68d667a00] w:1920 h:1080 pixfmt:bgra tb:1/1000 fr:0/1 sar:0/1
[auto_scale_0 @ 000001e68d667e00] w:iw h:ih flags: interl:0
[Parsed_overlay_0 @ 000001e68d667700] auto-inserting filter 'auto_scale_0' between the filter 'graph 0 input from stream 0:0' and the filter 'Parsed_overlay_0'
[auto_scale_1 @ 000001e68d667200] w:iw h:ih flags:
interl:0
[Parsed_overlay_0 @ 000001e68d667700] auto-inserting filter 'auto_scale_1' between the filter 'graph 0 input from stream 0:2' and the filter 'Parsed_overlay_0'
[auto_scale_2 @ 000001e68d666a00] w:iw h:ih flags: interl:0
[format @ 000001e68d667100] auto-inserting filter 'auto_scale_2' between the filter 'Parsed_overlay_0' and the filter 'format'
[auto_scale_0 @ 000001e68d667e00] w:1920 h:1080 fmt:yuv420p10le sar:1/1 -> w:1920 h:1080 fmt:yuva420p sar:1/1 flags:0x0
[auto_scale_1 @ 000001e68d667200] w:1920 h:1080 fmt:bgra sar:0/1 -> w:1920 h:1080 fmt:yuva420p sar:0/1 flags:0x0
[Parsed_overlay_0 @ 000001e68d667700] main w:1920 h:1080 fmt:yuva420p overlay w:1920 h:1080 fmt:yuva420p
[Parsed_overlay_0 @ 000001e68d667700] [framesync @ 000001e68011ed68] Selected 1/1000 time base
[Parsed_overlay_0 @ 000001e68d667700] [framesync @ 000001e68011ed68] Sync level 2
[auto_scale_2 @ 000001e68d666a00] w:1920 h:1080 fmt:yuva420p sar:1/1 -> w:1920 h:1080 fmt:p010le sar:1/1 flags:0x0
[auto_scale_0 @ 000001e68d667e00] w:1920 h:1080 fmt:yuv420p10le sar:1/1 -> w:1920 h:1080 fmt:yuva420p sar:1/1 flags:0x0

Last message repeated 2 times

[auto_scale_2 @ 000001e68d666a00] w:1920 h:1080 fmt:yuva420p sar:1/1 -> w:1920 h:1080 fmt:p010le sar:1/1 flags:0x0

Last message repeated 2 times

[hevc_nvenc @ 000001e6800ff3c0] Loaded Nvenc version 11.1
[hevc_nvenc @ 000001e6800ff3c0] Nvenc initialized successfully
[hevc_nvenc @ 000001e6800ff3c0] 1 CUDA capable devices found
[hevc_nvenc @ 000001e6800ff3c0] [ GPU #0 - < NVIDIA GeForce RTX 3050 Ti Laptop GPU > has Compute SM 8.6 ]
[hevc_nvenc @ 000001e6800ff3c0] supports NVENC
[hevc_nvenc @ 000001e6800ff3c0] AQ enabled.
[hevc_nvenc @ 000001e6800ff3c0] Temporal AQ enabled.
[hevc_nvenc @ 000001e6800ff3c0] Lookahead enabled: depth 32, scenecut enabled, B-adapt disabled.
[hevc_nvenc @ 000001e6800ff3c0] CQ(6656) mode enabled.
[graph_1_in_0_1 @ 000001e69448d540] tb:1/48000 samplefmt:s32 samplerate:48000 chlayout:7.1
[format_out_0_1 @ 000001e69448f740] auto-inserting filter 'auto_aresample_0' between the filter 'Parsed_anull_0' and the filter 'format_out_0_1'
[auto_aresample_0 @ 000001e69448e240] ch:8 chl:7.1 fmt:s32 r:48000Hz -> ch:2 chl:stereo fmt:flt r:48000Hz
Output #0, mp4, to 'test2.mp4':

Metadata:

encoder : Lavf59.30.100

Stream #0:0(chi): Video: hevc (Main 10), 1 reference frame (hvc1 / 0x31637668), p010le(tv, bt709, progressive, left), 1920x1080 (0x0) [SAR 1:1 DAR 16:9], q=2-31, 23.98 fps, 24k tbn

Metadata:

encoder : Lavc59.42.101 hevc_nvenc

Side data:

cpb: bitrate max/min/avg: 16777216/0/0 buffer size: 67108864 vbv_delay: N/A

Stream #0:1(jpn): Audio: opus (Opus / 0x7375704F), 48000 Hz, stereo, flt, delay 312, 128 kb/s (default)

Metadata:

encoder : Lavc59.42.101 libopus

* 1 dup!7 fps=126 q=21.0 size= 45824kB time=00:01:57.81 bitrate=3186.3kbits/s speed=5.32x
[Parsed_overlay_0 @ 000001e68d667700] [framesync @ 000001e68011ed68] Sync level 1
102976151 frame duplication too large, skipping
[Parsed_overlay_0 @ 000001e68d667700] [framesync @ 000001e68011ed68] Sync level 0
No more output streams to write to, finishing.
All streams finished for output file #0
Terminating muxer thread 0
[mp4 @ 000001e6800f4b80] Starting second pass: moving the moov atom to the beginning of the file
[AVIOContext @ 000001e69415a040] Statistics: 47893539 bytes read, 0 seeks
[AVIOContext @ 000001e6801f7840] Statistics: 95881824 bytes written, 4 seeks, 369 writeouts
frame= 2881 fps=126 q=21.0 Lsize= 46864kB time=00:02:00.05 bitrate=3197.8kbits/s dup=1 drop=1 speed=5.26x
video:44698kB audio:2073kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.197968%
Input file #0 (.\tmp2.mkv):

Input stream #0:0 (video): 2880 packets read (224052238 bytes); 2880 frames decoded;
Input stream #0:1 (audio): 1407 packets read (46076940 bytes); 1407 frames decoded (5763072 samples);
Input stream #0:2 (subtitle): 21 packets read (255647 bytes); 11 frames decoded;
Total: 4308 packets (270384825 bytes) demuxed

Output file #0 (test2.mp4):

Output stream #0:0 (video): 2881 frames encoded; 2881 packets muxed (45770976 bytes);
Output stream #0:1 (audio): 6004 frames encoded (5763072 samples); 6004 packets muxed (2122519 bytes);
Total: 8885 packets (47893495 bytes) muxed

[hevc_nvenc @ 000001e6800ff3c0] Nvenc unloaded
[AVIOContext @ 000001e6800f5040] Statistics: 270423630 bytes read, 0 seeks

Change History (0)

Note: See TracTickets for help on using tickets.