[FFmpeg-user] How to capture video and audio from MacBook's camera/microphone?

Kuu Miyazaki miyazaqui at gmail.com
Sat Oct 10 16:15:05 CEST 2015


I'm trying to capture WebM(VP9+Opus) video on my macbook using ffmpeg.
I was able to create a video-only file.
But I have no idea how to create a vide+audio file.
Below are the device list and what I've done so far.
Does anyone have any advice?

Thanks,
-Kuu

$ ffmpeg -f avfoundation -list_devices true -i ""
ffmpeg version 2.8 Copyright (c) 2000-2015 the FFmpeg developers
  built with Apple LLVM version 7.0.0 (clang-700.0.72)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/2.8 --enable-shared
--enable-pthreads --enable-gpl --enable-version3
--enable-hardcoded-tables --enable-avresample --cc=clang
--host-cflags= --host-ldflags= --enable-opencl --enable-libx264
--enable-libmp3lame --enable-libvo-aacenc --enable-libxvid
--enable-libvorbis --enable-libvpx --enable-libfaac --enable-libopus
--enable-nonfree --enable-vda
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
[AVFoundation input device @ 0x7ffa10500280] AVFoundation video devices:
[AVFoundation input device @ 0x7ffa10500280] [0] FaceTime HD Camera
[AVFoundation input device @ 0x7ffa10500280] [1] Capture screen 0
[AVFoundation input device @ 0x7ffa10500280] AVFoundation audio devices:
[AVFoundation input device @ 0x7ffa10500280] [0] Built-in Microphone
: Input/output error


$ ffmpeg -f avfoundation -video_size 320x240 -framerate 30
-pixel_format bgr0 -i "FaceTime HD Camera" video-only.webm

*snip*

Input #0, avfoundation, from 'FaceTime HD Camera':
  Duration: N/A, start: 80476.896533, bitrate: N/A
    Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 320x240,
30 tbr, 1000k tbn, 1000k tbc
[libvpx-vp9 @ 0x7ffb7c80da00] v1.4.0
Output #0, webm, to 'test.webm':
  Metadata:
    encoder         : Lavf56.40.101
    Stream #0:0: Video: vp9 (libvpx-vp9), yuv444p, 320x240, q=-1--1,
200 kb/s, 30 fps, 1k tbn, 30 tbc
    Metadata:
      encoder         : Lavc56.60.100 libvpx-vp9
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> vp9 (libvpx-vp9))
Press [q] to stop, [?] for help
frame=   99 fps= 13 q=0.0 Lsize=     101kB time=00:00:06.46 bitrate=
127.6kbits/s
video:100kB audio:0kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 1.129290%


$ ffmpeg -f avfoundation -video_size 320x240 -framerate 30
-pixel_format bgr0 -i "FaceTime HD Camera" -f avfoundation -i
"Built-in Microphone" video-audio.webm

*snip*

Input #0, avfoundation, from 'FaceTime HD Camera':
  Duration: N/A, start: 81123.160367, bitrate: N/A
    Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 320x240,
30 tbr, 1000k tbn, 1000k tbc
[AVFoundation input device @ 0x7f929863f000] Video device not found
Built-in Microphone: Input/output error


More information about the ffmpeg-user mailing list