As you know ref
parameter can set the number of previous frames each P-frame can use as references.
I need the same thing for B-Frames, but ref=1
does not work for B-Frames.
I mean an I/P frame to be used as reference for B-frames only.
is it possible with a command line? , or by change the following function in the source code ?
static inline int reference_update( x264_t *h )
{
if( !h->fdec->b_kept_as_ref )
{
if( h->i_thread_frames > 1 )
{
x264_frame_push_unused( h, h->fdec );
h->fdec = x264_frame_pop_unused( h, 1 );
if( !h->fdec )
return -1;
}
return 0;
}
/* apply mmco from previous frame. */
for( int i = 0; i < h->sh.i_mmco_command_count; i++ )
for( int j = 0; h->frames.reference[j]; j++ )
if( h->frames.reference[j]->i_poc == h->sh.mmco[i].i_poc )
x264_frame_push_unused( h, x264_frame_shift( &h->frames.reference[j] ) );
/* move frame in the buffer */
x264_frame_push( h->frames.reference, h->fdec );
if( h->frames.reference[h->sps->i_num_ref_frames] )
x264_frame_push_unused( h, x264_frame_shift( h->frames.reference ) );
h->fdec = x264_frame_pop_unused( h, 1 );
if( !h->fdec )
return -1;
return 0;
}
No. B-frame is by definition bidirectional i.e. it must have at least 2 reference frames (one before and one after in presentation order), otherwise it does not make sense at all and it will not differ from the P-frame.