3

I am receiving RTPs via UDP (video data).

The RTPs are holding H264 that I need to decode. Unfortunately, most of the RTPs hold fragmented data. As RTP sequences are missing, I cannot reconstruct the H264 properly.

Any idea on how to reduce data loss in order to be able to decode at least o couple of frames ?

Display Name
  • 349
  • 2
  • 10
  • 19

2 Answers2

2

There is not much one can say. Lost data is lost as the adjective suggests. You can't get it back. In almost any case you can still feed the remaining NALs into the decoder and render the video. You will see artifacts that are introduced by the missing NALs but that's life.

Lost data is lost.

In order to reduce data loss you will need to change your transmission protocol. Interleaved RTP in RTSP could be a good choice that bases on a similar technolgy stack.

Changing to TCP will obviously only help if you got enough bandwidth to transmit the video.

Sebastian Annies
  • 2,438
  • 1
  • 20
  • 38
  • I am capturing over the Internet not LAN, that might increase the loss percentage. As you said, I provided the remaining NALs to the decoder and the image is ~20% complete. I have also tried to remove all incomplete frames. Also, I tried using `mp3parser` for putting the h264 into a mp4 container but that did not seem to work. Guess I'll have to stick to TCP. Or what would you suggest ? – Display Name Aug 23 '12 at 12:44
  • TCP is probably your best bet if you want to transmit data reliably over an unrealiable network. – che Aug 23 '12 at 12:46
  • You have control over the server side? If yes: as I added in my edit: Interleaved RTP in RTSP if no: nothing you can do! – Sebastian Annies Aug 23 '12 at 12:47
  • I can tell the server to use TCP instead (via RTSP). Could you please recommend a good resource for decoding RTP/H264 via TCP ? I used this one so far http://docs.lscube.org/rfc/rfc2326.xhtml#sec_10_12. The thing is that apparently I am only receiving a RTP for channel 0. Also, not sure where to grab the SPS and PPS from in this case. – Display Name Aug 23 '12 at 12:55
  • If the network doesn't have the bandwidth to transmit your video, TCP will make it worse, not better (as there's more overhead with TCP). Your only real solution is to drop the bit rate of the source, or get a faster network. – Jon Burgess Aug 24 '12 at 06:56
1

If you have control on H264 encoder, enable Error resilience tools,(http://www.slideshare.net/coldfire7/error-resiliency-and-concealment-in-h264-presentation) which makes your video more robust towards transmission errors.

So that your RTP over UDP becomes 'more resistant' towards packets losses.

mrsatish
  • 429
  • 2
  • 7
  • 15