Haivision / srt

Secure, Reliable, Transport
https://www.srtalliance.org
Mozilla Public License 2.0
3.13k stars 856 forks source link

Does srt-live-transmit support mpts udp that contain h.264 & mpeg-2 video format mixed ? #758

Closed edwardlai closed 5 years ago

edwardlai commented 5 years ago

caller srt-live-transmit.exe udp://229.1.1.7:1117 srt://xxx.xxx.xxx.xxx:5111

listener srt-live-transmit.exe srt://:5111 srt://:5222

Source stream is all of h.264 code, spts or mpts work fine But we meet source stream contain h.264 & mpeg-2 video code mixed , thant generate a lot of Drop Message during transmit time.

caller & sender 18:38:37.056909E:SRT.d: SND-DROPPED 60 packets - lost delaying for 1022ms 18:38:37.070269E:SRT.d: SND-DROPPED 54 packets - lost delaying for 1023ms 18:38:37.083231E:SRT.d: SND-DROPPED 58 packets - lost delaying for 1023ms 18:38:37.096222E:SRT.d: SND-DROPPED 56 packets - lost delaying for 1023ms 18:38:37.109187E:SRT.d: SND-DROPPED 58 packets - lost delaying for 1023ms 18:38:37.122167E:SRT.d: SND-DROPPED 2 packets - lost delaying for 1023ms 18:38:37.123689E:SRT.d: SND-DROPPED 58 packets - lost delaying for 1022ms 18:38:37.138087E:SRT.d: SND-DROPPED 58 packets - lost delaying for 1025ms 18:38:37.152035E:SRT.d: SND-DROPPED 57 packets - lost delaying for 1025ms 18:38:37.166005E:SRT.d: SND-DROPPED 58 packets - lost delaying for 1026ms

maxsharabayko commented 5 years ago

SRT is agnostic to the payload. Looks like you need to increase the latency. What is RTT of the link? The recommended latency value is 4 * RTT. caller srt-live-transmit.exe udp://229.1.1.7:1117 "srt://xxx.xxx.xxx.xxx:5111?latency=1500" listener srt-live-transmit.exe "srt://:5111?latency=1500" "srt://:5222?latency=1500"

edwardlai commented 5 years ago

caller & listener all increased latency=1500 , become

19:07:22.810734E:SRT.d: SND-DROPPED 54 packets - lost delaying for 1527ms 19:07:22.824669E:SRT.d: SND-DROPPED 59 packets - lost delaying for 1528ms 19:07:22.838656E:SRT.d: SND-DROPPED 60 packets - lost delaying for 1527ms 19:07:22.852597E:SRT.d: SND-DROPPED 59 packets - lost delaying for 1524ms

add latency=2000 , become

19:10:05.272966E:SRT.d: SND-DROPPED 57 packets - lost delaying for 2022ms 19:10:05.285827E:SRT.d: SND-DROPPED 12 packets - lost delaying for 2022ms 19:10:05.323741E:SRT.d: SND-DROPPED 9 packets - lost delaying for 2027ms 19:10:05.337725E:SRT.d: SND-DROPPED 24 packets - lost delaying for 2028ms 19:10:05.351648E:SRT.d: SND-DROPPED 30 packets - lost delaying for 2029ms 19:10:05.364611E:SRT.d: SND-DROPPED 33 packets - lost delaying for 2027ms 19:10:05.377650*E:SRT.d: SND-DROPPED 37 packets - lost delaying for 2028ms

More lantency get SND-DROPPED log too. Increase lantency=3500 that will stopped transfer between caller & listen and listener log

19:13:51.609379E:SRT.c: %832332598:No room to store incoming packet: offset=0 a vail=0 ack.seq=1167829813 pkt.seq=1167829813 rcv-remain=8191 19:13:51.619792E:SRT.c: %832332598:No room to store incoming packet: offset=1 a vail=0 ack.seq=1167829813 pkt.seq=1167829814 rcv-remain=8191 4516512 bytes lost, 0 bytes sent, 4516512 bytes received

maxsharabayko commented 5 years ago

What is your input bitrate? You might want to set the proper maxbw bandwidth limit value. See Issue #552.

edwardlai commented 5 years ago

MPTS bitrate is 45Mbps (udp://229.1.1.7:1117) I have tried to set maxbw=0 ,now no more Drop message occur

caller srt-live-transmit.exe udp://229.1.1.7:1117 "srt://220.130.142.139:5111?maxbw=0&fc=51200&sndbuf=125000000"

listener

srt-live-transmit.exe "srt://:5111?maxbw=0&fc=51200&rcvbuf=125000000" "srt://:5222?maxbw=0&fc=51200&sndbuf=125000000"

But Use VLC Player to play SRT://xxx.xxx.xxx.xxx:5222, video and audio not smooth , video will hang

maxsharabayko commented 5 years ago

That is already another connection: srt-live-transmit -> VLC. VLC allows to configure SRT somewhere in the advanced options. You might want to increase latency there. Tools -> Preferences -> All -> Input/Codec -> SRT. Unfortunately there is no option in VLC to increase buffers.

Another way is to stream to localhost UDP and playback with VLC.

edwardlai commented 5 years ago

Thanks @maxlovic The same caller & listener command test two mpts source, have different results

Finally I direct inject ts on source site (caller), command below .

srt-live-transmit.exe udp://228.0.28.28:2801 file://con > 18Mbps.ts

srt-live-transmit.exe udp://229.1.1.7:1117 file://con > 45Mbps.ts

18Mbps video & audio ok 45Mbps bad video quality hang or mosaic , audio ok

maxsharabayko commented 5 years ago

@edwardlai Great. Can close this issue then?