-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
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
Improve orientation support #4441
Conversation
Works fine for me but I get a lot of audio feedback when using this option on my pc speakers: Also does this mean that it's possible to use the phone as a webcam on windows as well? |
You can disable audio capture (
You can display the webcam in a window, then you can probably capture it with OBS and expose it as a webcam on Windows (apparently this is what Mishaal Rahman did for his recent article, but I have never tested). |
A new option However, just setting a display matrix does not work, we must create and apply an AVFilter "transpose". Is someone interested in adding this feature for v4l2? (The FFmpeg sample |
Deprecate the option --rotation and introduce a new option --display-orientation with the 8 possible orientations (0, 90, 180, 270, flip0, flip90, flip180 and flip270). New shortcuts MOD+Shift+(arrow) dynamically change the display (horizontal or vertical) flip. Fixes #1380 <#1380> Fixes #3819 <#3819> PR #4441 <#4441>
For consistency with the new --display-orientation option, express the --lock-video-orientation in degrees clockwise: * --lock-video-orientation=0 -> --lock-video-orientation=0 * --lock-video-orientation=3 -> --lock-video-orientation=90 * --lock-video-orientation=2 -> --lock-video-orientation=180 * --lock-video-orientation=1 -> --lock-video-orientation=270 PR #4441 <#4441>
Introduce new classes and enums to handle Scrcpy version 2.3 options. This update includes new display orientation options and modifies the existing interfaces to accommodate additional settings. See Genymobile/scrcpy#4441
Problems
There are currently two options to rotate the video:
--lock-video-orientation
: it rotates the capture, but does not work for camera capture, and does not work at all for Android 14+ (Android 14 beta lock orientation doesn't work as expected when the device goes into landscape mode. #4011)--rotation
: it only rotates the display, so the rotation is not applied to a file recorded with--record
As a consequence, in particular, it was not possible to record a vertical video from a camera capture.
Changes
New orientation option
Introduce a new option
--orientation
(and separate options--display-orientation
and--record-orientation
if needed) which supports the 8 possible orientations (4 rotations × 2 flips):The rotation is expressed in degrees clockwise so that
--orientation=90
works for vertical video from a camera (it's more natural than--orientation=270
or--orientation=-90
).It is possible to change the display orientation dynamically using shortcuts:
The rotation is applied to a recorded file by writing a display transformation to the MP4 or MKV target file.
Flipping is not supported for recording, so only the 4 first values are allowed when recording.
For MKV files, unfortunately, some players currently do not handle it properly:
MP4 files are correctly handled by these 2 players (and remuxing an MKV file to an MP4 file also fixes the issue).
--rotation
is now deprecated.Locked video orientation adaptation
For consistency,
--lock-video-orientation
has been adapted to express the value as a number of degrees clockwise, and the values 1, 2 and 3 are deprecated:--lock-video-orientation=0
→ unchanged--lock-video-orientation=1
→--lock-video-orientation=270
(now, it's clockwise!)--lock-video-orientation=2
→--lock-video-orientation=180
--lock-video-orientation=3
→--lock-video-orientation=90
(now, it's clockwise!)Result
Now, it is possible to capture and record a rotated video from the camera:
Binary
Please review and test.
Here is a binary for Windows:
SHA-256: 398e51af33be62263c5190e8b69fbfbdcbceae2ca782b0bd431efc5157451825