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

Video goes to black screen and the Scrcpy crashes #1821

Closed
AlienProber opened this issue Oct 9, 2020 · 36 comments
Closed

Video goes to black screen and the Scrcpy crashes #1821

AlienProber opened this issue Oct 9, 2020 · 36 comments

Comments

@AlienProber
Copy link

When I launch Scrxpy and attempt to watch a video it plays for a few seconds then goes to a black screen and ultimately crashes. The video can be seen still playing on the phone, so it is something with Scrcpy. I tried with both Quibi and Youtube and it's the same. On a secondary note I noticed that with this install of Scrcpy that the sound is not being ported to the computer like with past installs of Scrcpy.

[alienprober@TheMotrhership ~]$ inxi -Fxxxza
System:
  Kernel: 5.8.13-arch1-1 x86_64 bits: 64 compiler: gcc v: 10.2.0 
  parameters: BOOT_IMAGE=/@/boot/vmlinuz-linux 
  root=UUID=128d1d7c-1028-4416-b91d-882b6c7c7d2b rw rootflags=subvol=@ 
  quiet loglevel=3 nowatchdog 
  Desktop: KDE Plasma 5.19.90 tk: Qt 5.15.1 wm: kwin_x11 dm: SDDM 
  Distro: EndeavourOS 
Machine:
  Type: Desktop Mobo: ASUSTeK model: ROG STRIX B450-F GAMING 
  v: Rev 1.xx serial: <filter> UEFI: American Megatrends v: 3103 
  date: 06/17/2020 
Battery:
  Device-1: hidpp_battery_0 model: Logitech Wireless Mouse 
  serial: <filter> charge: 55% (should be ignored) rechargeable: yes 
  status: Discharging 
  Device-2: hidpp_battery_1 model: Logitech Wireless Keyboard K360 
  serial: <filter> charge: 100% (should be ignored) rechargeable: yes 
  status: Discharging 
CPU:
  Info: Quad Core model: AMD Ryzen 3 3200G with Radeon Vega Graphics 
  bits: 64 type: MCP arch: Zen+ family: 17 (23) model-id: 18 (24) 
  stepping: 1 microcode: 8108109 L2 cache: 2048 KiB 
  flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm 
  bogomips: 28762 
  Speed: 2865 MHz min/max: 1400/3600 MHz boost: enabled 
  Core speeds (MHz): 1: 1680 2: 1263 3: 1305 4: 1394 
  Vulnerabilities: Type: itlb_multihit status: Not affected 
  Type: l1tf status: Not affected 
  Type: mds status: Not affected 
  Type: meltdown status: Not affected 
  Type: spec_store_bypass 
  mitigation: Speculative Store Bypass disabled via prctl and seccomp 
  Type: spectre_v1 
  mitigation: usercopy/swapgs barriers and __user pointer sanitization 
  Type: spectre_v2 mitigation: Full AMD retpoline, IBPB: conditional, 
  STIBP: disabled, RSB filling 
  Type: srbds status: Not affected 
  Type: tsx_async_abort status: Not affected 
