SQM drop my stream, need help with setting priority for port:1935 RTMP

Good afternoon.
Same as title.
Screens:
With SQM OFF


0 frame drops in 40min of testing
With SQM ON:
CAKE
Piece of cake.qos

After 1 hour of testing, stream drop 4% of frames.
Drops happends every 5-10min.

It's all about set priority to port 1935 in SQM
I read that topic:Ultimate SQM settings: Layer_cake + DSCP marks
but it's not noob friendly tutorial :C

My router: TL-WR1043ND v4.0

Is this outbound from your LAN? Or inbound to your LAN?

If it's outbound, this is easy. Add a rule that DSCP tags your packets something like CS5 and then use layer cake on the egress of WAN. You can put something like this in your custom rules under firewall tab on LuCI

(note, this assumes you've got UDP streams, but you can make modifications if it's TCP)

# set up a marking table in iptables

iptables -t mangle -N dscp_mark
ip6tables -t mangle -N dscp_mark
iptables -t mangle -F dscp_mark
ip6tables -t mangle -F dscp_mark
iptables -t mangle -A FORWARD -j dscp_mark
ip6tables -t mangle -A FORWARD -j dscp_mark

## now mark stuff sent to or from port 1935 

iptables -t mangle -A dscp_mark  -p udp --sport 1935 -j DSCP --set-dscp-class CS5
ip6tables -t mangle -A dscp_mark -p udp --sport 1935 -j DSCP --set-dscp-class CS5
iptables -t mangle -A dscp_mark  -p udp --dport 1935 -j DSCP --set-dscp-class CS5
ip6tables -t mangle -A dscp_mark -p udp --dport 1935 -j DSCP --set-dscp-class CS5

Now use Layer Cake with diffserv4 on your WAN.

If you have problems with inbound packets, it's harder... because iptables doesn't run until after cake queues in the IFB device...

But, try this, and hope that helps by itself!

The WAN from modem is plugged into router in other room, and i connect my TL-WR1043ND V4 to it through Wi Fi client and add it to same network where wan is.


Then i plug my PC to TL-WR1043ND V4 and that's what is looks like.

Thanks Man, il give it a try!

Problem still exist
Screens:



after saving the settings i reset the router.
And i try option with TCP and UDP.
Maybe i'm doing something wrong?

And 2 speedtest with SQM on and OFF
OFF


ON

You need to have SQM installed only on the router that is directly connected to the modem. Otherwise the SQM doesn't have complete control over the connection.

Also, you can't expect reliable low latency streaming with no drops across a wifi link. Even more so for two wifi links (ie. your computer connected by wifi to an access point whose uplink is also a wifi link) That's a mess particularly because wifi is simplex and a shared channel with you and anyone else in range.

I turned off acess to wi fi during test, so there is no chance of some error from this side.
I can do some test's in long range without SQM and result be the same with SQM OFF and ON.
And everything is connected to TL-WR1043NDv4, 0 devices on the other router.

Before this problem i was using gargoyle and TL-WR1043ND v4 pluged into modem, on my pc i connect through Wi Fi pcie card. With set priority on the port 1935 UDP i have no problem at all, but when i download some files on my pc then i get drops, when i dont and everyone using wi fi and i only do streaming 0 problems.
Its all about that crapy pcie card TL-WN881ND, that card can't handle upload and download on same time higher than 20Mb/s.
So i try my current setup, but gargoyle do not apply a settings to WWAN, so i change soft to openWRT.
But still i have that problem with setting up priority for that 1935 udp port...

For now i just stop using SQM, and wait for help or new update to SQM or other QOS solution.

For reliable streaming, particularly real-time, you need a wired connection between your PC and the router, and then a wired connection from router to modem and no other devices plugged into modem. With those in place, and the DSCP tagging and layer cake... you should be good to go. Obviously not so easy if you can't run that wire.

1 Like

That will only work if the data on port 1935 stays within the rate alloted exclusively for the high priority tin, no? (Cake will not arbitrarily throttle, but excess data will be put in one of the lower tins so that other traffic has a fair chance "competing" with it).

I have a not perfect solution, but kind off...
On router in other room i hide wi fi ESSID for good.
On TL-WR1043ND v4 i do this

I just limited a RTX ON Wi Fi on SQM to 1.5Mb/s upload and 30Mb/s download (it is inversely because something is not reading this interface correctly).
Then i run my test stream and on my phone okla speedtest and what?
0 drops so problem is definietly a SQM.

But still if i upload something on my PC or start okla speedtest stream start drop, but this is probably obvious because still i dont change priority for port 1935.
That solution probably stay with me for a while...

Nope, all is well, the names upload and downloadin the GUI are only aligned with internet-upload and internet-download on an outward facing interface like WAN; these "directions" are always from the viewpoint of the actual interface, and since LAN points inward, if you send traffic inward (which might be an internet-download) it is carried in the interfaces egress/upload direction, and vice versa for ingress. The reason why the GUI names imply internet up and downloads is because typically sqm is instantiated on a WAN interface and in that common situation there is no need to confuse users with interface-specific data-transfer directions. The downside is that user's with SQM on LAN interface still need to understand this detail...

Yeah, definitely an issue... I feel like a simple JSON based description language for QoS + a "compiler" that takes the JSON language and outputs a shell script that implements it would be a fabulous piece of software... If I could get like 20,000 people to pledge $10 to develop it... I'd be all set :wink:

PSST...the protocol is tcp not udp for RMTP port 1935.

1 Like

Cold you elaborate on your set-up, please?

I read something like:

[1: MODEM] -> cable -> [2: OTHER ROUTER] -> WiFi -> [3: TL-WR1043ND V4]

