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

How can I run scrcpy with screen turned off and phone never to go to sleep until I close scrcpy? #1310

Closed
ceyhun242 opened this issue Apr 23, 2020 · 14 comments
Labels

Comments

@ceyhun242
Copy link

ceyhun242 commented Apr 23, 2020

Thanks for this great app. So smooth, simple and effective. I'm using Samsung S7

How can I run scrcpy with screen turned off and phone never to go to sleep until I close scrcpy so that when I record its camera screen (using it as a webcam/camera) the recording would never stop until I stop it. Also is there a time limit to recording screen of the phone's camera view via scrcpy?

Also If I set my phone resolution to by WDHQ instead of FHD, would that increase my camera view quality when I open the camera app to screen record or use it as a webcam? If I enable video enhancer mode would that also enhance my camera view so that when I screen record on my PC the quality would be better?

When I use screen recording apps and record s7 camera, there are yellow circles and AF notification when I move swiftly on the screen and the recording app captures these, how can I not see them in the record or prevent them from popping up?

Is there a way to have scrcpy work in full screen in landscape mode?

Also the flash is opened only when I hit record on the phone app, how can I force the flash to be on even if I dont press recording on the native camera app so that my screen recorder can record me under good light?

Finally how can I use scrcpy as a webcam on windows? Also scrcpy can work via wifi as well? Would the ocnnection be more laggish and screen recording the video camera would have inferior quality over wifi compared to usb?

Also is there a way I can get my computer to run scrcpy as soon as I plug it into my PC?

Also can I set a default app to open when I run scrcpy so that it can right away open camera for OBS to start recording it. Or if I can set my camera to be webcam, there may be no need for this default app feature..

Thank you

@rom1v rom1v added the question label Apr 23, 2020
@rom1v
Copy link
Collaborator

rom1v commented Apr 23, 2020

How can I run scrcpy with screen turned off and phone never to go to sleep until I close scrcpy

#631 #760

As a workaround, you could temporarily change that in your device display settings.

Also is there a time limit to recording screen of the phone's camera view via scrcpy?

No.

Also If I set my phone resolution to by WDHQ instead of FHD, would that increase my camera view quality when I open the camera app to screen record […]?

Probably.

If I enable video enhancer mode would that also enhance my camera view so that when I screen record on my PC the quality would be better?

I don't know.

When I use screen recording apps and record s7 camera, there are yellow circles and AF notification when I move swiftly on the screen and the recording app captures these, how can I not see them in the record […]?

You can't.

or prevent them from popping up?

No idea, check the settings of these specific apps.

Is there a way to have scrcpy work in full screen in landscape mode?

Yes.

scrcpy --fullscreen

And put your device in landscape mode.

