Last active
February 21, 2017 06:51
-
-
Save clungzta/aa8f061b2ea1fa573899ab65ab0f9565 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from subprocess import call | |
''' | |
Emulates a webcam, subscribing to mjpeg stream published by ROS web_video_server | |
First, run "$ sudo modprobe v4l2loopback" to create the virtual webcam device | |
Use "$ rostopic list" to list all available topics. | |
You can subscribe to any topics of type sensor_msgs/Image. | |
- To find out the type of the topic: use "$ rostopic info [TOPIC_NAME]" | |
''' | |
def emulateWebcamLinux(master_ip, topicName, videoDevice): | |
call(["ffmpeg", "-f", "mjpeg", "-i", "http://" + master_ip + ":8080/stream?topic=" + topicName + "&quality=70&?dummy=param.mjpg", "-vcodec", "rawvideo", "-pix_fmt", "yuv420p", "-threads", "0", "-f", "v4l2", videoDevice]) | |
emulateWebcamLinux("192.168.0.121", "/burt/sony_camera/image_raw/decompressed", "/dev/video1") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment