Gradual Decoder Refresh (GDR) applies when GOPCtrlMode is set to LOW_DELAY_P or
LOW_DELAY_B. The GDRMode parameter specifies
whether and which GDR scheme should be used. When GDR is enabled (horizontal or
vertical), the encoder inserts an intra MBs row/column in the picture to refresh the
decoder. Gop.FreqIDR specifies the frequency at which
the refresh pattern should happen. To allow full picture refreshing, Gop.FreqIDR should be greater than the number of CTB/MB
rows (GDR_HORIZONTAL) or columns (GDR_VERTICAL).
When GDR is enabled, the encoder inserts an SPS/PPS along with an SEI recovery message at the start of a refresh pattern, thus allowing a decoder to synchronize to the SEI recovery points in the bitstream. The advantage of having non-IDR decoder synchronization is that there is no longer any need to send IDR pictures in case of a packet loss scenario. Inserting periodic IDR pictures in video encoding generates a spike in bit consumption which is not recommended for video streaming.
Vertical GDR mode has a motion vector limitation that can cause full picture reconstruction to take more than one refresh cycle. Refer to the following table for more details:
| AVC/H.264 | HEVC/H.265 | |
|---|---|---|
| GDR_VERTICAL: A vertical intra-column moving from left to right | Exact match is supported. Deblocking filter is automatically disabled | Exact match is NOT supported; it can take up to two refresh intervals to fully reconstruct the frame. Deblocking filter is automatically disabled |
| GDR_HORIZONTAL: A horizontal intra-row moving from top-to-bottom | Exact match is supported. Deblocking filter is automatically disabled | Exact match is supported. Deblocking filter is automatically disabled |
Use gdr-mode=horizontal and periodicity-idr=<higher
than Picture Height in Mbs> in the encoder element.
gst-launch-1.0 filesrc location=in.yuv ! rawvideoparse width=3840 height=2160 format=nv12 framerate=30/1! omxh264enc control-rate=constant target-bitrate=60000 gop-mode=low-delay-p gdr-mode=horizontal periodicity-idr=270! video/x-h264, profile=high! filesink location=out.avc
In an encoder configuration file, add the following section and parameters.
[GOP]
GopCtrlMode = LOW_DELAY_P
Gop.GdrMode = GDR_HORIZONTAL
Gop.FreqIDR = 270
GOP.FreqIDR in the configuration file. For
GStreamer specify periodicity-idr when GDR mode is
enabled.