Error in ffmpeg decoding real-time stream “non existing PPS 0 referenced, decode”_ slice_ header error,no frame!”

Ffmpeg decoded H264 real-time outflow error, prompt the following error:

Reason analysis: keyframes can be decoded, but when decoding non-keyframes, the error above is reported
1) If we directly take frame by frame from the RTSP stream and transcode YUV from frame by frame, there is no special requirement for AVpacket and AVframe, and the integrity is fine.
2) If the H264 real-time stream is stored in the Shared memory and AVpacket of one frame is read from the Shared memory, the AVframe should not be cycled clean. It is better to make it a member variable, otherwise the non-key frame cannot be decoded, which will cause the above error.
Solution: Make AVframe a member variable. You can’t clean it up once.
    


Read More: