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

SRT corrupt stream #1601

Open
mkrn opened this issue Oct 11, 2024 · 2 comments
Open

SRT corrupt stream #1601

mkrn opened this issue Oct 11, 2024 · 2 comments

Comments

@mkrn
Copy link

mkrn commented Oct 11, 2024

Describe the bug

I'm transporting SRT to a server nearby
?latency=1500&peerlatency=1500

reading on server with
ffmpeg -i "srt://IP?streamid=STREAMID&latency=1500" -c copy -t 60 raw.ts

There are a lot of corrupt packets issues in ffmpeg:

[mpegts @ 0x5bdfc0591080] Packet corrupt (stream = 0, dts = 4235532).
[in#0/mpegts @ 0x5bdfc0590dc0] corrupt input packet in stream 0
[mpegts @ 0x5bdfc0591080] PES packet size mismatchits/s speed= 1.5x

Performance metrics:

Performance Data:
- Total Packets Sent: 13398 
- Total Send Packet Loss: 1 
- Total Retransmitted Packets: 1
- Total Received ACKs: 3953
- Total Received NAKs: 378
- Packets In Flight: 87
- Total Bytes Sent: 13457548 
- Sending Bitrate (Mbps): 1.6095544032307871
- Total Dropped Sent Packets: 2882  
- Round Trip Time (ms): 327.179
- Congestion Window: 8192
- Packets in Send Buffer: 81
- Bytes in Send Buffer: 81363
- Packet Congestion Window: 8192
- Bytes Available in Send Buffer: 12166500
- pktReorderTolerance: 0
- pktSndFilterExtra: 0

round trip varied from 180 - 1000 ms it's on 5G but inside walls

resulting video: https://videos.eventlive.site/streams/OVRSGPWH_raw.ts

To Reproduce

Start SRT stream on less than perfect internet
Monitor with ffmpeg
See corrupt packets, unable to recover

Encoder Settings:

720p 

       stream.videoSettings.profileLevel = kVTProfileLevel_HEVC_Main_AutoLevel as String
        stream.videoSettings.bitRate = 1300 * 1000
         stream.videoSettings.allowFrameReordering = nil
        stream.videoSettings.bitRateMode = .average
        stream.videoSettings.maxKeyFrameIntervalDuration = 2
        stream.videoSettings.isHardwareEncoderEnabled = true

Expected behavior

Smooth, quick to recover, no corrupt packets

Version

1.9.5

Smartphone info.

iPhone 13 Pro
iOS 18

Additional context

No response

Screenshots

No response

Relevant log output

No response

@shogo4405
Copy link
Owner

The network part is a wrapper for Haivision/srt, and it seems that there is nothing HaishinKit can control.

In environments where packet loss occurs, increasing the latency value seems to help compensate for it. There are documents that recommend setting it to 3–4 times the RTT.

Could increasing the latency like this, SRTConnection.open(URL(string: "srt://ip.address?latency=4000")!), help resolve the issue?

@mkrn
Copy link
Author

mkrn commented Oct 23, 2024

Thank you! I'm not sure why this happened, but moved on to use HEVC in RTMP for my application it may be better fit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants