I'm using x264 to compress a video stream from a webcam with this settings:
x264_param_default_preset(¶m, "veryfast", "zerolatency");
param.i_threads = 1;
param.i_fps_den = 1;
param.b_annexb = 1;
param.i_keyint_max = 30;
param.rc.i_rc_method = X264_RC_CRF;
param.rc.f_rf_constant = 25;
param.rc.f_rf_constant_max = 35;
param.b_repeat_headers = 1;
x264_param_apply_profile(¶m, "baseline");
param.i_slice_max_size = X264_NAL_MAX_SIZE;
I would like to fit NAL into MTU size, but if I set a small max size, the stream is ruined - it blinks randomly between black and white, with some clues of original image in background. The bigger is the max_size, less probable is for the stream to be ruined. So my question is - can we have small NALUs and a correct video stream?
UPD: I use FFmpeg as a decoder.