Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Total image distortion even on 1% packet loss #423

Open
svpcom opened this issue Sep 16, 2023 · 7 comments
Open

Total image distortion even on 1% packet loss #423

svpcom opened this issue Sep 16, 2023 · 7 comments

Comments

@svpcom
Copy link

svpcom commented Sep 16, 2023

Hi,
I use rtp as h265 transport and found that even with 1% of packets loss image became totally distorted (static background became gray and only moving parts are shown). It seems that libde265 has a bug because if I use NVidia HW decoder nvh265dec it decode that same stream without any visible artifacts. The same bug also have libav.

How to reproduce:

  1. Use gstreamer:
    gst-launch-1.0 videotestsrc is-live=true do-timestamp=true ! 'video/x-raw,width=640,height=480,framerate=30/1,format=I420' ! x265enc tune=zerolatency bitrate=2000 ! rtph265pay mtu=1400 aggregate-mode=zero-latency  ! identity drop-probability=0.01 ! queue ! rtph265depay ! h265parse ! libde265dec ! videoconvert ! xvimagesink sync=false
    
  2. Use libde265-dec265
    /usr/bin/libde265-dec265 -d /tmp/test.h265
    

If I replace in gstreamer pipeline above libde265dec with nvh265dec all will work without problems

Test data:
h265_0.01_loss.mkv.gz
test.h265.gz

SW versions:
GStreamer: 1.22.0
libde265: 1.0.11-1
OS: Debian 12, amd64

@farindk
Copy link
Contributor

farindk commented Sep 19, 2023

That is not a bug. Even a small packet loss can corrupt many frames because they depend on each other. It is not specified what to do in the case of missing input data. As far as I remember, libde265 simply uses empty content (grey) for the missing image parts. Alternatively, one can use some error concealment algorithms to hide the errors. Apparently, the NVidia HW decoder uses one of them.

We can leave this open as a feature request for implementing an error concealment algorithm.

@svpcom
Copy link
Author

svpcom commented Sep 19, 2023

@farindk Is it possible to use previous base frame instead of grey color filling?

@farindk
Copy link
Contributor

farindk commented Sep 19, 2023

Something like this. But frames are not always coded in temporal order and several frames could be decoded in parallel threads, what makes this more difficult. But yes, that would be a rather simple algorithm that should improve this.

@farindk
Copy link
Contributor

farindk commented Sep 19, 2023

BTW: I looked at your test stream. How does the input look like? I guess that it is a static test image with noise in the bottom right rectangle. Right?

@svpcom
Copy link
Author

svpcom commented Sep 19, 2023

@farindk Yes. It is output of gstreamer videotestsrc.
Also interesting that libav h264 decoder doesn't have such bug (see attached file)
h264_0.01_loss.mkv.gz

@svpcom
Copy link
Author

svpcom commented Sep 20, 2023

@farindk Is it possible to add quick fix for this problem or it requires a deep investigation?

@CarlAreDHopen-eaton
Copy link

Are there any progress on this issue? We are facing the exact same issue with intermittent packet loss in keyframes causing gray screen until the next key frame.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants