"a level compatible with the rest of the encoding options. Range 1 to 5.1 " \
"(10 to 51 is also allowed).")
+#define PROFILE_TEXT N_("H.264 profile")
+#define PROFILE_LONGTEXT N_("Specify H.264 profile which limits are enforced over" \
+ "other settings" )
+
/* In order to play an interlaced output stream encoded by x264, a decoder needs
mbaff support. r570 is using the 'mb' part and not 'aff' yet; so it's really
'pure-interlaced' mode */
#if X264_BUILD >= 59
#define AQ_MODE_TEXT N_("How AQ distributes bits")
-#define AQ_MODE_LONGTEXT N_("Defines bitdistribution mode for AQ, default 2\n" \
+#define AQ_MODE_LONGTEXT N_("Defines bitdistribution mode for AQ, default 1\n" \
" - 0: Disabled\n"\
- " - 1: Avoid moving bits between frames\n"\
- " - 2: Move bits between frames")
+ " - 1: Current x264 default mode\n"\
+ " - 2: uses log(var)^2 instead of log(var) and attempts to adapt strength per frame")
#define AQ_STRENGTH_TEXT N_("Strength of AQ")
#define AQ_STRENGTH_LONGTEXT N_("Strength to reduce blocking and blurring in flat\n"\
{ N_("dia"), N_("hex"), N_("umh"), N_("esa"), N_("tesa") };
#endif
+static const char *const profile_list[] =
+ { "baseline", "main", "high" };
+
static const char *const enc_analyse_list[] =
{ "none", "fast", "normal", "slow", "all" };
static const char *const enc_analyse_list_text[] =
add_string( SOUT_CFG_PREFIX "level", "5.1", NULL, LEVEL_TEXT,
LEVEL_LONGTEXT, false )
+ add_string( SOUT_CFG_PREFIX "profile", "high", NULL, PROFILE_TEXT,
+ PROFILE_LONGTEXT, false )
+ change_string_list( profile_list, profile_list, 0 );
+
#if X264_BUILD >= 51 /* r570 */
add_bool( SOUT_CFG_PREFIX "interlaced", 0, NULL, INTERLACED_TEXT, INTERLACED_LONGTEXT,
false )
add_float( SOUT_CFG_PREFIX "qblur", 0.5, NULL, QBLUR_TEXT,
QBLUR_LONGTEXT, false )
#if X264_BUILD >= 59
- add_integer( SOUT_CFG_PREFIX "aq-mode", 2, NULL, AQ_MODE_TEXT,
+ add_integer( SOUT_CFG_PREFIX "aq-mode", X264_AQ_VARIANCE, NULL, AQ_MODE_TEXT,
AQ_MODE_LONGTEXT, false )
change_integer_range( 0, 2 )
add_float( SOUT_CFG_PREFIX "aq-strength", 1.0, NULL, AQ_STRENGTH_TEXT,
"qpmin", "qp-max", "qp-min", "quiet", "ratetol", "ref", "scenecut",
"sps-id", "ssim", "stats", "subme", "subpel", "tolerance", "trellis",
"verbose", "vbv-bufsize", "vbv-init", "vbv-maxrate", "weightb", "aq-mode",
- "aq-strength", "psy-rd", NULL
+ "aq-strength", "psy-rd", "profile", NULL
};
static block_t *Encode( encoder_t *, picture_t * );
#endif
- /* Check qcomp in here, to see if user want CBR (ABR) or do we use CRF/QP */
var_Get( p_enc, SOUT_CFG_PREFIX "qcomp", &val );
p_sys->param.rc.f_qcompress = val.f_float;
- /* Enable ABR if qcomp near 0.0 */
- if( val.f_float <= 0.1 )
+
+ /* transcode-default bitrate is 0,
+ * set more to ABR if user specifies bitrate */
+ if( p_enc->fmt_out.i_bitrate > 0 )
{
+ p_sys->param.rc.i_bitrate = p_enc->fmt_out.i_bitrate / 1000;
#if X264_BUILD < 48
/* cbr = 1 overrides qp or crf and sets an average bitrate
but maxrate = average bitrate is needed for "real" CBR */
#endif
}
- /* average bitrate specified by transcode vb, define if not QP-encode*/
- if( p_sys->param.rc.i_rc_method != X264_RC_CQP )
- p_sys->param.rc.i_bitrate = p_enc->fmt_out.i_bitrate / 1000;
#if X264_BUILD >= 24
var_Get( p_enc, SOUT_CFG_PREFIX "ratetol", &val );
var_Get( p_enc, SOUT_CFG_PREFIX "vbv-bufsize", &val );
p_sys->param.rc.i_vbv_buffer_size = val.i_int;
- /* x264 vbv-bufsize = 0 (default). if not provided set period
- in seconds for local maximum bitrate (cache/bufsize) based
- on average bitrate. */
- if( !val.i_int )
- p_sys->param.rc.i_vbv_buffer_size = p_sys->param.rc.i_bitrate * 2;
-
/* max bitrate = average bitrate -> CBR */
var_Get( p_enc, SOUT_CFG_PREFIX "vbv-maxrate", &val );
#if X264_BUILD >= 48
}
else if( !strcmp( val.psz_string, "all" ) )
{
- p_sys->param.analyse.inter =
- X264_ANALYSE_I4x4 |
- X264_ANALYSE_PSUB16x16 |
- X264_ANALYSE_BSUB16x16 |
- X264_ANALYSE_PSUB8x8;
-#ifdef X264_ANALYSE_I8x8
- p_sys->param.analyse.inter |= X264_ANALYSE_I8x8;
-#endif
+ p_sys->param.analyse.inter = ~0;
}
free( val.psz_string );
p_sys->param.i_fps_den = p_enc->fmt_in.video.i_frame_rate_base;
}
+ /* x264 vbv-bufsize = 0 (default). if not provided set period
+ in seconds for local maximum bitrate (cache/bufsize) based
+ on average bitrate when use has told bitrate.
+ vbv-buffer size is set to bitrate * secods between keyframes */
+ if( !p_sys->param.rc.i_vbv_buffer_size &&
+ p_sys->param.rc.i_rc_method == X264_RC_ABR &&
+ p_sys->param.i_fps_num )
+ {
+ p_sys->param.rc.i_vbv_buffer_size = p_sys->param.rc.i_bitrate *
+ p_sys->param.i_fps_den;
+#if X264_BUILD >= 0x000e
+ p_sys->param.rc.i_vbv_buffer_size *= p_sys->param.i_keyint_max;
+#else
+ p_sys->param.rc.i_vbv_buffer_size *= p_sys->param.i_idrframe;
+#endif
+ p_sys->param.rc.i_vbv_buffer_size /= p_sys->param.i_fps_num;
+ }
+
+ /* Check if user has given some profile (baseline,main,high) to limit
+ * settings, and apply those*/
+ var_Get( p_enc, SOUT_CFG_PREFIX "profile", &val );
+ if( val.psz_string )
+ {
+ if( !strcasecmp( val.psz_string, "baseline" ) )
+ {
+ msg_Dbg( p_enc, "Limiting to baseline profile");
+ p_sys->param.analyse.b_transform_8x8 = 0;
+ p_sys->param.b_cabac = 0;
+ p_sys->param.i_bframe = 0;
+ }
+ else if (!strcasecmp( val.psz_string, "main" ) )
+ {
+ msg_Dbg( p_enc, "Limiting to main-profile");
+ p_sys->param.analyse.b_transform_8x8 = 0;
+ }
+ /* high profile don't restrict stuff*/
+ }
+ free( val.psz_string );
+
+
unsigned i_cpu = vlc_CPU();
if( !(i_cpu & CPU_CAPABILITY_MMX) )
{