is that correct? I assume SQM runs on 3:, correct?

But what does

mean?

So, the issue is that you want on the same machine download files AND stream video (do you stream fro the internet, or are you streaming from your home to the internet)?

That is probably not going to happen, so we might be better off trying to figure out what exactly goes pear shaped, as is your issue-report is way to unspecific (in regards to how SQM is responsible, I am not doubting your data, but we need a hypothesis what exactly goes wrong before we can even think about updating SQM).

So you have two SSIDs on the same 2.4GHz radio and use one as uplink to the other router 2: and the other to connect to your router 3:? And instantiating SQM on router 3:'s LAN bridge (which includes the RTX ON SSID) helps with your issues?

I am actually puzzled that this works at all with all the dependebcies between things.

Realistically, you would be best off, by instantiating SQM on the primary router connected to the modem 1: to deal with internet bufferbloat (preferably in per-internal-IP-isolation mode, see https://openwrt.org/docs/guide-user/network/traffic-shaping/sqm-details's " Making cake sing and dance, on a tight rope without a safety net (aka advanced features)" section for pointers).

And the next thing, if you need two routers would be to connect them with a wire to get rid of overloading your single? radio with both with the same packets twice (packets from the internet come via WiFi from router 2: only to be send over the same radio from router 3: to your PC, so will be sent over twice by the same radio, eating up bandwidth/transmit opportunities twice).

sqm on ingress will not work if the limit is not smaller than your actual max speed.
try with a lower value for the ingress/download limit on the wan instance:
30mbps - 10% ~= 27mbps

1 Like

Good point, as a rule of thumb, you could run a speedtest and plug the net-goodput measured into the respective gross shaper rate field.

@moeller0

the setup:
MODEM -> CABLE - > 1st Router - > Wi Fi -> 2st Router (TL-WR1043ND v4) -> CABLE -> PC

"I turned off acess to wi fi during test," i change the password and hide SSID
"And everything is connected to TL-WR1043NDv4, 0 devices on the other router."
I mean the only one thing connected to the 1st Router is 2st Router.

~ from home to the internet

"That is probably not going to happen, so we might be better off trying to figure out what exactly goes pear shaped, as is your issue-report is way to unspecific (in regards to how SQM is responsible, I am not doubting your data, but we need a hypothesis what exactly goes wrong before we can even think about updating SQM)."

Sure, I am grateful for your time ;d

"So you have two SSIDs on the same 2.4GHz radio and use one as uplink to the other router 2: and the other to connect to your router 3:? And instantiating SQM on router 3:'s LAN bridge (which includes the RTX ON SSID) helps with your issues?"

The 1st Router have hiden SSID, 2.4Ghz 40Mhz
2st Router have visible SSID, 2.4Ghz 40Mhz, the bandwith is limited in SQM as you can check on previus post (the SQM only affect the Wi Fi not LAN, so the PC have full bandwith, but still if i try to do something with upload on PC i get droped frames). Vesterday i run my stream without SQM for 4 hours and i get only (0.3%) of drop it's probably ISP thing.

"And the next thing, if you need two routers would be to connect them with a wire to get rid of overloading your single?" It's probably the best option to do that kind of things, but i can't use the cable :C

"Good point, as a rule of thumb, you could run a speedtest and plug the net-goodput measured into the respective gross shaper rate field." Still nothing changed :C

@mindwolf
Yea my bad, but i always test both for sure.

Well, could you switch the routing around, and wire the TL-WR1043ND v4 to the modem and connect the old 1st router via WiFi, that wat SQM would be at a better position to actually shape internet ingress and egress traffic (or alternatively install sqm on the old 1st router).

I believe, that you are better off to push the disable button in LUCI for a SSID you want to take out of the equation.

BTW, what is the RTT between you and the servers that you connect to for streaming (and are you mainly receiving data from the internet or are you sending data)? And do you have any idea of the required bandwidth for your streaming, are we talking 5 Mbps or rather in the 20 Mbps range?

A hidden SSID is not really that much of a problem to detect/discover, and for radio frequency interferences it does not matter whether there is a visible SSID, if I understand this correctly.

To be completely clear, if you are streaming via TCP, as @mindwolf indicated, you will see some packet drops because the occasional dropped packet comes as part of TCP's bandwidth probing method, so unless you encounter visual/auditory artifacts from those drops a few are simply unavoidable with TCP...

Mmmh, so if you try to upload stuff while streaming you see the problem, so let me ask again are you streaming inward or outward into the internet?

Well, could you switch the routing around, and wire the TL-WR1043ND v4 to the modem and connect the old 1st router via WiFi, that wat SQM would be at a better position to actually shape internet ingress and egress traffic (or alternatively install sqm on the old 1st router).

The 1st router is not supported by any alternative software, and there is no way to connect as client to 2st Router

BTW, what is the RTT between you and the servers that you connect to for streaming (and are you mainly receiving data from the internet or are you sending data)? And do you have any idea of the required bandwidth for your streaming, are we talking 5 Mbps or rather in the 20 Mbps range?

My current bandwidth use from OBS is around 6.0Mb/s - 6.2Mb/s (6 Mb/s for video in FHD 60fps and 0.16Mb/s for audio)
I have some problems with Twitch.TV (20% drop on the stream without any QOS stuff, yes i test the other servers) serwers so i change the platform to YouTube and 0 problems

Mmmh, so if you try to upload stuff while streaming you see the problem, so let me ask again are you streaming inward or outward into the internet?

I'm streaming from my pc to YouTube and while i have a google drive in background uploading some files or something else frames start drops.

And problem is geting worse when the other users start using wi fi :C (if everything is under SQM)