Skip to content

This repository using DirectShow with ffmpeg in order to enumarate video and audio devices and selecting specific device ID's that you can use on OpenCV, video processing and live streaming.

License

Notifications You must be signed in to change notification settings

egemengulpinar/capture-device-list

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

capture-device-list

Build status 3.5

Simplest way to connect DirectShow Windows API with FFmpeg and list all capture devices with alternative names. The user can save the results to a file or print either “video”, “audio”, or both “audio, video” devices.

Screenshots

ss2

Setting Options

Parameter Values Description Type
device_type 'audio' , 'video', 'audio_video' Device Type str
alt_name True , False Show alternative name bool
result_ True , False Return result bool
list_all True , False Show all devices bool
save True , False Save result to text bool

Setting Arguments

Description Values
Only audio devices '-audio', '-a'
Only video devices '-video', '-v'
Only audio and video devices '-audio_video', '-av'
Show alternative names '-alternative', '-alt'
Show all devices '-list_all', '-l'
Save to text '-save', '-s'

Build

To build this project, follow these commands

  git clone https://github.com/egemengulpinar/capture-device-list.git
  cd capture-device-list
  python setup.py sdist bdist_wheel

Usage with Arguments

First clone the repo and go to directory. After, based on arguments table, follow the syntax below.

  python capture_devices.py -list_all -save
  # or
  python capture_devices.py -audio -alternative -save
  

Usage with pip

First install the packages using with pip

  pip install capture-devices

After, you can import package similarly:

from capture_devices import devices

For using this library, follow these structure:

result = devices.run_with_param(device_type='audio', alt_name=True,result_= True)
print(result)

# or 

devices.run_with_param(alt_name=True,list_all=True)

Capturing Video Device with FFmpeg Example

cmd = [f'{FFMPEG_PATH}', '-loglevel', 'quiet',
        '-f', 'dshow',
        '-thread_queue_size', f'{thread_queue_size}',
        '-rtbufsize', '2147480000',
        '-i', 'video={NAME OF ANY CAPTURE DEVICE}', #alternative names allowed too.
        '-preset' ,'ultrafast', 
        '-f', 'rawvideo',
        '-threads' , '1',
        '-pix_fmt','bgr24',
        '-']

License

MIT

About

This repository using DirectShow with ffmpeg in order to enumarate video and audio devices and selecting specific device ID's that you can use on OpenCV, video processing and live streaming.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages