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

can't read with RTMP / LHLS a stream encoded with nvenc: DTS is greater than PTS #989

Closed
2 of 12 tasks
JIEgOKOJI opened this issue Jun 13, 2022 · 3 comments
Closed
2 of 12 tasks
Labels
bug Something isn't working

Comments

@JIEgOKOJI
Copy link

JIEgOKOJI commented Jun 13, 2022

Which version are you using?

latest

Which operating system are you using?

  • Linux amd64 standard
  • Linux amd64 Docker
  • [] Linux arm64 standard
  • Linux arm64 Docker
  • Linux arm7 standard
  • Linux arm7 Docker
  • Linux arm6 standard
  • Linux arm6 Docker
  • Windows amd64 standard
  • Windows amd64 Docker (WSL backend)
  • macOS amd64 standard
  • macOS amd64 Docker
  • Other (please describe)

Describe the issue

When using lhls and starting stream from OBS with nvenc encoder. The Muxer crashes with logs " destroyed (muxer error: DTS is greater than PTS)"

Describe how to replicate the issue

  1. start the server
  2. publish with Obs and nvenc with b-frames
  3. read with logs

Did you attach the server logs?

2022/06/13 17:21:30 INF [HLS] [muxer lhls/6] is converting into HLS
2022/06/13 17:21:32 INF [HLS] [muxer lhls/6] destroyed (muxer error: DTS is greater than PTS)

no

Did you attach a network dump?

no

@aler9 aler9 added the bug Something isn't working label Jun 21, 2022
@aler9
Copy link
Member

aler9 commented Jun 22, 2022

Hello, this is caused by the fact that nvenc doesn't include the max_num_reorder_frames field into the H264 SPS, and therefore the server can't compute the initial offset between PTS and DTS (which is max_num_reorder_frames * 1 / fps).
Without this initial offset, it happens that DTS > PTS.

FFmpeg uses an undocumented algorithm that allows to derive max_num_reorder_frames when it is not present, that may be implemented in the server too:

https://github.com/FFmpeg/FFmpeg/blob/c6364b711bad1fe2fbd90e5b2798f87080ddf5ea/libavcodec/h264_ps.c#L587

i need to investigate.

@aler9 aler9 changed the title LHLS with nvenc and b-frames DTS is greater than PTS can't read with RTMP / LHLS a stream encoded with nvenc: DTS is greater than PTS Jun 22, 2022
aler9 added a commit to bluenviron/gortsplib that referenced this issue Jun 22, 2022
@aler9
Copy link
Member

aler9 commented Jun 24, 2022

fixed in v0.19.2.

@aler9 aler9 closed this as completed Jun 24, 2022
@github-actions
Copy link
Contributor

This issue is being locked automatically because it has been closed for more than 6 months.
Please open a new issue in case you encounter a similar problem.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants