Open maehata-fairy opened 1 year ago
Hi there,
I have the feeling that there was on issue with the orientation, but it is a really painfull subject 🧠 Could you check that tapping on StreamPack Preview properly set the focus on the same place as the preview (with your patch). Do you have in mind an easy way to test this?
Best regards, Thibault
As the preview and the stream are 2 different things, there might be 2 issues. To display the preview on your device, what view do you use?
Hello.
The combination of device orientation and camera mount angle is a headache.
The patch I created focuses only on the stream. The preview is not fixed and needs additional work. (sry...) I will try more when I have time.
A simple test... This is also difficult. Probably, you hard to get a reproducible device. I think it would be better to do it on an android emulator, but i have to examine emulator's configuration.
Sorry I haven't had much time to do this....
I tried to build a simple environment. It may be possible to build it with an "android emulator" and "external usb camera".
Some devices for auto (vehicles) like alps YT9213AJ support external usb camera and it returns 0 camera sensor orientation https://github.com/android/camera-samples/issues/361
The report says "YT9213AJ supports external usb camera and it returns 0 camera sensor orientation > ".
So,
emulator.exe -avd PixelC -camera-back webcam1
.
This may work.However, I do not have an external usb camera at hand, so I installed the virtual camera driver and confirmed that the emulator even uses the camera. Unfortunately, the virtual camera driver recognized sensor orientation = 90, so it may not work.
Thank you.
Hi, Sorry I missed you last messages.
The combination of device orientation and camera mount angle is a headache.
Agreed! It is not clear at all.
I will try to test with an android emulator and an external USB camera. Thanks for the information.
In the meantime, I reworked the management of the orientation. It is not going to fix your issue but it might be easier to debug.
Everything is in https://github.com/ThibaultBee/StreamPack/blob/5ae4592ecfe2e6f5ebcc1d49296bf5f1a068cbf0/core/src/main/java/io/github/thibaultbee/streampack/internal/sources/camera/CameraSource.kt#L130C14-L130C14
I guess your issue has a link with the default buffer size. But it is still unclear how to set setDefaultBufferSize
.
I will try to test with an android emulator and an external USB camera. Thanks for the information.
Just did the test with my webcam and sensor orientation is also 90 degrees... Looking for a way to test or for a clear explanation of https://developer.android.com/training/camera2/camera-preview
Hi Thank you for taking this issue.
Just did the test with my webcam and sensor orientation is also 90 degrees...
I apologize that it did not behave as expected. I will conduct further investigation on my end as well.
From a technical point, I believe it is possible to build an emulator image with Angle other than 90 from AOSP. However, I consider that as a last resort..
Version
2.5.2 (or commit: 3a9af52fd6f34c2dac308ece85a2a38c6d64760e)
Environment that reproduces the issue
Pixel4 - AOSP 10 (Rooted, Custom OS) Root is required because the
MountAngle
incamera_config.xml
, which is the ReadOnly configuration file of the OS, needs to be rewritten. This can be reproduced by changing the angle to 0 or 180.Use case description
Thanks for this project, it has been very helpful as I was trying to implement SRT. Thank you very much.
After using the demo and libraries of this project, I found that It seems that devices with camera angles where the MountAngle is 0 or 180 are not oriented correctly.
MountAngle
incamera_config.xml
is the value ofSENSOR_ORIENTATION
inCameraCharacteristics
. e.g. https://github.com/LineageOS/android_device_bq_sdm660-common/blob/lineage-16.0/configs/camera/camera_config.xmlFor example, if you request
Size(1280, 720)
, then A camera withMountAngle=90
will preview and deliver a 1280 x 720 image with the correct proportions. However, with a camera withMountAngle=0
, the captured video with 1280 horizontal and 720 vertical will be distorted, as if it were scaled down or enlarged to 1280 vertical and 720 horizontal.The following is a capture of the distorted image. (Android preview screen and the image distributed by SRT)
After applying my patch (please check alternative solutions.)
Proposed solution
No response
Alternative solutions
I have created a patch to work with the less common MountAngle devices. Here is the Dirty code. Sry.