The VCU2 encoder supports frame skip to strictly achieve the required target bitrate. When an encoded picture is too large and exceeds the CPB buffer size, the picture is discarded and replaced by a picture with all MB/CTB encoded as “Skip”. This feature is especially useful at low bitrates when the encoder must maintain a strict target bitrate irrespective of video complexity.
The maximum number of consecutive skipped frames can be set. If the maximum number of consecutive skipped frames is set too low, the output bitstream might not achieve the target bitrate. Experimentation is needed to find a balance between the achieved bitrate and number of actual encoded frames.
Frame Skip only applies if the reference frame has already been encoded. The first frame is encoded ignoring any buffer overflow. Only subsequent pictures are discarded when the frame size is exceeded. If the CPB is very small and the video is complex, all frames might be discarded.
- The back-and-forth visual effect can appear when the value of NumB is greater than 1 and enable-skip is set to true.
- In the dual pass mode, frame skip can only be used on the second pass.
- Inserting the frame skip in a GOP pattern with more than one B-frame can cause a back-and-forth visual effect. NumB >1 is not recommended.
- Avoid using frame skip in adaptive GOP feature.
Frame Skip is not supported in low latency (-slicelat) mode nor when Pyramidal GOP is used.
- To enable the Frame Skip feature the
AL_RC_OPT_ENABLE_SKIPbit is used ineOptionsmember variable ofAL_TRCParamstructure, (which is encapsulated inAL_TEncChanParamstructure). - The
nal_ref_idcflag can be used to detect skip frame as all the skip frames are not used for reference, which means that if the slice type is P andnal_ref_idc= 0, then that frame is a skip frame in the IPPPPPP GOP mode. - The frame skip flag feature notifies user applications about which frame has been skipped to allow users to drop/do some extra processing on skipped frames.
- A
bSkippedflag is in the buffer metadata. When an encoded output buffer is ready, user applications can extract the buffer metadata from the stream buffer usingAL_Buffer_GetMetaData. FlagbSkippedindicates whether that buffer was skipped. - Member variable
uMaxConsecSkipof structureAL_TRCParamis used to set the maximum number of consecutive skipped frames.
Enable frame skip in encoder.
EnableSkip = TRUE
Set the maximum number of skipped frames to 5.
MaxConsecutiveSkip = 5
Example encoder command.
ctrlsw_encoder -cfg test.cfg -i in.yuv --input-width 1280 --input-height 720 -o out.avc --print-picture-type
GStreamer AVC encode with skip-frame and max-consecutive skip properties.
gst-launch-1.0 filesrc location=in.yuv ! videoparse width=3840 height=2160 format=nv12 framerate=60/1 ! omxh264enc target-bitrate=1000 control-rate=constant num-slices=8 gop-mode=basic goplength=60 prefetch-buffer=TRUE skip-frame=true max-consecutive-skip=5 ! video/x-h264,profile=high, alignment=au ! filesink location=out.avc
GStreamer HEVC encode with skip-frame and max-consecutive skip properties.
gst-launch-1.0 filesrc location=in.yuv ! videoparse width=3840 height=2160 format=nv12 framerate=60/1 ! omxh265enc target-bitrate=1000 control-rate=constant num-slices=8 gop-mode=basic goplength=60 prefetch-buffer=TRUE skip-frame=true max-consecutive-skip=5 ! video/x-h265, profile=main, alignment=au ! filesink location=out.hevc