Skip to content

Commit

Permalink
Add webcam support on macOS
Browse files Browse the repository at this point in the history
Closes #29

Change-Id: If09b007e0b9538d3b09266db52060848dd85056c
  • Loading branch information
joeyparrish committed Oct 16, 2019
1 parent 35c5c70 commit e84bf06
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- Added definition of 8k resolution
- #34: Now rejects unsupported features in text inputs
- #30: Fixed cloud upload for VOD
- #29: Added webcam support on macOS


## 0.2.0 (2019-10-14)
Expand Down
3 changes: 2 additions & 1 deletion config_files/input_webcam_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
inputs:
# The type of input.
- input_type: webcam
# Name of the input device.
# Name of the input device. On Linux, this is a device node path. On
# macOS, this is a device name, typically "default".
name: /dev/video0
# The media type.
media_type: video
12 changes: 10 additions & 2 deletions streamer/input_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ class Input(configuration.Base):
With input_type set to 'looped_file', this is a path to a file name to be
looped indefinitely in FFmpeg.
With input_type set to 'webcam', this is a path to the device node for the
webcam. For example, on Linux, this might be /dev/video0.
With input_type set to 'webcam', this is which webcam. On Linux, this is a
path to the device node for the webcam, such as '/dev/video0'. On macOS, this
is a device name, such as 'default'.
With input_type set to 'raw_images', this is a path to a file or pipe
containing a sequence of raw images.
Expand Down Expand Up @@ -314,6 +315,13 @@ def get_input_args(self):
# up on Linux.
'-f', 'video4linux2',
]
elif platform.system() == 'Darwin': # AKA macOS
return [
# Webcams on macOS use FFmpeg's avfoundation input format. With
# this, you also have to specify an input framerate, unfortunately.
'-f', 'avfoundation',
'-framerate', '30',
]
else:
assert False, 'Webcams not supported on this platform!'

Expand Down

0 comments on commit e84bf06

Please sign in to comment.