본문 바로가기

카테고리 없음

Windows 환경에서 가상 웹캠 만들기

프로그램을 제작 하다 보면 웹캠이 필요 할 경우가 있는데, 가지고 있지 않을때 사용 할 수 있다.

 

dshow 기반의 웹캠을 가상으로 생성 해 주어서 dshow 를 활용해 웹캠 캡처가 필요 한 경우 사용 할 수 있다.

(Windows10 카메라 앱 에서 안나옴 ㅠㅠ)

 

akvirtualcamera 이라는 프로그램을 통해서 가상 환경에 만들 수 있다.

https://github.com/webcamoid/akvirtualcamera

 

GitHub - webcamoid/akvirtualcamera: akvirtualcamera, virtual camera for Mac and Windows

akvirtualcamera, virtual camera for Mac and Windows - GitHub - webcamoid/akvirtualcamera: akvirtualcamera, virtual camera for Mac and Windows

github.com

 

페이지 아랫쪽에 보면 다운로드 할수 있는 링크가 있어서 이미 빌드 되어 있는 것을 다운 로드 할 수 있다.

다운로드 링크 : https://github.com/webcamoid/akvirtualcamera/releases

 

설치

 

윈도우 버전을 다운로드 받아 설치 하면 

서비스 이름 : AkVCamAssistant

표시이름 : Webcamoid virtual camera service
라는 이름의 윈도우 서비스가 자동으로 등록 되고 실행이 된다.

설치 된는 경로는

C:\Program Files\AkVirtualCamera
에 설치 된다.

 

가상 웹캠 생성

요기 참고 했음

https://github-wiki-see.page/m/webcamoid/akvirtualcamera/wiki/Configure-the-cameras

 

Configure the cameras - webcamoid/akvirtualcamera Wiki

Configure the cameras - webcamoid/akvirtualcamera Wiki Please read Build and install page before going further. Quick rundown The first step to create a virtual camera is defining a virtual device: AkVCamManager add-device "Virtual Camera" The command will

github-wiki-see.page

 

AkVCamManager 라는 프로그램을 사용 해서 가상 웹캠을 생성 해 주어야 하는데, 생성은 cmd 창을 띠워서 할 수 있다.

cmd 창 만들때 관리자 권한으로 해 주어야 한다.

 

AkVCamManager프로그램은 설치된 폴더 위치에서 x86, x64 폴더에 있다.

 

AkVCamManager add-device "Virtual Camera"

--> 이 명령을 통해서 "AkVCamVideoDevice0" 라는 가상 장치를 만들 수 있다.

 

AkVCamManager add-device -i vc0 "Virtual Camera"

--> 좀더 편한 이름으로 할려면...이렇게 해서 "vc0"를 만들 수 있다.

 

AkVCamManager add-format AkVCamVideoDevice0 RGB24 1920 1080

AkVCamManager update

이렇게 까지 하면 장치를 만들 수 있는데, 좀더 다양한 옵션으로 만들 수는 있다.

장치는 만들어 졌고, dshow 사용할수 있는 프로그램을 통해서 보면 요롷게 나오고 있다.

 

가상 웹캠에 동영상 나오게 하기

요기 참고 했음
https://github.com/webcamoid/akvirtualcamera/wiki/Usage-and-examples

 

GitHub - webcamoid/akvirtualcamera: akvirtualcamera, virtual camera for Mac and Windows

akvirtualcamera, virtual camera for Mac and Windows - GitHub - webcamoid/akvirtualcamera: akvirtualcamera, virtual camera for Mac and Windows

github.com

 

 

ffmpeg를 통해서 위 장치에 스트리밍을 전달 하는 방식으로 통해서 원하는 동영상을 나오게 할 수 있다.

ffmpeg은 미리 빌드 되어 있는 버전을 사용 하면 사용 할 수 있다.

ffmpeg 의 다운로드 페이지를 통해서 윈도우에 맞게 빌드된 파을을 다운 받을 수 있다.

https://ffmpeg.org/download.html

 

Download FFmpeg

If you find FFmpeg useful, you are welcome to contribute by donating. More downloading options Git Repositories Since FFmpeg is developed with Git, multiple repositories from developers and groups of developers are available. Release Verification All FFmpe

ffmpeg.org

 

이 페이지로 이동 해서 다운로드!!

https://www.gyan.dev/ffmpeg/builds/

 

Builds - CODEX FFMPEG @ gyan.dev

FFmpeg is a widely-used cross-platform multimedia framework which can process almost all common and many uncommon media formats. It has over 1000 internal components to capture, decode, encode, modify, combine, stream media, and it can make use of dozens o

www.gyan.dev

 

단순히 실행 파일만 다운로드 하면 되기 때문에 'ffmpeg-release-essentials.zip'이 파일을 다운로다 받으면 그 안에 ffmpeg.exe 파일이 존재 한다.

ffmpeg -stream_loop -1 -i video.mp4 -pix_fmt rgb24 -f rawvideo - | AkVCamManager stream --fps 30 AkVCamVideoDevice0 RGB24 1920 1080

ffmpeg가 있는 폴더에서 위처럼 하면 video.mp4 파일이 웹캠으로 나오게 된다.