return -1;
overhead += h->out.nal[h->out.i_nal-1].i_payload + SEI_OVERHEAD;
}
+ }
- if( h->param.i_frame_packing >= 0 )
- {
- x264_nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
- x264_sei_frame_packing_write( h, &h->out.bs );
- if( x264_nal_end( h ) )
- return -1;
- overhead += h->out.nal[h->out.i_nal-1].i_payload + SEI_OVERHEAD;
- }
+ if( h->param.i_frame_packing >= 0 && (h->fenc->b_keyframe || h->param.i_frame_packing == 5) )
+ {
+ x264_nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE );
+ x264_sei_frame_packing_write( h, &h->out.bs );
+ if( x264_nal_end( h ) )
+ return -1;
+ overhead += h->out.nal[h->out.i_nal-1].i_payload + SEI_OVERHEAD;
}
/* generate sei pic timing */
bs_write( &q, 4, 0 ); // frame1_grid_position_y
}
bs_write( &q, 8, 0 ); // frame_packing_arrangement_reserved_byte
- bs_write_ue( &q, 1 ); // frame_packing_arrangement_repetition_period
+ // "frame_packing_arrangement_repetition_period equal to 1 specifies that the frame packing arrangement SEI message persists in output"
+ // for (i_frame_packing == 5) this will undermine current_frame_is_frame0_flag which must alternate every view sequence
+ bs_write_ue( &q, h->param.i_frame_packing != 5 ); // frame_packing_arrangement_repetition_period
bs_write1( &q, 0 ); // frame_packing_arrangement_extension_flag
bs_align_10( &q );