[FFmpeg-devel] FFMPEG support for x265 vbv-end and vbv-end-fr-adj
Tom Vaughan
tom at tvaughan.com
Thu May 2 00:10:51 EEST 2024
When I attempt to pass vbv-end and vbv-end-fr-adj parameters to x265, FFMPEG fails.
x265 [error]: vbv-end-fr-adj cannot be enabled when total number of frames is unknown
x265 needs to know how many frames it is encoding so that it knows when the vbv-end logic needs to kick in. In this case it would be after 96% of the source video is encoded. Despite specifying a duration of 30 seconds ( -t 30 ) on both input and output (using a 60 second source video), x265 does not know the total number of frames (but FFMPEG surely does).
ffmpeg -i test_uhdsdr_1min.mov -t 30 -an -sn -dn -c:v libx265 -b:v 12000k -maxrate 8M -bufsize 18M -x265-params vbv-init=0.9:vbv-end=0.9:vbv-end-fr-adj=.96:rc-lookahead=48:qg-size=32:scenecut=0:no-open-gop=1:frame-threads=0:repeat-headers=1:nr-inter=400:nr-intra=100:psy-rd=0:cbqpoffs=0:crqpoffs=3 -t 30 test_uhdsdr_96.mp4
ffmpeg version 6.1.1 Copyright (c) 2000-2023 the FFmpeg developers
built with Apple clang version 15.0.0 (clang-1500.1.0.2.5)
configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/6.1.1_3 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags='-Wl,-ld_classic' --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libharfbuzz --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopenvino --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-audiotoolbox --enable-neon
libavutil 58. 29.100 / 58. 29.100
libavcodec 60. 31.102 / 60. 31.102
libavformat 60. 16.100 / 60. 16.100
libavdevice 60. 3.100 / 60. 3.100
libavfilter 9. 12.100 / 9. 12.100
libswscale 7. 5.100 / 7. 5.100
libswresample 4. 12.100 / 4. 12.100
libpostproc 57. 3.100 / 57. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test_uhdsdr_1min.mov':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
encoder : Lavf60.3.100
Duration: 00:01:00.06, start: 0.000000, bitrate: 693020 kb/s
Stream #0:0[0x1]: Video: prores (HQ) (apch / 0x68637061), yuv422p10le(bt709, progressive), 3840x2160, 693017 kb/s, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 24k tbn (default)
Metadata:
handler_name : VideoHandler
vendor_id : FFMP
encoder : Apple ProRes 422 (HQ)
timecode : 00:00:00:00
Stream #0:1[0x2](eng): Data: none (tmcd / 0x64636D74)
Metadata:
handler_name : TimeCodeHandler
timecode : 00:00:00:00
Stream mapping:
Stream #0:0 -> #0:0 (prores (native) -> hevc (libx265))
Press [q] to stop, [?] for help
x265 [info]: HEVC encoder version 3.4+31-6722fce1f
x265 [info]: build info [Mac OS X][clang 14.0.0][32 bit][noasm] 10bit
x265 [info]: using cpu capabilities: none!
x265 [error]: vbv-end-fr-adj cannot be enabled when total number of frames is unknown
[libx265 @ 0x120706a30] Cannot open libx265 encoder.
[vost#0:0/libx265 @ 0x1207067c0] Error while opening encoder - maybe incorrect parameters such as bit_rate, rate, width or height.
Error while filtering: Invalid data found when processing input
[out#0/mp4 @ 0x600002dc0240] Nothing was written into output file, because at least one of its streams received no packets.
frame= 0 fps=0.0 q=0.0 Lsize= 0kB time=N/A bitrate=N/A speed=N/A
Conversion failed!
Running x265 directly (using the decoded YUV in a Y4M container as the source) with the same parameters works fine.
x265 --input test_uhdsdr_1min.Y4M --y4m --bitrate 12000 --profile main10 --keyint 48 --no-open-gop --scenecut 0 --vbv-init 0.9 --vbv-maxrate 18000 --vbv-bufsize 18000 --vbv-end 0.9 --vbv-end-fr-adj .96 --csv fr_adj_96.csv --csv-log-level 1 -o test_UHDSDR_12000_fr_adj_20.265
y4m [info]: 3840x2160 fps 24000/1001 i420p10 sar 1:1 frames 0 - 1438 of 1439
raw [info]: output file: test_UHDSDR_12000_fr_adj_20.265
x265 [info]: HEVC encoder version 3.6+7-53afbf5f5
x265 [info]: build info [Mac OS X][GCC 13.2.0][64 bit] 10bit
x265 [info]: using cpu capabilities: NEON
x265 [info]: Main 10 profile, Level-5 (Main tier)
x265 [info]: Thread pool created using 8 threads
x265 [info]: Slices : 1
x265 [info]: frame threads / pool features : 3 / wpp(34 rows)
x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge : hex / 57 / 2 / 3
x265 [info]: Lookahead / bframes / badapt : 20 / 4 / 2
x265 [info]: b-pyramid / weightp / weightb : 1 / 1 / 0
x265 [info]: References / ref-limit cu / depth : 3 / off / on
x265 [info]: AQ: mode / str / qg-size / cu-tree : 2 / 1.0 / 32 / 1
x265 [info]: Rate Control / qCompress : ABR-12000 kbps / 0.60
x265 [info]: VBV/HRD buffer / max-rate / init / end / fr-adj: 18000 / 18000 / 0.900 / 0.900 / 0.960
x265 [info]: tools: rd=3 psy-rd=2.00 early-skip rskip mode=1 signhide tmvp
x265 [info]: tools: b-intra strong-intra-smoothing lslices=8 deblock sao
x265 [info]: frame I: 30, Avg QP:33.26 kb/s: 53324.81
x265 [info]: frame P: 318, Avg QP:35.26 kb/s: 21643.30
x265 [info]: frame B: 1091, Avg QP:37.73 kb/s: 8003.99
x265 [info]: Weighted P-Frames: Y:11.6% UV:9.4%
encoded 1439 frames in 937.04s (1.54 fps), 11962.94 kb/s, Avg QP:37.09
Tom Vaughan
More information about the ffmpeg-devel
mailing list