-
Notifications
You must be signed in to change notification settings - Fork 14
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
Aspect ratio #11
Comments
First, you can control the video size by api named setVideoProfile(). Second, you can get the real size of video width and video height by (engine.UpdateTexture (texId, uid, ref texWidth, ref texHeight) At last, you can new Texture2D According to the second step. |
Thank you for the reply Now while scaling the cube in (engine.UpdateTexture (texId, uid, ref texWidth, ref texHeight) it is looking fine but this is not the desire frame size I want to set |
You can control the video frame size by api named setVideoProfile. |
Thank you again I am sorry for my previous comment. It should be well informed. i was trying with setVideoProfile. the problem is that my requirement is to scale the cube width should be similar to the device screen width now when i use setVideoProfile(30, false) means 640 x 360 how can i scale fit on my relative size? frame size is not fixed here. |
agora supports to set your video into fit mode or fill mode. According to your previous msg it seems you are using fill mode that's why it's stretched. If you don't want that, you can choose to set the video display mode to fit, so that is scales to fit your video container while leaving the rest area black. |
@plutoless I'm having a somewhat related issue. In the videoSurface.cs file that comes with the Unity SDK there is this code:
The problem I'm having is that no matter what I change the width and height to in the CreateExternalTexture method, the texture is getting cropped. I don't know what's going on behind the scenes of the GenerateNativeTexture method but I'm assuming something is going on there that is causing this. I've been trying to figure this out for days and no matter what I do the texture always gets cropped on the receiving end. Do you know what might be causing this? Whenever I debug to look at the dimensions of the texture I always get 640x360. Setting the videoProfile does not affect it either. I made some changes to the code to handle the "FIXME! texture size is subject to change" note on the second line. My code is below. I'm applying the texture to a RawImage, hence the change to rend.texture:
|
The dimensions who capture the video frame can not be control randomly, because it depends on the camera. But the video frame who receive the video is controled by the api named setVideoProfile(). |
So the video frame could be cropped in the receiving side if the ratio of capture different from the videoprofile. |
@zhangtao1104 so we would need to modify the video profile using the setVideoProfile on the receiving end? I did try that one time and got the same results unfortunately. I made sure the ratio matched the sending device when I did try it as well. |
@zhangtao1104 I just tried this again and still no luck. I tried setting the video profile on the receiving end to a bunch of different settings and it had no effect on the generated texture at all. |
You need to use the setVideoProfile on the send end. The setVideoProfile control the encode video frame. If you ensure you had use the setVideoProfile on the send end. Then you can use the callback named OnFirstRemoteVideoDecoded , it contains the width and the height of the videoframe . You can confirm if it the same as the setVideoFrofile which set by send end. |
Hi, I have the same problem, the screen that I send from my Unity app appears cropped on the remote end. Using SetVideoProfile, I can change the aspect ratio to 16:9, so that a smaller part of the image got cropped, but it still does not correspond to the whole image I see on my phone screen. I suppose what I need is a function like SetRemoteRenderMode(). However, this function only seems to exist in the Android or C++ SDK, but not in the Unity SDK. The stream on the remote end appears at the same aspect ratio than the one I defined via SetVideoProfile. |
same issue here😭 |
I'm working with the Agora team on this issue now. I have confirmed that the video profile is the issue. Some new phones have an aspect of 19:9 (my galaxy s10 for example) and there is no corresponding video profile for these screen sizes which causes clipping of the image on the receiving end. |
We use This is very breaking issue for us, so use the closest aspect ratio to the one that we need for SetVideoProfile |
I agree, custom resolution is definitely needed here |
Hi, I am having issues with this too, using Agora Unity v3.0.1. I am pushing my frames to web, in the Editor it works fine, but when I build and run the app in the iPad Pro (2732x2048, is it too much?), the image is "cropped" in my webpage. I am using
No luck so far, can someone help me, please? |
Can this be fixed in the advanced demos repo too? Was stuck on this for a while and it is still not clear how to fix this? |
This was apparently the fix but it didn't really fix it - AgoraIO-Extensions/Agora-Unity-Quickstart@666e1cb#diff-84cdda896658855ce7c5ff608c59e77ee409ef990f689aae04c5530132d2e7d8 Does anyone have a fix or update on this? It seems only 16:9 aspect ratios are supported which is not suitable for most mobile phone screen aspect ratios unfortunately. |
my texture size is 640 by 320
but the video stretch, because it does not render on the device screen size,
how can i render camera into fixed size
The text was updated successfully, but these errors were encountered: