retina icon indicating copy to clipboard operation
retina copied to clipboard

add dts extractor #61

Open Curid opened this issue 1 year ago • 4 comments

This is a rust port of the gortsplib dts extractor. I don't really understand how it works, but my test stream doesn't stutter anymore.

I know you're busy, I don't expect this to be reviewed anytime soon.

Curid avatar Mar 26 '23 16:03 Curid

First, thank you!

I don't own any cameras that produce B frames, so...

  • What camera are you using? If it's fairly cheap I might just buy one.
  • Have you tried it with any pure-software RTSP source? I'll try the procedure I was looking at in https://github.com/scottlamb/retina/issues/61#issuecomment-1264538233 when I get a chance.

and...

I don't really understand how it works, but my test stream doesn't stutter anymore.

I don't really either and need to make another pass through to develop that understanding and compare this technique with gstreamer's h264timestamper [edit: code here]. Haven't looked closely enough yet to see if gstreamer and rtsp-simple-server (now called mediamtx apparently) are doing the same thing (and, if not, which is better). But I made one pass through and left some comments anyway.

scottlamb avatar Aug 03 '23 19:08 scottlamb

The gstreamer implementation seems to add latency. I'm not sure if it's just some initial delay like with the MediaMTX implementation but otherwise that's a problem.

In order to determine the DTS of each frame, this element may need to hold back a few frames in case the codec data indicates that frame reordering is allowed for the given stream. That means this element may introduce additional latency for the DTS decision.

Curid avatar Aug 04 '23 17:08 Curid

Found an explanation for how this algorithm works: https://github.com/bluenviron/mediamtx/issues/1002#issuecomment-2115930927

Curid avatar May 25 '24 19:05 Curid

Would it be better to first add the dts extractor as separate module that people can use manually before integrating it into the Depacketizer?

Curid avatar Jul 23 '24 17:07 Curid