Wrong phones opening when using a combined bat file
When using a bat file to open multiple phones with a "timeout 5" in-between each phone, sometimes it will open the wrong serial number with a different title, when i close that phone, others start to disconnect, it can normally be fixed with a PC restart or replugging in all the USBs but its a lot of work and frustrating when it still doesnt work, anybody know how to fix that?
Please show your bat file.
start scrcpy-noconsole.vbs -s 232db144d10c7ece -m620 --stay-awake --turn-screen-off --prefer-text --window-x 0 --window-y 30 --window-title "Ang_w_6" --power-off-on-close
timeout 5
start scrcpy-noconsole.vbs -s ce081828d49e933b02 -m620 --stay-awake --turn-screen-off --prefer-text --window-x 305 --window-y 30 --window-title "JuliaN_93" --power-off-on-close
timeout 5
start scrcpy-noconsole.vbs -s 24103874830c7ece -m620 --stay-awake --turn-screen-off --prefer-text --window-x 610 --window-y 30 --window-title "StaceyS1" --power-off-on-close
timeout 5
start scrcpy-noconsole.vbs -s 988a16435555534d3730 -m620 --stay-awake --turn-screen-off --prefer-text --window-x 915 --window-y 30 --window-title "JanG_07" --power-off-on-close
timeout 5
start scrcpy-noconsole.vbs -s ce0718275d934b3701 -m620 --stay-awake --turn-screen-off --prefer-text --window-x 1220 --window-y 30 --window-title "Adrian_9" --power-off-on-close
timeout 5
start scrcpy-noconsole.vbs -s 2258ccac3b057ece -m620 --stay-awake --turn-screen-off --prefer-text --window-x 1525 --window-y 30 --window-title "ShellP_8" --power-off-on-close
timeout 5
start scrcpy-noconsole.vbs -s ce07182764df573b05 -m620 --stay-awake --turn-screen-off --prefer-text --window-x 1830 --window-y 30 --window-title "Suza_31" --power-off-on-close
timeout 5
start scrcpy-noconsole.vbs -s ce11182be4e9b53c03 -m620 --stay-awake --turn-screen-off --prefer-text --window-x 0 --window-y 680 --window-title "NicF_9" --power-off-on-close
timeout 5
start scrcpy-noconsole.vbs -s 2a6dcdbcc70b7ece -m620 --stay-awake --turn-screen-off --prefer-text --window-x 305 --window-y 680 --window-title "Bronagh_22" --power-off-on-close
timeout 5
start scrcpy-noconsole.vbs -s 988a9743353350333930 -m620 --stay-awake --turn-screen-off --prefer-text --window-x 610 --window-y 680 --window-title "KellyA_0" --power-off-on-close
timeout 5
start scrcpy-noconsole.vbs -s ce04171420dfbc2f0c -m620 --stay-awake --turn-screen-off --prefer-text --window-x 915 --window-y 680 --window-title "JacqJ_" --power-off-on-close
timeout 5
start scrcpy-noconsole.vbs -s 4636454342553398 -m620 --stay-awake --turn-screen-off --prefer-text --window-x 1220 --window-y 680 --window-title "Rose_" --power-off-on-close
timeout 5
start scrcpy-noconsole.vbs -s 988837473434543844 -m620 --stay-awake --turn-screen-off --prefer-text --window-x 1525 --window-y 680 --window-title "Michelle_" --power-off-on-close
timewout 5
start scrcpy-noconsole.vbs -s ce0317133048bd0f04 -m620 --stay-awake --turn-screen-off --prefer-text --window-x 1830 --window-y 680 --window-title "Lynne_" --power-off-on-close
timeout 5
start scrcpy-noconsole.vbs -s ce06171644b87cfd0d7e -m620 --stay-awake --turn-screen-off --prefer-text --window-x 0 --window-y 1330 --window-title "GemmaG_" --power-off-on-close
timeout 5
start scrcpy-noconsole.vbs -s ce081828d954233e02 -m620 --stay-awake --turn-screen-off --prefer-text --window-x 305 --window-y 1330 --window-title "NicB_" --power-off-on-close
timeout 5
start scrcpy-noconsole.vbs -s 988a1c45445734374a -m620 --stay-awake --turn-screen-off --prefer-text --window-x 610 --window-y 1330 --window-title "Beat" --power-off-on-close
timeout 5
start scrcpy-noconsole.vbs -s ce031713f10b98e30d -m620 --stay-awake --turn-screen-off --prefer-text --window-x 915 --window-y 1330 --window-title "MattS_" --power-off-on-close
timeout 5
start scrcpy-noconsole.vbs -s 98899a3443334d4548 -m620 --stay-awake --turn-screen-off --prefer-text --window-x 1220 --window-y 1330 --window-title "Cla" --power-off-on-close
timeout 5
start scrcpy-noconsole.vbs -s ce05171578c2442c02 -m620 --stay-awake --turn-screen-off --prefer-text --window-x 1525 --window-y 1330 --window-title "LeighJ_" --power-off-on-close
timeout 5
start scrcpy-noconsole.vbs -s 9889db454641304943 -m620 --stay-awake --turn-screen-off --prefer-text --window-x 1830 --window-y 1330 --window-title "LauraG_" --power-off-on-close
timeoiut 5
start scrcpy-noconsole.vbs -s ce0718272d7a152904 -m620 --stay-awake --turn-screen-off --prefer-text --window-x 0 --window-y 1980 --window-title "EmmaS_5" --power-off-on-close
timeout 5
start scrcpy-noconsole.vbs -s ce031713e38008000d -m620 --stay-awake --turn-screen-off --prefer-text --window-x 305 --window-y 1980 --window-title "JulieH_" --power-off-on-close
timeout 5
start scrcpy-noconsole.vbs -s ce0617164832d0d20d -m620 --stay-awake --turn-screen-off --prefer-text --window-x 610 --window-y 1980 --window-title "Katie_" --power-off-on-close
timeout 5
start scrcpy-noconsole.vbs -s ce07182772afde2805 -m620 --stay-awake --turn-screen-off --prefer-text --window-x 915 --window-y 1980 --window-title "Shannon_" --power-off-on-close
timeout 5
start scrcpy-noconsole.vbs -s ce031713453734d00c -m620 --stay-awake --turn-screen-off --prefer-text --window-x 1220 --window-y 1980 --window-title "Graeme_" --power-off-on-close
timeout 5
start scrcpy-noconsole.vbs -s ce031713bd8de10f05 -m620 --stay-awake --turn-screen-off --prefer-text --window-x 1525 --window-y 1980 --window-title "KellyP_" --power-off-on-close
timeout 5
start scrcpy-noconsole.vbs -s 29d948b4f10b7ece -m620 --stay-awake --turn-screen-off --prefer-text --window-x 1830 --window-y 1980 --window-title "JodieT_" --power-off-on-close
timeout 5
start scrcpy-noconsole.vbs -s ce0317133209673703 -m620 --stay-awake --turn-screen-off --prefer-text --window-x 0 --window-y 2630 --window-title "Tracey H_" --power-off-on-close
timeout 5
start scrcpy-noconsole.vbs -s 244bd2492b1c7ece -m620 --stay-awake --turn-screen-off --prefer-text --window-x 305 --window-y 2630 --window-title "Rachea" --power-off-on-close
timeout 5
start scrcpy-noconsole.vbs -s ce011821c4d7b71b02 -m620 --stay-awake --turn-screen-off --prefer-text --window-x 610 --window-y 2630 --window-title "JodyC_" --power-off-on-close
sometimes it will open the wrong serial number with a different title
That is very surprising. Since all adb commands executed by scrcpy uses -s serial, such confusion looks impossible to me at the scrcpy level.
I've heard there can be usb issues when there are too many USB devices (especially on Windows), but that just means that a limited number of USB devices could be connected at once, it should not cause any confusion between devices.
when i close that phone, others start to disconnect
When you close 1 phone, several others get disconnected?
Its definitely something to do with too many phones connected, iv got around 40 connected at the minute, but majority of the time it works well, just now and then it starts playing up and can be quite annoying to fix. I do have a USB card installed which massively helped, might just need another one so each port isn't under so much stress?
As for the phone disconnecting, so when it loads up in the wrong order it will be one hub (i have 10 phones connected per hub) so say phone 1 loads, the text box will all be correct, but it will be matched with the wrong serial, so its basically a different phone in that spot, then when i X that phone, the others connected to that HUB will start to disconnect
Try to assign a different port to each device, because by default they all use the same (27183 by default, and increments until 27199 if it is already used):
scrcpy -p30001 … # 1st device
scrcpy -p30002 … # 2nd device
I thought that in any case it was not possible to confuse devices when they connect simultaneously, but if assigning a different port to each device works, then I might be wrong.
im a bit of a tech idiot so im a little confused by this, im guessing the ports aren't physical ports? its all working perfectly at the minute but ill test with the different ports when i get back to pc and see what happens, will report back
im guessing the ports aren't physical ports?
No, they're TCP ports (the device and the client communicate using TCP sockets).
and see what happens, will report back
:+1: thank you.
im guessing the ports aren't physical ports?
No, they're TCP ports (the device and the client communicate using TCP sockets).
and see what happens, will report back
👍 thank you.
Sorry it took so long to reply, this might be premature but i was having issues just now with it loading all the wrong phones, assigned ports and its all fixed!
You are a legend thank you so much
I thought that in any case it was not possible to confuse devices when they connect simultaneously, but if assigning a different port to each device works, then I might be wrong.
Do any device use adb forward instead of adb reverse? (use the .bat instead of the .vbs to get logs)
adb -s DEVICE1 forward tcp:1234 localabstract:abc
adb -s DEVICE2 forward tcp:1234 localabstract:abc
Both command exit with success, but the second one silently "overwrites" the config set by the first one:
$ adb forward --list
DEVICE2 tcp:1234 localabstract:abc
So when the client of DEVICE1 connects, it can actually connect to DEVICE2. (I would have expected the second command to fail instead.)
I can't explain the same behavior with the default adb reverse though.
I thought that in any case it was not possible to confuse devices when they connect simultaneously, but if assigning a different port to each device works, then I might be wrong.
Do any device use
adb forwardinstead ofadb reverse? (use the .bat instead of the .vbs to get logs)adb -s DEVICE1 forward tcp:1234 localabstract:abc adb -s DEVICE2 forward tcp:1234 localabstract:abcBoth command exit with success, but the second one silently "overwrites" the config set by the first one:
$ adb forward --list DEVICE2 tcp:1234 localabstract:abcSo when the client of DEVICE1 connects, it can actually connect to DEVICE2. (I would have expected the second command to fail instead.)
I can't explain the same behavior with the default
adb reversethough.
Not a clue how to test this, just put all the decide IDs in the code you posted and run it as a bat?
I do have one new problem since using ports, one of the phones seems to be playing sound through my computer and seems as tho its using my processing power for the phone, PC lags a little bit while doing heavy things on the phone, but does that with no others, plus all the others only play sound through the phones themselves, not the PC
one of the phones seems to be playing sound through my computer
All devices with Android >= 12 are expected to forward audio by default. If this is the only one, check the error message in the others.
If you want to disable audio forwarding, use --no-audio.
and seems as tho its using my processing power for the phone, PC lags a little bit while doing heavy things on the phone, but does that with no others
PC needs to decode the frames, so if the phone has a higher resolution than the others, it may require more power from the computer (especially when there is movement because there is more data). Try to limit the resolution and/or bit rate. Or maybe it's the audio processing. Is it better with --no-audio?
one of the phones seems to be playing sound through my computer
All devices with Android >= 12 are expected to forward audio by default. If this is the only one, check the error message in the others.
If you want to disable audio forwarding, use
--no-audio.and seems as tho its using my processing power for the phone, PC lags a little bit while doing heavy things on the phone, but does that with no others
PC needs to decode the frames, so if the phone has a higher resolution than the others, it may require more power from the computer (especially when there is movement because there is more data). Try to limit the resolution and/or bit rate. Or maybe it's the audio processing. Is it better with
--no-audio?
The no-audio thing didnt help, it stopped the sound but its still really laggy, i reduced the resolution and will check the bitrate today, ill also no no-audio on all of the phones and see if that helps too
one of the phones seems to be playing sound through my computer
All devices with Android >= 12 are expected to forward audio by default. If this is the only one, check the error message in the others.
If you want to disable audio forwarding, use
--no-audio.and seems as tho its using my processing power for the phone, PC lags a little bit while doing heavy things on the phone, but does that with no others
PC needs to decode the frames, so if the phone has a higher resolution than the others, it may require more power from the computer (especially when there is movement because there is more data). Try to limit the resolution and/or bit rate. Or maybe it's the audio processing. Is it better with
--no-audio?
So after checking task manager my CPU is running at 100% while im running slots on the phones, 50 connected right now, is there a way to reduce the strain or should i just upgrade my cpu? currently using 11th Gen Intel(R) Core(TM) i9-11900K @ 3.50GHz 3.50 GHz
So after checking task manager my CPU is running at 100% while im running slots on the phones, 50 connected right now
If you decode 50 video streams, it is not surprising that it takes a lot of CPU.
So after checking task manager my CPU is running at 100% while im running slots on the phones, 50 connected right now
If you decode 50 video streams, it is not surprising that it takes a lot of CPU.
yea was hoping my processor would be strong enough tbh but i guess not, iv lowered the bit rates to 4000k now so hopefully that helps, if not ill need to upgrade my system, cheers for all your help
You could encode with a lower complexity profile/level (so that it's "simpler" to decode). See the highlights at the end of https://github.com/Genymobile/scrcpy/releases/tag/v1.14 (the option is now named --video-codec-options=).
You can also limit frame rate (--max-fps=15).