如何在JM8.6中设置编码帧类型为IDR B B P B B P B B P B B I B B P...?

      在某些“非常特殊”的场合,需要固定H.264的帧类型. H.264的baseline profile中没有B帧,所以可以选用main profile, 在encoder_main.cfg中进行如下设置就可以编码成 IDR B B P B B P B B P B B I B B P...类型的结构. (我用的foreman_part_qicf.yuv是300帧的)

     excoder_main.cfg中的内容如下:

 

# New Input File Format is as follows
# <ParameterName> = <ParameterValue> # Comment
#
# See configfile.h for a list of supported ParameterNames


##########################################################################################
# Files
##########################################################################################
InputFile             = "foreman_part_qcif.yuv"       # Input sequence, YUV 4:2:0
InputHeaderLength     = 0      # If the inputfile has a header, state it's length in byte here
StartFrame            = 0      # Start frame for encoding. (0-N)
FramesToBeEncoded     = 30      # Number of frames to be coded
FrameRate             = 30    # Frame Rate per second (1-100)
SourceWidth           = 176    # Image width in Pels, must be multiple of 16
SourceHeight          = 144    # Image height in Pels, must be multiple of 16
TraceFile             = "trace_enc.txt"
ReconFile             = "test_rec.yuv"
OutputFile            = "test.264"


##########################################################################################
# Encoder Control
##########################################################################################
ProfileIDC            = 77  # Profile IDC (66=baseline, 77=main, 88=extended)
LevelIDC              = 30  # Level IDC   (e.g. 20 = level 2.0)

IntraPeriod           =  4  # Period of I-Frames (0=only first)
IDRIntraEnable       =  0  # Force IDR Intra  (0=disable 1=enable)
QPFirstFrame          = 28  # Quant. param for first frame (intra) (0-51)
QPRemainingFrame      = 28  # Quant. param for remaining frames (0-51)
FrameSkip             =  2  # Number of frames to be skipped in input (e.g 2 will code every third frame)
ChromaQPOffset       =   0  # Chroma QP offset (-51..51).
UseHadamard           =  1  # Hadamard transform (0=not used, 1=used)
SearchRange           = 16  # Max search range
NumberReferenceFrames =  5  # Number of previous frames used for inter motion search (1-16)
PList0References      =  0  # P slice List 0 reference override (0 disable, N <= NumberReferenceFrames)
MbLineIntraUpdate     =  0  # Error robustness(extra intra macro block updates)(0=off, N: One GOB every N frames are intra coded)
RandomIntraMBRefresh  =  0  # Forced intra MBs per picture
InterSearch16x16      =  1  # Inter block search 16x16 (0=disable, 1=enable)
InterSearch16x8       =  1  # Inter block search 16x8  (0=disable, 1=enable)
InterSearch8x16       =  1  # Inter block search  8x16 (0=disable, 1=enable)
InterSearch8x8        =  1  # Inter block search  8x8  (0=disable, 1=enable)
InterSearch8x4        =  1  # Inter block search  8x4  (0=disable, 1=enable)
InterSearch4x8        =  1  # Inter block search  4x8  (0=disable, 1=enable)
InterSearch4x4        =  1  # Inter block search  4x4  (0=disable, 1=enable)
UseFME                =  0  # Use fast motion estimation (0=disable, 1=enable)

##########################################################################################
# B Slices
##########################################################################################

NumberBFrames         =  2  # Number of B frames inserted (0=not used) 
QPBPicture            =  30 # Quant. param for B frames (0-51)
DirectModeType        =  1  # Direct Mode Type (0:Temporal 1:Spatial)
DirectInferenceFlag   =  0  # Direct Inference Flag (0: Disable 1: Enable)
BList0References      =  0  # B slice List 0 reference override (0 disable, N <= NumberReferenceFrames)
BList1References      =  0  # B slice List 1 reference override (0 disable, N <= NumberReferenceFrames)
StoredBPictures       =  0  # Stored B pictures (0=off, 1=on)

##########################################################################################
# SP Frames
##########################################################################################

