[x264-devel] Degrading video quality over time

Jan Willamowius jan at willamowius.de
Mon May 31 12:30:35 CEST 2010


Hi,

x264 is used in H323plus to implement a H.264 codec for H.323 endpoints.
I notice that when a still image (or very similar images) are
transmitted, the quality degrades over time and the video gets "smudgy".

x264 is configured with x264_param_default(context) and these
parameters:

   // No multicore support
   context.i_threads           = 1;
   context.b_sliced_threads    = 1;  
   context.b_deterministic     = 1;
   context.i_sync_lookahead    = 0;
   context.i_frame_reference   = 1;
   context.i_bframe            = 0;

  // No aspect ratio correction
  context.vui.i_sar_width      = 0;
  context.vui.i_sar_height     = 0;

  // Enable logging
  context.pf_log               = logCallbackX264;
  context.i_log_level          = X264_LOG_WARNING;
  context.p_log_private        = NULL;

  // Single NAL Mode
  context.i_slice_max_size     = 1200; // TODO: need to be provided.
  context.b_repeat_headers     = 1;     // repeat SPS/PPS before each key frame
  context.b_annexb             = 1;     // place start codes (4 bytes) before NAL units

  context.i_width = CIF_WIDTH;
  context.i_height = CIF_HEIGHT;
  context.i_fps_num = 30;
  context.i_fps_den = 1;

  level = (((66 << 16) + (0xC0 << 8) +  30) & 0x0000ff);
  int i = 0;
  while (h264_levels[i].level_idc) {
    if (h264_levels[i].level_idc == level)
      break;
   i++; 
  }

  // We make use of the baseline profile, that means:
  // no B-Frames (too much latency in interactive video)
  // CBR (we want to get the max. quality making use of all the bitrate that is available)
  // baseline profile begin
  context.b_cabac = 0;  // Only >= MAIN LEVEL
  context.i_bframe = 0; // Only >= MAIN LEVEL

  // Level:
  context.i_level_idc = level;

  // TSTO
  context.rc.i_qp_min = H264_MIN_QUANT;
  context.rc.i_qp_max =  (int)((51 - H264_MIN_QUANT) / 31 * tsto + H264_MIN_QUANT);
  context.rc.i_qp_step = 4;	

  context.i_keyint_max = 30 * 120;
  context.i_keyint_min = 2;

  // Rate control set to CBR mode
  context.rc.i_rc_method       	= X264_RC_ABR;
  context.rc.i_qp_min              = 25;
  context.rc.i_qp_max              = 51;
  context.rc.f_rate_tolerance  	= 1;
  context.rc.i_vbv_max_bitrate 	= 0;
  context.rc.i_vbv_buffer_size 	= 0;
  context.rc.i_lookahead       	= 0;
  context.rc.i_bitrate = 768;
   
  // Analysis support
  _context.analyse.intra     		= 3;
  _context.analyse.inter     		= 0;
  _context.analyse.b_transform_8x8 	= 0;
  _context.analyse.i_weighted_pred  = 0;
  _context.analyse.i_direct_mv_pred = 1;
  _context.analyse.i_me_method      = 0;
  _context.analyse.i_me_range       = 16;
  _context.analyse.i_subpel_refine  = 1;
  _context.analyse.i_trellis        = 0;
  _context.analyse.b_psnr           = 0;
  _context.analyse.b_fast_pskip     = 1;
  _context.analyse.b_dct_decimate   = 1;
  _context.analyse.i_noise_reduction= 0;
  _context.analyse.b_ssim           = 0;


As a quick hack, I changed the code to cann x264_encode_close() and
x264_encoder_open() between frames. This fixes the video quality, but
results in a much higher bandwidth use than necessary.

Does somebody have an idea how to better fix this ?
I tried to switch from x264_param_default(context) to
x264_param_default(context, NULL, "stillimage"), but that doesn't
seem to make a difference.

Thanks,
Jan

-- 
Jan Willamowius, jan at willamowius.de, http://www.gnugk.org/


More information about the x264-devel mailing list