[Libav-user] Encoding in XDCAM 422: GOP sequence and mpeg_quant parameter

francesco at bltitalia.com francesco at bltitalia.com
Wed Dec 3 16:52:59 CET 2014


I'm attempting to encode in XDCAM format with closed GOP, fixed GOP size of
12 and GOP 
sequence IBBPBBPBBPBB.  Changing value of b_frame_strategy in AVCodecContext
the best 
result is obtained using the value of 0 (while value of 1 produces only P
frames, and
 value of 2 produces non constant GOP sequences)
Settings are:

 
 pCodecCtx_xd->sample_aspect_ratio.num  = 16;
 pCodecCtx_xd->sample_aspect_ratio.den  = 9;

 pCodecCtx_xd->rc_max_rate = pCodecCtx_xd->rc_min_rate
=pCodecCtx_xd->bit_rate = 50000000;

 pCodecCtx_xd->flags =   CODEC_FLAG_INTERLACED_DCT |
CODEC_FLAG_INTERLACED_ME | CODEC_FLAG_CLOSED_GOP; //

 pCodecCtx_xd->flags2 = CODEC_FLAG2_STRICT_GOP;

 pCodecCtx_xd->qmin = 1;
 pCodecCtx_xd->qmax = 12;
 pCodecCtx_xd->rc_buffer_size =      36408333 ; //
 pCodecCtx_xd->rc_initial_buffer_occupancy =    36408333 ; //

 pCodecCtx_xd->time_base.num = 1;      
 pCodecCtx_xd->time_base.den = 25;  

 pCodecCtx_xd->gop_size =  12;     pCodecCtx_xd->max_b_frames= 2;

 pCodecCtx_xd->pix_fmt = PIX_FMT_YUV422P;  ///< planar YUV 4:2:2, 16bpp, (1
Cr & Cb sample per 2x1 Y samples)
 pCodecCtx_xd->thread_count = 4;  

 pCodecCtx_xd->b_frame_strategy = 0;  // 0 - Always use the maximum number
of B-frames (default).
                                      // 1 - Avoid B-frames in high motion
scenes. See the b_sensitivity option to tune this strategy.
                                      // 2 - Places B-frames more or less
optimally to yield maximum quality (slower).
                                      //     You may want to reduce the
speed impact of this option by tuning the option brd_scale

  pCodecCtx_xd->vbv_delay = 1;

  pCodecCtx_xd->colorspace = AVCOL_SPC_BT709;
  pCodecCtx_xd->color_range =   AVCOL_RANGE_MPEG  ;
  pCodecCtx_xd->chroma_sample_location = AVCHROMA_LOC_LEFT ;

 // pCodecCtx_xd->mpeg_quant = 1;       //0-> h263 quant 1-> mpeg quant if
set gives error

 pCodecCtx_xd->intra_dc_precision = 10;    
 pCodecCtx_xd->lmin = 1 * FF_QP2LAMBDA;
 pCodecCtx_xd->rc_max_available_vbv_use = 1;  
 pCodecCtx_xd->rc_min_vbv_overflow_use = 1;  

 pCodecCtx_xd->scenechange_threshold =   2000000000;  //  INT_MAX;//


In this case output sequence is IPBBPBBPBBPB.  There is a way to force a
different sequence ?
If I set parameter mpeg_quant to 1 ( as reported in the header comment), the
avcodec_open2 
fails with error -1.  Can anyone explain the parameter mpeg_quant ?
regards



More information about the Libav-user mailing list