SPPicturePeriodicity  =  0  # SP-Picture Periodicity (0=not used)
QPSPPicture           = 28  # Quant. param of SP-Pictures for Prediction Error (0-51)
QPSP2Picture          = 27  # Quant. param of SP-Pictures for Predicted Blocks (0-51)


##########################################################################################
# Output Control, NALs
##########################################################################################

SymbolMode             =  1  # Symbol mode (Entropy coding method: 0=UVLC, 1=CABAC)
OutFileMode            =  0  # Output file mode, 0:Annex B, 1:RTP
PartitionMode          =  0  # Partition Mode, 0: no DP, 1: 3 Partitions per Slice

##########################################################################################
# CABAC context initialization
##########################################################################################

ContextInitMethod        =  0     # Context init (0: fixed, 1: adaptive)
FixedModelNumber         =  0     # model number for fixed decision for inter slices ( 0, 1, or 2 )

##########################################################################################
# Interlace Handling
#########################################################################################

PicInterlace             =  0     # Picture AFF    (0: frame coding, 1: field coding, 2:adaptive frame/field coding)
MbInterlace              =  0     # Macroblock AFF (0: frame coding, 1: field coding, 2:adaptive frame/field coding, 3:combined with PicInterlace=0, to do frame MBAFF))
IntraBottom              =  0     # Force Intra Bottom at GOP Period

##########################################################################################
# Weighted Prediction
#########################################################################################

WeightedPrediction       =  0     # P picture Weighted Prediction (0=off, 1=explicit mode) 
WeightedBiprediction     =  0     # B picture Weighted Prediciton (0=off, 1=explicit mode,  2=implicit mode) 

##########################################################################################
# Loop filter parameters
##########################################################################################

LoopFilterParametersFlag = 0      # Configure loop filter (0=parameter below ingored, 1=parameters sent)
LoopFilterDisable        = 0      # Disable loop filter in slice header (0=Filter, 1=No Filter)
LoopFilterAlphaC0Offset  = 0      # Alpha & C0 offset div. 2, {-6, -5, ... 0, +1, .. +6}
LoopFilterBetaOffset     = 0      # Beta offset div. 2, {-6, -5, ... 0, +1, .. +6}

##########################################################################################
# Error Resilience / Slices
##########################################################################################

SliceMode             =  0   # Slice mode (0=off 1=fixed #mb in slice 2=fixed #bytes in slice 3=use callback)
SliceArgument         = 50   # Slice argument (Arguments to modes 1 and 2 above)

num_slice_groups_minus1 = 0  # Number of Slice Groups Minus 1, 0 == no FMO, 1 == two slice groups, etc.
slice_group_map_type    = 6  # 0:  Interleave, 1: Dispersed,    2: Foreground with left-over,
                             # 3:  Box-out,    4: Raster Scan   5: Wipe
                             # 6:  Explicit, slice_group_id read from SliceGroupConfigFileName
slice_group_change_direction_flag = 0    # 0: box-out clockwise, raster scan or wipe right,
                                         # 1: box-out counter clockwise, reverse raster scan or wipe left
slice_group_change_rate_minus1    = 85   #
SliceGroupConfigFileName          = "sg6conf.cfg"   # Used for slice_group_map_type 0, 2, 6

UseRedundantSlice     = 0    # 0: not used, 1: one redundant slice used for each slice (other modes not supported yet)

##########################################################################################
# Search Range Restriction / RD Optimization
##########################################################################################

RestrictSearchRange  =  2  # restriction for (0: blocks and ref, 1: ref, 2: no restrictions)
RDOptimization       =  1  # rd-optimized mode decision (0:off, 1:on, 2: with losses)
LossRateA            = 10  # expected packet loss rate of the channel for the first partition, only valid if RDOptimization = 2
LossRateB            =  0  # expected packet loss rate of the channel for the second partition, only valid if RDOptimization = 2
LossRateC            =  0  # expected packet loss rate of the channel for the third partition, only valid if RDOptimization = 2
NumberOfDecoders     = 30  # Numbers of decoders used to simulate the channel, only valid if RDOptimization = 2
RestrictRefFrames    =  0  # Doesnt allow reference to areas that have been intra updated in a later frame.

