This encodes all frames progressively yet flags the stream as interlaced.
This makes it possible to encode valid 25p and 30p Blu-Ray streams.
Also put the pulldown help section in a more appropriate place.
param->i_nal_hrd = X264_NAL_HRD_NONE;
param->b_tff = 1;
param->b_pic_struct = 0;
+ param->b_fake_interlaced = 0;
}
static int x264_param_apply_preset( x264_param_t *param, const char *preset )
x264_log( NULL, X264_LOG_ERROR, "baseline profile doesn't support interlacing\n" );
return -1;
}
+ if( param->b_fake_interlaced )
+ x264_log( NULL, X264_LOG_WARNING, "baseline profile doesn't support fake interlacing\n" );
}
else if( !strcasecmp( profile, "main" ) )
{
b_error |= parse_enum( value, x264_nal_hrd_names, &p->i_nal_hrd );
OPT("pic-struct")
p->b_pic_struct = atobool(value);
+ OPT("fake-interlaced")
+ p->b_fake_interlaced = atobool(value);
else
return X264_PARAM_BAD_NAME;
#undef OPT
BOOLIFY( b_annexb );
BOOLIFY( b_vfr_input );
BOOLIFY( b_pic_struct );
+ BOOLIFY( b_fake_interlaced );
BOOLIFY( analyse.b_transform_8x8 );
BOOLIFY( analyse.b_weighted_bipred );
BOOLIFY( analyse.b_chroma_me );
sps->b_gaps_in_frame_num_value_allowed = 0;
sps->i_mb_width = ( param->i_width + 15 ) / 16;
sps->i_mb_height= ( param->i_height + 15 ) / 16;
- if( param->b_interlaced )
+ sps->b_frame_mbs_only = param->b_interlaced ? 0 : !param->b_fake_interlaced;
+ if( !sps->b_frame_mbs_only )
sps->i_mb_height = ( sps->i_mb_height + 1 ) & ~1;
- sps->b_frame_mbs_only = ! param->b_interlaced;
sps->b_mb_adaptive_frame_field = param->b_interlaced;
sps->b_direct8x8_inference = 1;
sps->crop.i_left = 0;
sps->crop.i_top = 0;
sps->crop.i_right = sps->i_mb_width*16 - param->i_width;
- sps->crop.i_bottom = (sps->i_mb_height*16 - param->i_height) >> param->b_interlaced;
+ sps->crop.i_bottom = (sps->i_mb_height*16 - param->i_height) >> !sps->b_frame_mbs_only;
sps->b_crop = sps->crop.i_left || sps->crop.i_top ||
sps->crop.i_right || sps->crop.i_bottom;
CHECK( "VBV buffer", (l->cpb * cbp_factor) / 4, h->param.rc.i_vbv_buffer_size );
CHECK( "MV range", l->mv_range, h->param.analyse.i_mv_range );
CHECK( "interlaced", !l->frame_only, h->param.b_interlaced );
+ CHECK( "fake interlaced", !l->frame_only, h->param.b_fake_interlaced );
if( h->param.i_fps_den > 0 )
CHECK( "MB rate", l->mbps, (int64_t)mbs * h->param.i_fps_num / h->param.i_fps_den );
H0( " --tff Enable interlaced mode (top field first)\n" );
H0( " --bff Enable interlaced mode (bottom field first)\n" );
H2( " --constrained-intra Enable constrained intra prediction.\n" );
+ H0( " --pulldown <string> Use soft pulldown to change frame rate\n"
+ " - none, 22, 32, 64, double, triple, euro (requires cfr input)\n" );
+ H2( " --fake-interlaced Flag stream as interlaced but encode progressive.\n"
+ " Makes it possible to encode 25p and 30p Blu-Ray\n"
+ " streams. Ignored in interlaced mode.\n" );
H0( "\n" );
H0( "Ratecontrol:\n" );
H0( "\n" );
H2( " --timebase <int/int> Specify timebase numerator and denominator\n"
" <integer> Specify timebase numerator for input timecode file\n"
" or specify timebase denominator for other input\n" );
- H0( " --pulldown <string> Use soft pulldown to change frame rate\n"
- " - none, 22, 32, 64, double, triple, euro (requires cfr input)\n" );
H0( "\n" );
}
{ "pic-struct", no_argument, NULL, 0 },
{ "nal-hrd", required_argument, NULL, 0 },
{ "pulldown", required_argument, NULL, OPT_PULLDOWN },
+ { "fake-interlaced", no_argument, NULL, 0 },
{0, 0, 0, 0}
};
#include <stdarg.h>
-#define X264_BUILD 95
+#define X264_BUILD 96
/* x264_t:
* opaque handler for encoder */
int b_pic_struct;
+ /* Fake Interlaced.
+ *
+ * Used only when b_interlaced=0. Setting this flag to zero makes it possible to flag the stream as PAFF interlaced yet
+ * encode all frames progessively. It is useful for encoding 25p and 30p Blu-Ray streams.
+ */
+
+ int b_fake_interlaced;
+
/* Slicing parameters */
int i_slice_max_size; /* Max size per slice in bytes; includes estimated NAL overhead. */
int i_slice_max_mbs; /* Max number of MBs per slice; overrides i_slice_count. */