Graphics:
  Device-1: NVIDIA TU116 [GeForce GTX 1650 SUPER] vendor: eVga.com. 
  driver: nvidia v: 455.28 bus ID: 01:00.0 chip ID: 10de:2187 
  Display: x11 server: X.Org 1.20.9 compositor: kwin_x11 driver: nvidia 
  note: display driver n/a display ID: :0 screens: 1 
  Screen-1: 0 s-res: 2560x1080 s-dpi: 97 s-size: 670x283mm (26.4x11.1") 
  s-diag: 727mm (28.6") 
  Monitor-1: HDMI-0 res: 2560x1080 hz: 60 dpi: 97 
  size: 673x284mm (26.5x11.2") diag: 730mm (28.8") 
  OpenGL: renderer: GeForce GTX 1650 SUPER/PCIe/SSE2 
  v: 4.6.0 NVIDIA 455.28 direct render: Yes 
Audio:
  Device-1: NVIDIA TU116 High Definition Audio vendor: eVga.com. 
  driver: snd_hda_intel v: kernel bus ID: 01:00.1 chip ID: 10de:1aeb 
  Device-2: AMD Family 17h HD Audio vendor: ASUSTeK 
  driver: snd_hda_intel v: kernel bus ID: 0a:00.6 chip ID: 1022:15e3 
  Sound Server: ALSA v: k5.8.13-arch1-1 
Network:
  Device-1: Intel I211 Gigabit Network vendor: ASUSTeK driver: igb 
  v: 5.6.0-k port: d000 bus ID: 04:00.0 chip ID: 8086:1539 
  IF: enp4s0 state: up speed: 1000 Mbps duplex: full mac: <filter> 
Drives:
  Local Storage: total: 16.38 TiB used: 7.55 TiB (46.1%) 
  SMART Message: Unable to run smartctl. Root privileges required. 
  ID-1: /dev/nvme0n1 model: Viper M.2 VPN100 size: 238.47 GiB 
  block size: physical: 512 B logical: 512 B speed: 31.6 Gb/s lanes: 4 
  serial: <filter> rev: ECFM22.6 scheme: GPT 
  ID-2: /dev/sda vendor: Western Digital model: WD10EARS-00Y5B1 
  size: 931.51 GiB block size: physical: 512 B logical: 512 B 
  speed: 3.0 Gb/s serial: <filter> rev: 0A80 scheme: GPT 
  ID-3: /dev/sdb vendor: Seagate model: ST3000DM001-1E6166 
  size: 2.73 TiB block size: physical: 4096 B logical: 512 B 
  speed: 6.0 Gb/s rotation: 7200 rpm serial: <filter> rev: SC48 
  scheme: GPT 
  ID-4: /dev/sdc type: USB vendor: Seagate model: Expansion Desk 
  size: 7.28 TiB block size: physical: 4096 B logical: 512 B 
  serial: <filter> rev: 9401 scheme: GPT 
  ID-5: /dev/sdd type: USB vendor: Seagate model: Expansion 
  size: 1.82 TiB block size: physical: 4096 B logical: 512 B 
  serial: <filter> rev: 9300 scheme: GPT 
  ID-6: /dev/sde type: USB vendor: MediaMax model: WL3000GSA6454 
  size: 3.41 TiB block size: physical: 4096 B logical: 512 B 
  rotation: 5400 rpm serial: <filter> scheme: GPT 
Partition:
  ID-1: / raw size: 237.99 GiB size: 237.99 GiB (100.00%) 
  used: 37.23 GiB (15.6%) fs: btrfs dev: /dev/nvme0n1p2 
  ID-2: /home raw size: 237.99 GiB size: 237.99 GiB (100.00%) 
  used: 37.23 GiB (15.6%) fs: btrfs dev: /dev/nvme0n1p2 
Swap:
  Alert: No Swap data was found. 
Sensors:
  System Temperatures: cpu: 43.2 C mobo: N/A gpu: nvidia temp: 41 C 
  Fan Speeds (RPM): N/A gpu: nvidia fan: 0% 
Info:
  Processes: 341 Uptime: 1d 5h 16m Memory: 15.62 GiB 
  used: 6.45 GiB (41.3%) Init: systemd v: 246 Compilers: gcc: 10.2.0 
  Packages: 1360 pacman: 1311 lib: 353 flatpak: 42 snap: 7 Shell: Bash 
  v: 5.0.18 running in: konsole inxi: 3.1.07 
[alienprober@TheMotrhership ~]$ 
@rom1v
Copy link
Collaborator

rom1v commented Oct 9, 2020

Could you play a video while you record with:

adb shell screenrecord /sdcard/file.mp4

?

@Uj947nXmRqV2nRaWshKtHzTvckUUpD
Copy link

Uj947nXmRqV2nRaWshKtHzTvckUUpD commented Oct 9, 2020

I wanted to open issue about same thing today. Actually for me it crashes at random times, even in idle state. Screen goes black for a second and then window closes. For me it is unrelated with running a video.

I run with scrcpy-win64-v1.16\scrcpy-noconsole.exe -wS -m 2160 --render-driver=opengl --max-fps 60 --bit-rate 16M

@rom1v
Copy link
Collaborator

rom1v commented Oct 9, 2020

It's probably a render driver issue.

Could you try without --render-driver=opengl (OpenGL drivers are not always good on Windows).

@Uj947nXmRqV2nRaWshKtHzTvckUUpD

It crashed with direct3d as well as i tried previously. Actually this is the reason why I switched to opengl as I also thought it is render driver issue.

@rom1v
Copy link
Collaborator

rom1v commented Oct 9, 2020

What's the output in the console when it crashes? (start scrcpy.exe from a console, not scrcpy-noconsole.exe)

@AlienProber
Copy link
Author

Couple of questions. I'm assuming run that command from Konsole after I launch Scrcpy and then the video on the phone? Second won't that save it to the SD card instead of the system?

@rom1v
Copy link
Collaborator

rom1v commented Oct 9, 2020

I'm assuming run that command from Konsole after I launch Scrcpy and then the video on the phone?

No, without scrcpy at all: adb shell screenrecord /sdcard/file.mp4 (it will record the file on the device).

I suspect that the problem is that your hardware is not able to decode/display a video while capturing the screen.

@Uj947nXmRqV2nRaWshKtHzTvckUUpD
Copy link

Uj947nXmRqV2nRaWshKtHzTvckUUpD commented Oct 9, 2020

I tested again, this time with scrcpy.exe and direct3d
... scrcpy-win64-v1.16\scrcpy.exe -wS -m 2160 --render-driver=direct3d --max-fps 60 --bit-rate 16M

When it crashed, in cmd shows:
WARN: Device disconnected
Press any key to continue...

I can use the same command right after and reconnect. So i don't think is a network issue.

@rom1v
Copy link
Collaborator

rom1v commented Oct 9, 2020

@Uj947nXmRqV2nRaWshKtHzTvckUUpD

I am on wi-fi so no usb cable. Also it happens super random i can use it for some minutes and crash or one hour straight and no problem.

@rom1v
Copy link
Collaborator

rom1v commented Oct 9, 2020

I am on wi-fi so no usb cable. Also it happens super random i can use it for some minutes and crash or one hour straight and no problem.

It's an adb disconnection.

If you execute adb logcat in a separate terminal, you'll see that the command will terminate at the exact same time you get Device disconnected in scrcpy.

@Uj947nXmRqV2nRaWshKtHzTvckUUpD
Copy link

Uj947nXmRqV2nRaWshKtHzTvckUUpD commented Oct 9, 2020

when it crashes i still see it so adb it's not disconnecting:
adb devices
List of devices attached
<wlan_ip>:5555 device

however i got this error in logcat right before crashing:

10-10 04:53:04.955 1693 2312 V AlarmManager: Triggering alarm #0: 2 when =2965835 package =com.android.networkstack.inprocess operation = null li
stenTag =DhcpClient.wlan0.KICK flags =0x9
10-10 04:53:04.957 1693 2898 D DhcpClient: Broadcasting DHCPREQUEST ciaddr=192.168.0.X request=0.0.0.0 serverid=null
10-10 04:53:04.959 1693 2898 E DhcpClient: Can't send packet:
10-10 04:53:04.959 1693 2898 E DhcpClient: android.system.ErrnoException: sendto failed: EPERM (Operation not permitted)
10-10 04:53:04.959 1693 2898 E DhcpClient: at libcore.io.Linux.sendtoBytes(Native Method)
10-10 04:53:04.959 1693 2898 E DhcpClient: at libcore.io.Linux.sendto(Linux.java:225)
10-10 04:53:04.959 1693 2898 E DhcpClient: at libcore.io.ForwardingOs.sendto(ForwardingOs.java:193)
10-10 04:53:04.959 1693 2898 E DhcpClient: at libcore.io.BlockGuardOs.sendto(BlockGuardOs.java:358)
10-10 04:53:04.959 1693 2898 E DhcpClient: at android.system.Os.sendto(Os.java:522)
10-10 04:53:04.959 1693 2898 E DhcpClient: at android.net.dhcp.DhcpClient.transmitPacket(DhcpClient.java:463)
10-10 04:53:04.959 1693 2898 E DhcpClient: at android.net.dhcp.DhcpClient.sendRequestPacket(DhcpClient.java:500)
10-10 04:53:04.959 1693 2898 E DhcpClient: at android.net.dhcp.DhcpClient.access$2600(DhcpClient.java:116)
10-10 04:53:04.959 1693 2898 E DhcpClient: at android.net.dhcp.DhcpClient$DhcpReacquiringState.sendPacket(DhcpClient.java:1053)
10-10 04:53:04.959 1693 2898 E DhcpClient: at android.net.dhcp.DhcpClient$PacketRetransmittingState.processMessage(DhcpClient.java:787)
10-10 04:53:04.959 1693 2898 E DhcpClient: at android.net.networkstack.util.StateMachine$SmHandler.processMsg(StateMachine.java:992)
10-10 04:53:04.959 1693 2898 E DhcpClient: at android.net.networkstack.util.StateMachine$SmHandler.handleMessage(StateMachine.java:809)
10-10 04:53:04.959 1693 2898 E DhcpClient: at android.os.Handler.dispatchMessage(Handler.java:107)
10-10 04:53:04.959 1693 2898 E DhcpClient: at android.net.networkstack.util.WakeupMessage.onAlarm(WakeupMessage.java:133)
10-10 04:53:04.959 1693 2898 E DhcpClient: at android.app.AlarmManager$ListenerWrapper.run(AlarmManager.java:263)
10-10 04:53:04.959 1693 2898 E DhcpClient: at android.os.Handler.handleCallback(Handler.java:883)
10-10 04:53:04.959 1693 2898 E DhcpClient: at android.os.Handler.dispatchMessage(Handler.java:100)
10-10 04:53:04.959 1693 2898 E DhcpClient: at android.os.Looper.loop(Looper.java:214)
10-10 04:53:04.959 1693 2898 E DhcpClient: at android.os.HandlerThread.run(HandlerThread.java:67)
10-10 04:53:04.965 1693 2898 D DhcpClient: doQuit
10-10 04:53:04.968 1693 2898 D ApfFilter: (wlan0): shutting down

@AlienProber
Copy link
Author

Can the Windows specific stuff be moved to it's own issue ticket?

@rom1v
Copy link
Collaborator

rom1v commented Oct 9, 2020

when it crashes i still see it so adb it's not > disconnecting:
adb devices
List of devices attached
<wlan_ip>:5555 device

Yes, that's expected that it still appears here, but you get a disconnection. Check with adb logcat (whatever the content, just check when it terminates and give the prommt back).

A workaround is planned to auto-reconnect on disconnection: #721 (comment)

Can the Windows specific stuff be moved to it's own issue ticket?

Sorry for the thread hijack.

@AlienProber
Copy link
Author

OK the command just sits there doing nothing .

@rom1v
Copy link
Collaborator

rom1v commented Oct 9, 2020

It saves a file to /sdcard/file.mp4 though :)

So it seems it does not cause problems to your Android video playback?

@Uj947nXmRqV2nRaWshKtHzTvckUUpD

Sorry too for the hijack, I am trying to figure out if we are on the same common ground. I am still not convinced about what causes these crashes.. @SecretAgentAgentX can you reproduce the issue every time? Did the crash only occured when playing a video? It might not be related with host OS, but rather with the connectivity handling. May I ask your device's (phone) specs?

@Uj947nXmRqV2nRaWshKtHzTvckUUpD

@rom1v update: i left logcat open and indeed the adb shell connection dropped. so it is more related to this that actually to scrcpy.. Maybe android is killing the connection for some reason in my case

@AlienProber
Copy link
Author

@fusionneur not now but tomorrow morning I'll just launch Scrcpy and put the phone through it's paces and see if Scrcpy crashes without a video being played. Then we'll know if we possibly have the same issue.

@rom1v So as long as the video is recording correctly the Konsole output will look like above?

@AlienProber
Copy link
Author

@fusionneur you may be on to something, cause I've seen in the past Android kill services.

@Uj947nXmRqV2nRaWshKtHzTvckUUpD
Copy link

Uj947nXmRqV2nRaWshKtHzTvckUUpD commented Oct 10, 2020

it would be interesting to see if you get same logcat on crash. i think in my case, there's something wrong with my dhcpclient not being able to renew ip properly (note that i have quite a complex setup: magisk + edxposed + afwall+netguard+xprivacyLua+shelter)

10-10 02:53:34.805 1535 3179 D DhcpClient: Broadcasting DHCPREQUEST ciaddr=192.168.0.X request=0.0.0.0 serverid=null
10-10 02:53:34.809 1535 3179 E DhcpClient: Can't send packet:
10-10 02:53:34.809 1535 3179 E DhcpClient: android.system.ErrnoException: sendto failed: EPERM (Operation not permitted)
....
10-10 02:53:34.814 1535 3179 D DhcpClient: doQuit
10-10 02:53:34.815 1535 3179 D ApfFilter: (wlan0): shutting down

The first 4 lines appear multiple times in the log but without crashing.. i think only after several retries it drops , more exactly when the dhcp lease expires.. But also could be a permission or xprivacy permission issue , selinux,firewall issue or even firmware. i might be wrong though, I will dig into this further today

@AlienProber
Copy link
Author

Good morning I just did my above test and ran the phone through it's paces and no issues with Scrcpy. I even navigated to the file explorer and played the first minute of music video that is on the SD card without issue. I doubt the below will help any, but just in case I'm posting it any way.

[alienprober@TheMotrhership ~]$ scrcpy
INFO: scrcpy 1.16 <https://github.com/Genymobile/scrcpy>
/usr/share/scrcpy/scrcpy-server: 1 f...d. 72.8 MB/s (33622 bytes in 0.000s)
[server] INFO: Device: motorola moto e5 play (Android 8.0.0)
INFO: Renderer: opengl
INFO: OpenGL version: 4.6.0 NVIDIA 455.28
INFO: Trilinear filtering enabled
INFO: Initial texture: 720x1280
INFO: New texture: 1280x720
INFO: New texture: 720x1280
INFO: New texture: 1280x720

@Uj947nXmRqV2nRaWshKtHzTvckUUpD
Copy link

Uj947nXmRqV2nRaWshKtHzTvckUUpD commented Oct 10, 2020

Update: I found in afwall log, that it was blocking dhcp broadcast whenever IP renewal was about to happen. To be honest i don't know why this happens, because system (pid 1000) is allowed on LAN and the 'phone wlan0 <> router gateway IP' connections on ports 67/68 are ok...only broadcasts are blocked. I am going to raise an issue to ukanth/afwall maybe we can shed some light on this matter

Sorry for the big hijack :) Please let us know if you still see disconnects even after prolonged usage.