##########################################################################################
# Additional Stuff
#########################################################################################

UseConstrainedIntraPred  =  0  # If 1, Inter pixels are not used for Intra macroblock prediction.
LastFrameNumber          =  0  # Last frame number that have to be coded (0: no effect)
ChangeQPI                = 16  # QP (I-slices)  for second part of sequence (0-51)
ChangeQPP                = 16  # QP (P-frame) for second part of sequence (0-51)
ChangeQPB                = 18  # QP (B-frame) for second part of sequence (0-51)
ChangeQPStart            =  0  # Frame no. for second part of sequence (0: no second part)

NumberofLeakyBuckets     =  8                      # Number of Leaky Bucket values
LeakyBucketRateFile      =  "leakybucketrate.cfg"  # File from which encoder derives rate values
LeakyBucketParamFile     =  "leakybucketparam.cfg" # File where encoder stores leakybucketparams

NumberFramesInEnhancementLayerSubSequence  = 0  # number of frames in the Enhanced Scalability Layer(0: no Enhanced Layer)
NumberOfFrameInSecondIGOP                  = 0  # Number of frames to be coded in the second IGOP

SparePictureOption        =  0   # (0: no spare picture info, 1: spare picture available)
SparePictureDetectionThr  =  6   # Threshold for spare reference pictures detection
SparePicturePercentageThr = 92   # Threshold for the spare macroblock percentage

PicOrderCntType           = 0    # (0: POC mode 0, 1: POC mode 1, 2: POC mode 2)

########################################################################################
#Rate control
########################################################################################

RateControlEnable    =      0   # 0 Disable, 1 Enable
Bitrate              =  45020   # Bitrate(bps)
InitialQP            =     24   # Initial Quantization Parameter for the first I frame
                                # InitialQp depends on two values: Bits Per Picture,
                                # and the GOP length
BasicUnit            =     11   # Number of MBs in the basic unit
                                # should be a fractor of the total number
                                # of MBs in a frame
ChannelType          =      0   # type of channel( 1=time varying channel; 0=Constant channel)

 

  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 7
    评论
HEVC采用了类似H.264的NAL单元结构,每个NAL单元包含了一个完整的视频或片段的编码数据。在HEVC,NAL单元可以是VPS、SPS、PPS、SEI或视频数据。 要判断一个NAL单元包含的视频类型,需要解析NAL单元的头部信息。在HEVC,NAL单元的头部信息包括了NAL单元类型(NAL unit type)和层次(Layer ID)等信息。具体来说,NAL单元类型由header的`nal_unit_type`字段指定,其值为0~55,其0-32是VCL NAL单元,表示视频数据,33-35是非VCL NAL单元,表示参数集等信息。 对于VCL NAL单元,可以进一步从NAL单元的payload获取视频类型。在HEVC,视频类型与NAL单元类型之间的对应关系如下: - NAL_UNIT_TYPE_BLA_N_LP:前向预测(B) - NAL_UNIT_TYPE_BLA_W_LP:前向预测(B) - NAL_UNIT_TYPE_BLA_W_RADL:前向预测(B) - NAL_UNIT_TYPE_CRA:无参考(I) - NAL_UNIT_TYPE_IDR_W_RADL:关键(I) - NAL_UNIT_TYPE_IDR_N_LP:关键(I) - NAL_UNIT_TYPE_IDR_W_LP:关键(I) - NAL_UNIT_TYPE_P_BLA_W_LP:双向预测(P) - NAL_UNIT_TYPE_P_BLA_W_RADL:双向预测(P) - NAL_UNIT_TYPE_P_RPS_N_LP:双向预测(P) - NAL_UNIT_TYPE_P_RPS_W_LP:双向预测(P) - NAL_UNIT_TYPE_P_RPS_W_RADL:双向预测(P) - NAL_UNIT_TYPE_P_SLICE:双向预测(P) 因此,可以根据NAL单元类型和payload的数据,判断一个NAL单元包含的视频类型是I、P还是B

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值