ffmpegをmacで使った時のメモ書き (Linuxのほうが使いやすい気がする)
インストール
- brewにて
- $brew install ffmpeg
使い方
- 使用可能なvideo resource一覧の表示
- e.g. Macのフロントカメラは "[0] FaceTime HD Camera"
- [メモ] Macの場合はavfoundationが必要らしい. Ubuntuでは不要だったなぁ
➜ ✗ ffmpeg -f avfoundation -list_devices true -i ""
ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers
built with Apple LLVM version 10.0.0 (clang-1000.11.45.5)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.1 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gpl --enable-libmp3lame --enable-libopus --enable-libsnappy --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-opencl --enable-videotoolbox
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
[AVFoundation input device @ 0x7ffa3f402b40] AVFoundation video devices:
[AVFoundation input device @ 0x7ffa3f402b40] [0] FaceTime HD Camera
[AVFoundation input device @ 0x7ffa3f402b40] [1] Capture screen 0
[AVFoundation input device @ 0x7ffa3f402b40] [2] Capture screen 1
[AVFoundation input device @ 0x7ffa3f402b40] AVFoundation audio devices:
[AVFoundation input device @ 0x7ffa3f402b40] [0] Built-in Microphone
- Camera viewの表示
- $ffplay -f avfoundation -framerate 30 -i "0"
- [注意] framerateが必要
参考
- ffmpeg (API)を用いてWebカメラからキャプチャ