[FFmpeg-devel] FFMPEG support for x265 vbv-end and vbv-end-fr-adj

Michael Niedermayer michael at niedermayer.cc
Wed May 15 15:59:36 EEST 2024


On Wed, May 01, 2024 at 09:10:51PM +0000, Tom Vaughan wrote:
> 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

you can specify total_frames along with vbv-end-fr

there is in general not a 1:1 correspondance between duration and the number of frames
the frame rate may vary, there may be skiped frames or damaged frames that
where lost and so on.

in case of some 2 pass mode it should be possible to get the exact number of frames
in the 2nd pass.
Otherwise my gut feelng is that a time based instead of a frame number based
threshold would have been easier to work with

if you are thinking that the total frame number should be set automatically
and not by hand. I agree, its just not easy to do that in all cases.
It could maybe be done in specific cases but in the general case
it would need 2 passes to be reliable.

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Dictatorship: All citizens are under surveillance, all their steps and
actions recorded, for the politicians to enforce control.
Democracy: All politicians are under surveillance, all their steps and
actions recorded, for the citizens to enforce control.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20240515/bd072394/attachment.sig>


More information about the ffmpeg-devel mailing list