Advertisement
chadjoan

Using Droidcam on Linux with V4L2

Jan 15th, 2024 (edited)
1,371
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.95 KB | Software | 0 0
  1. # Possibly optional steps that improve resolution.
  2. # These must be done as `root`.
  3. # Source: https://www.dev47apps.com/droidcam/linux/
  4. rmmod v4l2loopback-dc
  5. insmod /lib/modules/`uname -r`/video/v4l2loopback-dc.ko width=1920 height=1080
  6.  
  7. # Open DroidCam(X) on Android device. Start it up. Get IP address and port.
  8. # In this example, the IP address is 192.168.1.39 and the port is 4747.
  9.  
  10. # Put this in one shell to create a /dev/videoN node that other programs can connect to.
  11. # (I did this as `root`, but I'm not sure if `root` is needed.)
  12. droidcam-cli -a -v 192.168.1.39 4747
  13. #```
  14. #Client v2.0.0
  15. #Video: /dev/video0
  16. #Audio: hw:3,1,0
  17. #```
  18.  
  19. # Alternatively, if the device has ADB debugging over USB enabled
  20. # in its developer options, then droidcam-cli can connect this way
  21. # over a USB3.0 wire:
  22. droidcam-cli -a -v adb 4747
  23.  
  24. # This connection seems to have MUCH better bandwidth/framerate!
  25. #
  26. # If connecting from a new computer, the phone might get a prompt
  27. # asking whether the computer should be trusted. This prompt must
  28. # be answered affirmatively before the above `adb` mode will work.
  29. # After answering the prompt, it may also be necessary to restart
  30. # the DroidCam(X) app on the phone/device, and possibly also
  31. # necessary to restart `droidcam-cli` with the same command above.
  32. # If all is good, it will give the same output as the IP version.
  33.  
  34. # It should now be possible to use the "webcam" from other programs, and from web apps like Discord.
  35. # (This should be done as the user in the desktop environment, NOT as root.)
  36. # To test functionality manual, `mpv` can be used like so:
  37. mpv av://v4l2:/dev/video0 --profile=low-latency --untimed
  38. #```
  39. # (+) Video --vid=1 (rawvideo 1920x1080 30.000fps)
  40. #VO: [gpu] 1920x1080 yuv420p
  41. #V: 02:08:20 / 02:08:20 (100%)
  42. #```
  43. # NOTE that the `/dev/video0` in this command must match the "Video:" field from droidcam-cli.
  44. # It just happened to be `/dev/video0` in this example, but it could be any `/dev/videoN` node.
  45.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement