1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

M3 MacのffmpegでWebカメラとかを指定するには

Posted at

結論

ffmpeg -f avfoundation -list_devices true -i ""で確認できます。1
このような出力になります。

$ ffmpeg -f avfoundation -list_devices true -i ""

# 長いので省略...

[AVFoundation indev @ 0x...] AVFoundation video devices:
[AVFoundation indev @ 0x...] [0] OBS Virtual Camera
[AVFoundation indev @ 0x...] [1] FaceTime HDカメラ
[AVFoundation indev @ 0x...] [2] Capture screen 0
[AVFoundation indev @ 0x...] AVFoundation audio devices:
[AVFoundation indev @ 0x...] [0] Microsoft Teams Audio
[AVFoundation indev @ 0x...] [1] BlackHole 16ch
[AVFoundation indev @ 0x...] [2] MacBook Airのマイク

例えば、FaceTime HDカメラの左の数字、1がこのカメラを選択するための番号です。
次のように使えます。

ffmpeg -f avfoundation -i "1" output.mp4

もっとちゃんとした使い方

デバイスが対応する解像度やフレームレートを確認できます。
ffmpeg -f avfoundation -i "1"とだけ入力し、実行してみてください。筆者の環境では、次のように表示されました。

[avfoundation @ 0x128606940] Supported modes:
[avfoundation @ 0x128606940]   1920x1080@[15.000000 30.000000]fps
[avfoundation @ 0x128606940]   1280x720@[15.000000 30.000000]fps
[avfoundation @ 0x128606940]   1080x1920@[15.000000 30.000000]fps
[avfoundation @ 0x128606940]   1760x1328@[15.000000 30.000000]fps
[avfoundation @ 0x128606940]   640x480@[15.000000 30.000000]fps
[avfoundation @ 0x128606940]   1328x1760@[15.000000 30.000000]fps
[avfoundation @ 0x128606940]   1552x1552@[15.000000 30.000000]fps

本当はffprobeコマンドなどありますが、覚えやすいので筆者はこれで確認しています。より良い方法がありましたらコメントでお知らせください。

さて、この場合は1920x1080で15fpsあるいは30fpsが使用可能ということを表しています。すると、次のコマンドが使えます。

ffmpeg -f avfoundation -framerate 30 -video_size 1920x1080 -i "1" output.mp4 

よさげですね。2

あとがき

ffmpegはまだ使って日が浅いので、Chat GPTに聞きながら使っています。とても便利だということを共有しておきます。

  1. 参考資料:ffmpegでラップトップのWebカメラをリモートで使う

  2. いい感じ、という意味。

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?