@Uj947nXmRqV2nRaWshKtHzTvckUUpD

I finally managed to workaround my disconnection issue with a custom script set in afwall:
iptables -I afwall-wifi 1 -o wlan0 -s 192.168.0.0/16 -d 255.255.255.255 -p udp --sport 68 --dport 67 -j ACCEPT -m comment --comment "Allow DHCP request broadcast"
#supposing that your lan ip is somewhere in 192.168.0.0/16 range

I opened an issue at ukanth/afwall ukanth/afwall#1149

@rom1v you might be interested of one reason why some folks might get random disconnections due to afwall

@AlienProber
Copy link
Author

@rom1v I'm not understanding your one comment about the hardware sicne on a AM3+ 6300 and a nVidia 750 I had no such issues with videos, but supposedly on a AM4 Ryzen 3 3200g and a nVidia 1650 the hardware is incapable of supporting video playback through Scrcpy from the phone?

@rom1v
Copy link
Collaborator

rom1v commented Oct 12, 2020

I depends on what you mean by "ultmiately crashes".

goes to a black screen and ultimately crashes.

What's the output in the scrcpy console when it "crashes", and are there errors in adb logcat?

@AlienProber
Copy link
Author

AlienProber commented Oct 12, 2020

Looks like I was mistaken. I just clicked in the Scrcpy window after it went black and briefly got the video back before it went black again. Once again I clicked in the Scrcpy window and got the progress bar for the video and the other items for it's player. So it looks like the video is playing in Scrcpy but for some reason it itself is going black. I even had the TVMA message in the upper left corner but no viewable video.