If your content is rotated because the camera "lies" to the system about the orientation (for performances/glitchs reasons) (#218), the next release have new options (check the dev branch).

Also the flash is opened only when I hit record on the phone app, how can I force the flash to be on even if I dont press recording on the native camera app so that my screen recorder can record me under good light?

Enable your system flashlight.

Finally how can I use scrcpy as a webcam on windows?

#241

Also is there a way I can get my computer to run scrcpy as soon as I plug it into my PC?

https://github.com/rom1v/autoadb

Also can I set a default app to open when I run scrcpy so that it can right away open camera for OBS to start recording it.

Create a shell/batch script where you start your app before starting scrcpy:
https://stackoverflow.com/questions/4567904/how-to-start-an-application-using-android-adb-tools/4567928#4567928

@rom1v rom1v closed this as completed Apr 23, 2020
@ceyhun242
Copy link
Author

Thank you

I have no coding skills
Where do I put this? to the run command of right click properties? scrcpy --fullscreen

"As a workaround, you could temporarily change that in your device display settings."
What do you mean by this? What can I change? Max is 30 minutes.. Actually now the open camera app forces screen to be always on but now when I close the scrcpy, and reopen it it continues from where I left off, which is nice but it probably keeps the screen all along on draining the battery. Is there such a mechanism that whenever I open scrcpy screen will turn off, and when I close scrcpy, screen will still be off? How can I make these changes happen?

how do I run autoadb? I'd like to either to auto open scrcpy when I plug in USB or open the camera app and screen off so that I can record directly on OBS..

do you think screen recording is draining the battery less than recording video with the phone and also is less heating?

"#241"
I didnt see the solution there, I read somewhere the answer could be obs virtual cam but then I installed it and then I dont know how to connect it to my S7 camera as a webcam?

"Create a shell/batch script where you start your app before starting scrcpy:"
Dont know how to create shell, even if I created dont know how I could run it automatically.

I select only PC speaker and microphone as input and output but OBS still takes input from my studio condenser microphone, do you know why it could be so? Also OBS has wave 44.1 settings also 321 mp3 settings which its confusing why we set both but cant choose one, and by default it records 200kb mp3, but for my podcast, to have headroom for editing I need wave, if I record wave on a separate saw as I record video, do you think it would put too much stress on CPU and makes the video recording laggish? What is your suggestion?

Thank you

@ceyhun242
Copy link
Author

Hello,

I'd really appreciate it if I could receive a response to the points I've shared in my post.

Thank you

@ceyhun242 ceyhun242 changed the title How can I run scrcpy with screen turned off and phone never to go to sleep until I close scrcpy? How can I run scrcpy with screen turned off and phone never to go to sleep until I close scrcpy? Apr 30, 2020
@rom1v
Copy link
Collaborator

rom1v commented Apr 30, 2020

Where do I put this? to the run command of right click properties? scrcpy --fullscreen

Open a terminal (Win+r, cmd.exe and press enter).
Go to the scrcpy directory (cd YOUR_SCRCPY_DIRECTORY), and execute the commands there.

Note that you could also switch fullscreen at any time via Ctrl+f in the scrcpy window.

https://github.com/Genymobile/scrcpy/blob/master/README.md#fullscreen

What do you mean by this? What can I change? Max is 30 minutes..

That was just a workaround suggestion, with limitations…

Another workaround:

adb shell svc power stayon true

https://stackoverflow.com/questions/39629855/how-to-prevent-an-android-device-from-entering-sleep-via-adb-command-shell

I plan to implement a "stay awake" feature in the future (but it requires to implement a cleanup mechanism on the server executed on the device first).

how do I run autoadb?

Please read the README: https://github.com/rom1v/autoadb

You need to build and execute the commands documented.

Sorry, I have to time to make you a tutorial step by step.

do you think screen recording is draining the battery less than recording video with the phone and also is less heating?

It's the same I guess, the main consuming part is probably the video encoding (used in both cases).

"#241"
I didnt see the solution there

Because for now there is none.

Dont know how to create shell, even if I created dont know how I could run it automatically.

Please search "create batch file" in a search engine.

I select only PC speaker and microphone as input and output but OBS still takes input from my studio condenser microphone, do you know why it could be so?

I have no idea.

I record wave on a separate saw as I record video, do you think it would put too much stress on CPU and makes the video recording laggish?

Recording wave takes no CPU.

Video recording from scrcpy takes almost no CPU on the computer. Capturing and encoding by OBS probably consumes a bit, but I can't tell, just test.

Regards

@ceyhun242
Copy link
Author

ceyhun242 commented Apr 30, 2020

Thank you, Romain, for the quick response.

I don't want to take too much of your time or this conversation to last forever so I'll summarize my main goals with scrcpy in a compiled way to make my goals more transparent and hence easier to follow. I appreciate your time spent on this. Thank you.

CRITICAL PRIORITY:

1- I'm using scrcpy to project the camera to a bigger screen, recording the projected view on the screen as a replacement of recording video with the phone to overcome the limit of 4gb file and thus video duration limit. Do you think the quality of the screen recording will be similar to recording with phone video? What are your suggestions that would maximize the quality and still yield smooth non-laggy videos without the time and file size limit using scrcpy and OBS together with my Samsung S7 and Thinkpad X230? I aim for a 20k bit rate rather than the OBS's or Screencastify's 3k video-rate outputs thinking increased bit rate might increase the overall quality, would you agree? (Is OBS the best for my purpose (capturing phone camera app projection on screen or are there better apps that you can recommend that would produce more quality videos with better bitrates?)

What parameters among these would maximize the output video quality?

  • project screen to bigger screen with higher resolution
  • set phone screen resolution to be 4k instead of 1080p
  • set camera shoot settings to 4k instead of 1080p
  • change OBS recording or?/and? streaming encoding and bitrate settings?

2- Is there any way I can use my phone as a webcam on my PC using scrcpy, OBS virtual cam didn't recognize the phone. Do you know how this can be done? Would recording videos using the phone as webcam via scrcpy on OBS would yield higher quality videos over recording the projected camera view on a PC monitor? If yes how can I make this happen?

NORMAL PRIORITY:

3- I'd like to have a shortcut of scrcpy such that as soon as I run scrcpy I'd like the phone to be awake until I close the scrcpy and its screen automatically turned off to save phone battery. How can this be done? (so that no command prompt code will be necessary each time)

4- I'd like to have a shortcut of scrcpy such that as soon as I run it, it will go into full screen and open the last app before I closed scrcpy last time so that I can right away start recording camera screen via OBS as this is my sole purpose of using scrcpy. Opening last app is more crucial than the full screen. How can this be done? (so that no command prompt code will be necessary each time)

5- What are hte most popular uses of scrcpy by its users? It's a very lightweight, smooth program as far as I see and I like that it uses cable so the connection is probably faster than probably laggy wireless ways.. Most apps on phone can be accessed on pc browsers. If for Instagram messaging even there is extension for that on chrome browser. So what are some creative uses people find with scrcpy so that I can be inspired by these..

LOW PRIORITY:

6- When recording the projected view of the camera app of the phone on PC screen, is there any encoding on phone end? I guess the phone does not drain much battery because it doesnt record video but only projects the screen which doesnt involve encoding I guess right?

7- "Video recording from scrcpy takes almost no CPU on the computer."
By video recording, do you mean some people hit record button on their camera using scrcpy so the camera starts recording or projecting phone's screen is regarded as "recording" which you say takes almost no CPU? Because above you said recording projected screen or recording via phone camera both takes encoding but in your last point, you said encoding and capturing only takes place on OBS, these 2 statements are in conflict or is there sth I'm not following? Could you please clarify? Also what do you mean by the term "capturing" differently than recording?

P.S: I'm using open camera thereby removing the buttons and yellow focus circles of S7 native app

These are the other 2 threads I also commented on that are related to this topic and I thought you might want to know or check out:

https://obsproject.com/forum/threads/obs-virtualcam.71741/page-21#post-451347

https://obsproject.com/forum/threads/still-hear-my-microphone-input-even-if-i-removed-it-from-inputs.120167/#post-451460

All the best and peace,

Ceyhun

@ceyhun242
Copy link
Author

Hello Romain

Could you please confirm that you've received a notification to my latest message here because I can't be sure as the topic is closed whether you receive a notification. I wanted to confirm you've received this message so that I won't need to open a new ticket.

Thank you

@rom1v
Copy link
Collaborator

rom1v commented Apr 30, 2020

Yes, I receive notifications on closed issues. I will read the message later.

@ceyhun242
Copy link
Author

ceyhun242 commented Apr 30, 2020 via email

@rom1v
Copy link
Collaborator

rom1v commented May 1, 2020

I'm using scrcpy to project the camera to a bigger screen, recording the projected view on the screen as a replacement of recording video with the phone to overcome the limit of 4gb file and thus video duration limit. Do you think the quality of the screen recording will be similar to recording with phone video?

If the surface has a definition different from your camera, then the result will not be the same.

Technically, it would probably be better to create an Android application which could access the device webcam (since scrcpy cannot do it yet #241).

What are your suggestions that would maximize the quality and still yield smooth non-laggy videos without the time and file size limit using scrcpy and OBS together

If you just want to record (without broadcasting), why do you need OBS? Just use scrcpy --record file.mkv.

What parameters among these would maximize the output video quality?

project screen to bigger screen with higher resolution
set phone screen resolution to be 4k instead of 1080p
set camera shoot settings to 4k instead of 1080p

Increase encoding bitrate (scrcpy -b 20M for example). Use the definition you want as a target.

Is there any way I can use my phone as a webcam on my PC using scrcpy

No. #776

I'd like to have a shortcut of scrcpy such that as soon as I run scrcpy I'd like the phone to be awake until I close the scrcpy and its screen automatically turned off to save phone battery. How can this be done?

Create a .bat file in the scrcpy folder containing:

scrcpy --fullscreen --turn-screen-off

Then double-click on it.

open the last app before I closed scrcpy last time

You need some mechanism to know which app was launched. I don't know.

What are the most popular uses of scrcpy by its users?

I guess testing apps during Android development, typing text, presentations...

When recording the projected view of the camera app of the phone on PC screen, is there any encoding on phone end?

Yes, the device does the whole encoding, it uses a dedicated hardware chip. It could not transmit the whole raw unencoded video, the bitrate would be huge.

By video recording, do you mean some people hit record button on their camera using scrcpy so the camera starts recording or projecting phone's screen is regarded as "recording" which you say takes almost no CPU?

Both, encoding is always done on the Android device. The computer decodes the video to display it (typically with a hardware decoder).

@rom1v
Copy link
Collaborator

rom1v commented May 2, 2020

I plan to implement a "stay awake" feature in the future

The future is now: #631 (comment)

@blitznats
Copy link

No. #776

I'd like to have a shortcut of scrcpy such that as soon as I run scrcpy I'd like the phone to be awake until I close the scrcpy and its screen automatically turned off to save phone battery. How can this be done?

Create a .bat file in the scrcpy folder containing:

scrcpy --fullscreen --turn-screen-off

Then double-click on it.

this was a tremendous help thanks a lot

@lucenajj
Copy link

@blitznats Please, could you show me how the code was inside your txt.bat file?

@blitznats
Copy link

blitznats commented Feb 21, 2022

@blitznats Please, could you show me how the code was inside your txt.bat file?

Hello, sorry for my late feedback i didnt check my emails
just change the ip address , by the way below is for wireless i you do it by cable remove adb connect and timeout
adb connect 192.168.5.107:5555 timeout 2 start scrcpy-noconsole.exe --window-borderless --turn-screen-off

if any help is need let me know

@rom1v
Copy link
Collaborator

rom1v commented Feb 21, 2022

@blitznats FYI, you could use scrcpy --tcpip=192.168.5.107 …

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

No branches or pull requests

4 participants