RootEncoder icon indicating copy to clipboard operation
RootEncoder copied to clipboard

Display RTMP doesn't fit screen

Open linhlq58 opened this issue 4 years ago • 8 comments

I'm working on an app which is live-streaming on Facebook using Display RTMP. But I noticed that the output video don't fit the screen, there are black spaces on 2 sides. I think this issue happens when screen size of device does not match with resolution (720 x1080).

Is there any way to capture only a part of screen and stream to Facebook to avoid this issue?

photo_2021-04-02_18-06-40

linhlq58 avatar Apr 02 '21 11:04 linhlq58

Hello,

Display mode support any resolution. If you select a resolution different of device screen MediaProjectionManager scale it for you.

pedroSG94 avatar Apr 02 '21 19:04 pedroSG94

@pedroSG94 Yes, but the output video will not be at fullscreen. I want a fullscreen video without any black spaces. Are there any options to trim screen before streaming? Or a way to fit screen width and auto scale screen height?

linhlq58 avatar Apr 14 '21 03:04 linhlq58

This is not a bug, I tried record screen with native oneplus app and the result is the same (black spaces). I suspect that mediaprojection api is doing it (I mean it is already full screen). We can apply a filter to crop it. Knowning it the question is:

  • How to crop that spaces if I don't know the size? Do you have any sugestion?

I will check it another time to comfirm all

pedroSG94 avatar Apr 15 '21 14:04 pedroSG94

Okay 👯 Please let me know when you have a solution. I really need your help.

linhlq58 avatar Apr 17 '21 08:04 linhlq58

Ok, I found a way to fit screen but this produce image distortion to adapt it (it is normal you can't fit without distortion using different resolutions). Go to this line and set width / height to screen device resolution: https://github.com/pedroSG94/rtmp-rtsp-stream-client-java/blob/master/rtplibrary/src/main/java/com/pedro/rtplibrary/base/DisplayBase.java#L392 Also in this line: https://github.com/pedroSG94/rtmp-rtsp-stream-client-java/blob/master/encoder/src/main/java/com/pedro/encoder/input/gl/render/CameraRender.java#L68

pedroSG94 avatar Apr 17 '21 16:04 pedroSG94

@pedroSG94 Thank you for your solution. I tried and it worked. But it's a bad UX in a livestream app if images are distorted. Is there anyway to fit screen without distortion by cutting the top edge or bottom edge of the screen while streaming?

linhlq58 avatar Apr 29 '21 09:04 linhlq58

Yes, that is possible but, for now, I will mark it as feature because it will take time to develop properly.

pedroSG94 avatar Apr 29 '21 17:04 pedroSG94

Hi @linhlq58, do you have any solution for this?

hoangcongtuan avatar Sep 09 '21 11:09 hoangcongtuan