[alienprober@TheMotrhership ~]$ scrcpy
INFO: scrcpy 1.16 <https://github.com/Genymobile/scrcpy>
* daemon not running; starting now at tcp:5037
* daemon started successfully
/usr/share/scrcpy/scrcpy-server: 1 f...d. 48.8 MB/s (33622 bytes in 0.001s)
[server] INFO: Device: motorola moto e5 play (Android 8.0.0)
INFO: Renderer: opengl
INFO: OpenGL version: 4.6.0 NVIDIA 455.28
INFO: Trilinear filtering enabled
INFO: Initial texture: 720x1280
INFO: New texture: 1280x720

@rom1v
Copy link
Collaborator

rom1v commented Oct 12, 2020

Oh so it's just a video with DRM? Does it work in other players, like vlc?

@AlienProber
Copy link
Author

it's a web player. Quibi to be specific.

@AlienProber
Copy link
Author

@rom1v I honestly couldn't tell you if it's DRM or not. If so is that the issue?

Have one additional question and that is how do I make a shortcut for Scrcpy so I don't have to launch Konsole every time. I know from past experience with Scrcpy it's possible. Thanks

@rom1v
Copy link
Collaborator

rom1v commented Oct 13, 2020

@rom1v I honestly couldn't tell you if it's DRM or not. If so is that the issue?

If you just get a black screen on a video, probably.

Have one additional question and that is how do I make a shortcut for Scrcpy so I don't have to launch Konsole every time.

On KDE: https://docs.kde.org/trunk5/en/applications/fundamentals/shortcuts.html

@AlienProber
Copy link
Author

Sorry my bad should of asked where is the executable for Scrcpy so I can create shortcuts, cause launching from Konsole doesn't tell you where it's actually launching the program from. Thanks

@rom1v
Copy link
Collaborator

rom1v commented Oct 13, 2020

which scrcpy

@AlienProber
Copy link
Author

https://github.com/Genymobile/scrcpy scrcpy 1.16-1 in the chaotic aur repository.

@rom1v
Copy link
Collaborator

rom1v commented Oct 13, 2020

@SecretAgentAgentX type which scrcpy in your terminal.

@AlienProber
Copy link
Author

LOL you literally meant which scrpy. Thanks for that.

@rom1v rom1v closed this as completed Oct 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants