How to stream a video from FaceTime HD camera to VLC

Sergey Royz
Dec 19, 2021
  • Get the device index
$ ffmpeg -f avfoundation -list_devices true -i ""# Output
[AVFoundation indev @ 0x7fed0cf04400] AVFoundation video devices:
[AVFoundation indev @ 0x7fed0cf04400] [0] FaceTime HD Camera (Built-in)
[AVFoundation indev @ 0x7fed0cf04400] [1] Capture screen 0
[AVFoundation indev @ 0x7fed0cf04400] AVFoundation audio devices:
[AVFoundation indev @ 0x7fed0cf04400] [0] External Microphone
[AVFoundation indev @ 0x7fed0cf04400] [1] MacBook Pro Microphone
  • Start streaming
ffmpeg \
-f avfoundation \
-pix_fmt yuyv422 \
-video_size 1280x720 \
-framerate 30 \
-i "0:0" -ac 2 \
-vf format=yuyv422 \
-vcodec libx264 -maxrate 2000k \
-bufsize 2000k -acodec aac -ar 44100 -b:a 128k \
-f rtp_mpegts udp://127.0.0.1:9988
  • Open the video stream in VLC
rtp://@127.0.0.1:9988

--

--

Sergey Royz

Co-founder and CTO of a crypto startup. A full-stack software engineer with a passion for creating innovative tech solutions that make a difference.