Skip to content

Instantly share code, notes, and snippets.

@mikeboers
Created October 15, 2018 17:13
Show Gist options
  • Save mikeboers/22bb3980ba6c1f53839562c342c46953 to your computer and use it in GitHub Desktop.
Save mikeboers/22bb3980ba6c1f53839562c342c46953 to your computer and use it in GitHub Desktop.
PyAV using avfoundation
$ ffprobe -f avfoundation -list_devices true ''
<snip>
[AVFoundation input device @ 0x7f809940d4c0] AVFoundation video devices:
[AVFoundation input device @ 0x7f809940d4c0] [0] FaceTime HD Camera
[AVFoundation input device @ 0x7f809940d4c0] [1] Capture screen 0
[AVFoundation input device @ 0x7f809940d4c0] AVFoundation audio devices:
[AVFoundation input device @ 0x7f809940d4c0] [0] Built-in Microphone
: Input/output error
$ ffprobe -f avfoundation 0:0
ffprobe version 4.0.2 Copyright (c) 2007-2018 the FFmpeg developers
<snip>
[avfoundation @ 0x7f96cc802a00] Selected framerate (29.970030) is not supported by the device
[avfoundation @ 0x7f96cc802a00] Supported modes:
[avfoundation @ 0x7f96cc802a00] 1280x720@[1.000000 30.000000]fps
Last message repeated 2 times
[avfoundation @ 0x7f96cc802a00] 640x480@[1.000000 30.000000]fps
Last message repeated 2 times
[avfoundation @ 0x7f96cc802a00] 320x240@[1.000000 30.000000]fps
Last message repeated 2 times
0:0: Input/output error
$ ffplay -f avfoundation -framerate 30 0:0
>>> fh = av.open('0:0', format='avfoundation', options=dict(framerate='30'))
>>> print(fh.dumps_format())
Input #0, avfoundation, from '':
Duration: N/A, start: 395117.273467, bitrate: N/A
Stream #0:0: Video: rawvideo (UYVY / 0x59565955), uyvy422, 320x240, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
Stream #0:1: Audio: pcm_f32le, 48000 Hz, stereo, flt, 3072 kb/s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment