Skip to content

Fix of continuation PES mpegts packets#289

Open
Taiwan22 wants to merge 1 commit into
DDVTECH:masterfrom
Taiwan22:fix_mpegts_packets
Open

Fix of continuation PES mpegts packets#289
Taiwan22 wants to merge 1 commit into
DDVTECH:masterfrom
Taiwan22:fix_mpegts_packets

Conversation

@Taiwan22

@Taiwan22 Taiwan22 commented Jun 8, 2026

Copy link
Copy Markdown

Hello,
I had problems streaming from my encoder when using either ristsender (librist) or srt-live-transmit (SRT).
I was getting strange timestamp jumps like these:

[07 Jun 2026, 04:28:16] MistInTSRIST:test (31961) [INFO] Timestamp jump 0d01h28m58s.157 -> 14714d05h45m19s.374, compensating. (../src/input/input_tsrist.cpp:238)
[07 Jun 2026, 04:28:16] MistInTSRIST:test (31961) [INFO] Timestamp jump 0d01h28m58s.157 -> 0d02h57m56s.577, compensating. (../src/input/input_tsrist.cpp:238)

Half of my video was blinking green.
When streaming from FFmpeg to MistServer everything worked fine, and streaming with ristsender directly to VLC also worked without issues. (same source UDP stream)

After a lot of trial and error, I found a bug in ts_stream.cpp.
When the encoder uses continuation PES packets, the PTS/DTS values are set to 0, which leads to massive timestamp jumps. We should also skip scanAnnexB for continuation PES packets, because it can result in false positives.

After fixing this, I ran into another issue with OBS Studio. In my case, OBS does not set the data_align_bit, which caused the error:
"Continuation PES (align=0) for track XX ts=XXX but no build packet exists"
So I added additional detection to handle this case.

I've included a capture of my UDP stream data so you can test it.
video_pcap.zip

…n PES packets, avoid Annex B start code scanning and directly append payloads to prevent data corruption.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant