akvirtualcamera-wiki/Usage-and-examples.md

86 lines
2 KiB
Markdown
Raw Permalink Normal View History

2021-05-27 23:29:25 +00:00
# Listening to events
2021-05-28 00:47:45 +00:00
You can keep reading the global virtual camera events like device add, removal, and default picture changes with:
```
AkVCamManager listen-events
```
To stop listening to events, press Ctrl-C to stop the manager.
2021-05-27 23:29:25 +00:00
# Virtual camera clients
2021-05-28 00:47:45 +00:00
You can list all programs using the virtual camera with:
```
AkVCamManager clients
```
It will return a list of PIDs and the path of the executable using it.
2021-05-27 23:29:25 +00:00
# Examples
2021-05-28 00:47:45 +00:00
## Streaming
The manager can read the raw video frames stream from the standard input as:
```
frame_producer_program | AkVCamManager stream AkVCamVideoDevice0 INPUT_FORMAT WIDTH HEIGHT
```
2021-05-27 23:29:25 +00:00
## Streaming with FFmpeg
2021-05-28 00:47:45 +00:00
You can stream to the virtual camera with:
```
ffmpeg -i video.webm -pix_fmt rgb24 -f rawvideo - | AkVCamManager stream AkVCamVideoDevice0 RGB24 480 360
```
The input format must be one of the supported ones, you can list them with:
```
AkVCamManager supported-formats --input
```
Since the manager will send the frames as fast as FFmpeg decode them, you can regulate the stream passing the **--fps** flag to set the input stream frame rate.
```
ffmpeg -i video.webm -pix_fmt rgb24 -f rawvideo - | AkVCamManager stream --fps 30 AkVCamVideoDevice0 RGB24 480 360
```
2021-05-27 23:29:25 +00:00
## Capturing
2021-05-28 00:47:45 +00:00
Any capture program will work just fine, here is an example with ffplay:
**Mac**
First at all you must list all AVFoundation devices:
```
ffmpeg -f avfoundation -list_devices true -i dummy
```
Then, once you in which DEVICE_INDEX is located your virtual camera, you can ply it with:
```
ffplay -f avfoundation -i DEVICE_INDEX -framerate 30
```
If you have any question, read the [FFmpeg's wiki](https://trac.ffmpeg.org/wiki/Capture/Webcam#AVFoundation).
**Windows**
First at all you must list all DirectShow devices:
```
ffmpeg -f dshow -list_devices true -i dummy
```
Then, play the virtual camera by it's name:
```
ffplay -f dshow -i video="Virtual Camera"
```
If you have any question, read the [FFmpeg's wiki](https://trac.ffmpeg.org/wiki/DirectShow).