如何强制相机横向发送视频?
我想知道是否可以强制相机以横向模式(宽度>高度)发送视频
假设我们有一个适用于 Android 的小应用程序,它使用 SIP 发送从相机捕获的图像。发生的情况是,视频的大小取决于您的手机方式。如果您的手机处于垂直状态,则相机会捕获纵向尺寸的视频,如果您水平放置手机,则相机会捕获横向尺寸的视频。我猜这是因为 Camera.Preferences,它使表面的大小基于相机的实际尺寸。
我想要的是让手机处于纵向模式,但我想以横向格式显示视频,当然,当您的屏幕处于纵向模式时,它会调整大小以适合屏幕。有什么办法可以做到这一点吗?
我想到了一些可能性,也许可以强制相机以横向模式进行录制,即使手机处于纵向模式。我不知道这是否可能。
我想制作一个桥梁来调整视频大小并像横向视频一样显示它。这个选项应该比较复杂。
我不确定您必须编写多少代码,只是如果有人有参考链接或一些以我正在寻找的方式调整视频大小的代码,或者我必须用来执行此操作的类。我确实一直在寻找信息,但没有找到任何对我有帮助的信息。非常感谢任何帮助。
I would like to know if it's possible to force the camera to send video in landscape mode (width > height)
Let's say that we have a little app for android which send the image captured from the camera using SIP. What is happening is that the size of the video depends on how you have your mobile. If you have your mobile vertially the camera captures a portrait_size video, and if you have your mobile horizontally the camera caputres a landscape_size video. I guess this is because of the Camera.Preferences, it makes the size of the surface based on the camera real sizes.
What I want is to have the mobile in portrait mode, but I want to show the video in landscape format, of course it will be resized to fit in the screen as your screen is on portrait mode. Is there any way to do that?
I think of some possibilities and maybe to force the camera to record in landscape mode, even if the phone is in portrait mode. I don't know if this is possible.
I think of making a bridge which resizes the video and show it like a landscape video it was. This option should be more complicated.
I don't know for sure a lof of code that you have to make, just if anyone has a reference link or some code that resizes video in the way I am looking for, or the Classes that I have to use to do it. I really have been looking for information and didn't really find anything that helps me. Any help is really appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须首先以横向模式捕获视频,以使生活更轻松。
我注意到,如果您通过 MediaStore 意图启动视频录制,则有一种简单的方法可以做到这一点。
EXTRA_SCREEN_ORIENTATION 文档对此进行了详细说明。
如果您使用相机 API 手动执行此操作,那么将会有一个等效的。
You would have to capture the video in landscape in the first instance to make life easier.
I noticed that there is a simple way to do this if you are initiating your video recording via a MediaStore intent.
This is detailed in the EXTRA_SCREEN_ORIENTATION documention.
If you are doing this manually using the Camera API then there will be an equivalent.