如何将虚拟相机发送到Ubuntu中的Genymotion或Android Studio Emulator? [英] How can I send a virtual camera to Genymotion or Android Studio Emulator in Ubuntu?

查看:175
本文介绍了如何将虚拟相机发送到Ubuntu中的Genymotion或Android Studio Emulator?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用v4l2loopback和ffmpeg创建了一个虚拟相机.我用于ffmpeg的命令是:ffmpeg -re -l oop 1 -i vin.png -vf format = yuv420p -f v4l2/dev/video2

I created a virtual camera using v4l2loopback and ffmpeg. The command I use for ffmpeg is: ffmpeg -re -l oop 1 -i vin.png -vf format=yuv420p -f v4l2 /dev/video2

vin.png是我要流式传输到网络摄像头的图像,/dev/video2是我使用v4l2loopback创建的虚拟网络摄像头.虚拟网路摄影机可以运作,例如与 onlinemicetest.com/webcam-test .我在Ubuntu 20.40上将Genymotion模拟器与最新的Android API(我尝试过7.0、8.1和10.0)一起使用.Genymotion检测到虚拟相机,但仅显示虚拟图像: Genymotion的虚假图片错误我也尝试过(并且更愿意使用)android studio模拟器.但是我只能在设备摄像头的配置中选择Webcam0,它指向的是真正的集成摄像头,而不是我的虚拟摄像头.

vin.png is the image I want to stream to the webcam and /dev/video2 is the virtual webcam I created with v4l2loopback. The virtual webcam works and I can see it e.g. with onlinemicetest.com/webcam-test. I'm using the Genymotion emulator with the newest Android API (I tried 7.0, 8.1 and 10.0) on Ubuntu 20.40. Genymotion detects the virtual camera but only displays a dummy image: Wrong dummy Image from Genymotion I also tried (and would prefer to use) the android studio emulator. But I can only select Webcam0 in the configuration of the device camera and that points to the real integrated camera and not to my virtual webcam.

我不需要使用ffmpeg,但是我确实需要使用一个工具,该工具可以让我控制要从命令行流式传输的图像.

I don't need to use ffmpeg, but I do need to use a tool that lets me control which image to stream from the command line.

有没有办法解决这个问题?提前非常感谢!

Is there a way to solve this? Many thanks in advance!

2020年11月17日更新:Genymotion支持人员回答我,他们计划将来支持虚拟相机.他们可能已准备在2021年中添加此功能.

Update 17.11.2020: The Genymotion support answered me, that they plan to support virtual cameras in the future. They might be ready to add this in mid 2021.

推荐答案

使用OBS和Android模拟器的解决方案:

Solution using OBS and Android Emulator:

  1. 遵循本教程: https://blog.jbrains.ca/permalink/using-obs-studio-as-a-virtual-cam-on-linux
  2. 使用以下命令更改您的obs场景: https://gist.github.com/nooitaf/9aabf72d00e16a61ea301c69ff38d804
  3. 检查您正在使用哪个/dev/video:v4l2-ctl --list-devices
  4. 在您的avd中检查哪个摄像头链接到了该视频:./emulator -avd Pixel2 -webcam-list
  5. 使用该摄像头从命令行启动模拟器:./emulator -avd Pixel2 -camera-back webcam2

这篇关于如何将虚拟相机发送到Ubuntu中的Genymotion或Android Studio Emulator?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