'Is it possible to create a virtual webcam based on a stream received over the network?
I have an application which requires webcam input for facial expression analysis. I want to host this application on a server where it can process a video stream received from a client (Could be web, mobile, desktop or any other kind of client) and then send back the result as JSON.
The facial expression analysis application does not accept a remote video stream as input, but it works very well with a webcam. My idea is that when a client connects to the server, a virtual webcam should be created based on a video stream provided by the client. A simplified version of the concept is depicted in the diagram below:
Do any programs or libraries exist that are able to do this? Initially, I would like to make a client in JavaScript that uses the getUserMedia() method to capture video from a webcam on one PC and then streams it to another PC which is running the server.
Solution 1:[1]
Try akvirtualcamera of the Webcamoid project (via). From the wiki:
AkVCamManager add-device -i VirtualCamera0 "Virtual Camera"
AkVCamManager add-format VirtualCamera0 RGB24 640 480 30
AkVCamManager update
# Test
ffmpeg -f avfoundation -list_devices true -i ""
# Placeholder until integrated
AkVCamManager set-picture /path/to/place_holder_picture.png
# List clients
AkVCamManager clients
# Stream
ffmpeg -i tcp://127.0.0.1:2000 -pix_fmt rgb24 -f rawvideo - | AkVCamManager stream --fps 30 VirtualCamera0 RGB24 640 480
If the camera isn't working, AkVCamManager hack set-service-up
might help. Here's the help of AkVCamManager for reference:
AkVCamManager [OPTIONS...] COMMAND [COMMAND_OPTIONS...] ...
AkVirtualCamera virtual device manager.
General Options:
-h, --help Show help.
--help-all Show advanced help.
-v, --version Show program version.
-p, --parseable Show parseable output.
-f, --force Force command.
Commands:
devices List devices.
add-device DESCRIPTION Add a new device.
-i, --id DEVICEID Create device as DEVICEID.
remove-device DEVICE Remove a device.
remove-devices Remove all devices.
description DEVICE Show device description.
set-description DEVICE DESCRIPTION Set device description.
supported-formats Show supported formats.
-i, --input Show supported input formats.
-o, --output Show supported output formats.
default-format Default device format.
-i, --input Default input format.
-o, --output Default output format.
formats DEVICE Show device formats.
add-format DEVICE FORMAT WIDTH HEIGHT FPS Add a new device format.
-i, --index INDEX Add format at INDEX.
remove-format DEVICE INDEX Remove device format.
remove-formats DEVICE Remove all device formats.
update Update devices.
load SETTINGS.INI Create devices from a setting file.
stream DEVICE FORMAT WIDTH HEIGHT Read frames from stdin and send them to the device.
-f, --fps FPS Read stream input at a constant frame rate.
listen-events Keep the manager running and listening to global events.
controls DEVICE Show device controls.
get-control DEVICE CONTROL Read device control.
-c, --description Show control description.
-t, --type Show control type.
-m, --min Show minimum value for the control.
-M, --max Show maximum value for the control.
-s, --step Show increment/decrement step for the control.
-d, --default Show default value for the control.
-l, --menu Show options of a memu type control.
set-controls DEVICE CONTROL_1=VALUE CONTROL_2=VALUE... Write device controls values.
picture Placeholder picture to show when no streaming.
set-picture FILE Set placeholder picture.
loglevel Show current debugging level.
set-loglevel LEVEL Set debugging level.
clients Show clients using the camera.
dump Show all information in a parseable XML format.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |