Repository navigation
ffmpeg: receive a GB/T 28181 program stream over RTP and RTSP - #16
Merged
Merged
Conversation
0004 adds an RTP depacketizer for PS/90000, the program stream over RTP that GB/T 28181 uses. Until now FFmpeg had none: a camera's ?payload=ps stream opened as "codec none", and a capture had to be depacketized by hand before 0003's demuxer could read it. rtpdec_ps.c collects a picture's payloads (one RTP timestamp per picture) and ends the picture at its marker, or when the next picture begins without one. It reads the picture's packs. The program stream map names the video stream and its codec (SVAC 0x80, H.264, H.265, MPEG-4, MPEG-1/2), and that stream's PES payloads, joined, are the packet. Audio and other streams are skipped. A picture that lost a packet is dropped, and so is what follows until a payload opens with a pack header. rtp_send.py sends the corpus as PS over RTP, framed by ps_write.py (now with pack() per access unit). With "ps-nomarker" it leaves out the marker bits. CI runs rtp_check.sh in both modes, at MTU 1200 and 300. On a lab CV608 streaming SVAC3, with the sub stream in H.265: - ffmpeg -i "rtsp://camera/stream=0?payload=ps" decoded 300 pictures in 10 s over TCP and 300 over UDP, with no warnings; - the H.265 sub stream decoded 302; - native RTP and PS of the same encoder, received at the same time, gave 360 of 360 identical pictures, both ways round (native over UDP with PS over TCP, and the reverse).
PR Summary by QodoAdd FFmpeg RTP depacketization for GB/T 28181 program streams
AI Description
Diagram
High-Level Assessment
Files changed (6)
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTip of the day💡 Did you know, you can add REVIEW.md to your repo root and Qodo follows it on every PR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
0004 adds an RTP depacketizer for PS/90000, the program stream over RTP
that GB/T 28181 uses. Until now FFmpeg had none: a camera's
?payload=ps stream opened as "codec none", and a capture had to be
depacketized by hand before 0003's demuxer could read it.
rtpdec_ps.c collects a picture's payloads (one RTP timestamp per
picture) and ends the picture at its marker, or when the next picture
begins without one. It reads the picture's packs. The program stream
map names the video stream and its codec (SVAC 0x80, H.264, H.265,
MPEG-4, MPEG-1/2), and that stream's PES payloads, joined, are the
packet. Audio and other streams are skipped. A picture that lost a
packet is dropped, and so is what follows until a payload opens with a
pack header.
rtp_send.py sends the corpus as PS over RTP, framed by ps_write.py
(now with pack() per access unit). With "ps-nomarker" it leaves out the
marker bits. CI runs rtp_check.sh in both modes, at MTU 1200 and 300.
On a lab CV608 streaming SVAC3, with the sub stream in H.265:
in 10 s over TCP and 300 over UDP, with no warnings;
gave 360 of 360 identical pictures, both ways round (native over UDP
with PS over TCP, and the reverse).
Verification
rtp_check.shinpsmode at MTU 1200 and 300: every corpus stream equals its golden framemd5.ps-nomarkerpassed on 7 of 8 streams locally. The eighth, the largest (synth 1080p), lost UDP packets on a heavily loaded workstation (the decoder reported "26 packet(s) lost"). The native-payload check lost frames on the same stream at MTU 1200 on that machine, and that path is unchanged by this PR. CI runs all of these on a clean runner.?payload=pssupport, as merged.