Allows generation of hard-CBR streams without using NAL HRD.
Useful if you want to be able to reconfigure the bitrate (which you can't do
with NAL HRD on).
p->b_vfr_input = !atobool(value);
OPT("nal-hrd")
b_error |= parse_enum( value, x264_nal_hrd_names, &p->i_nal_hrd );
+ OPT("filler")
+ p->rc.b_filler = atobool(value);
OPT("pic-struct")
p->b_pic_struct = atobool(value);
OPT("fake-interlaced")
s += sprintf( s, " qp=%d", p->rc.i_qp_constant );
if( p->rc.i_vbv_buffer_size )
- s += sprintf( s, " nal_hrd=%s", x264_nal_hrd_names[p->i_nal_hrd] );
+ s += sprintf( s, " nal_hrd=%s filler=%d", x264_nal_hrd_names[p->i_nal_hrd], p->rc.b_filler );
if( p->crop_rect.i_left | p->crop_rect.i_top | p->crop_rect.i_right | p->crop_rect.i_bottom )
s += sprintf( s, " crop_rect=%u,%u,%u,%u", p->crop_rect.i_left, p->crop_rect.i_top,
p->crop_rect.i_right, p->crop_rect.i_bottom );
h->param.rc.i_bitrate = h->param.rc.i_vbv_buffer_size * fps_num / fps_den;
h->param.rc.i_rc_method = X264_RC_ABR;
h->param.rc.f_vbv_buffer_init = 1.0;
+ h->param.rc.b_filler = 1;
h->param.i_cqm_preset = X264_CQM_CUSTOM;
memcpy( h->param.cqm_4iy, x264_cqm_jvt4i, sizeof(h->param.cqm_4iy) );
memcpy( h->param.cqm_4ic, avcintra_lut[type][res][i].cqm_4ic, sizeof(h->param.cqm_4ic) );
h->param.i_nal_hrd = X264_NAL_HRD_VBR;
}
+ if( h->param.i_nal_hrd == X264_NAL_HRD_CBR )
+ h->param.rc.b_filler = 1;
+
/* ensure the booleans are 0 or 1 so they can be used in math */
#define BOOLIFY(x) h->param.x = !!h->param.x
BOOLIFY( b_cabac );
BOOLIFY( rc.b_stat_write );
BOOLIFY( rc.b_stat_read );
BOOLIFY( rc.b_mb_tree );
+ BOOLIFY( rc.b_filler );
#undef BOOLIFY
return 0;
x264_log( h, X264_LOG_WARNING, "VBV parameters cannot be changed when NAL HRD is in use\n" );
return;
}
- if( h->param.b_avcintra_compat )
- h->sps->vui.hrd.b_cbr_hrd = 1;
h->sps->vui.hrd.i_bit_rate_unscaled = vbv_max_bitrate;
h->sps->vui.hrd.i_cpb_size_unscaled = vbv_buffer_size;
else
rct->buffer_fill_final += (uint64_t)bitrate * h->sps->vui.i_num_units_in_tick * h->fenc->i_cpb_duration;
- if( h->sps->vui.hrd.b_cbr_hrd && rct->buffer_fill_final > buffer_size )
+ if( h->param.rc.b_filler && rct->buffer_fill_final > buffer_size )
{
int64_t scale = (int64_t)h->sps->vui.i_time_scale * 8;
filler = (rct->buffer_fill_final - buffer_size + scale - 1) / scale;
H2( " --nal-hrd <string> Signal HRD information (requires vbv-bufsize)\n"
" - none, vbr, cbr (cbr not allowed in .mp4)\n" );
+ H2( " --filler Force hard-CBR and generate filler (implied by\n"
+ " --nal-hrd cbr)\n" );
H2( " --pic-struct Force pic_struct in Picture Timing SEI\n" );
H2( " --crop-rect <string> Add 'left,top,right,bottom' to the bitstream-level\n"
" cropping rectangle\n" );
{ "output-csp", required_argument, NULL, OPT_OUTPUT_CSP },
{ "input-range", required_argument, NULL, OPT_INPUT_RANGE },
{ "stitchable", no_argument, NULL, 0 },
+ { "filler", no_argument, NULL, 0 },
{0, 0, 0, 0}
};
#include "x264_config.h"
-#define X264_BUILD 138
+#define X264_BUILD 139
/* Application developers planning to link against a shared library version of
* libx264 from a Microsoft Visual Studio or similar development environment
float f_ip_factor;
float f_pb_factor;
+ /* VBV filler: force CBR VBV and use filler bytes to ensure hard-CBR.
+ * Implied by NAL-HRD CBR. */
+ int b_filler;
+
int i_aq_mode; /* psy adaptive QP. (X264_AQ_*) */
float f_aq_strength;
int b_mb_tree; /* Macroblock-tree ratecontrol. */