2

I have two Macs in my network. On the first one I want to capture the FaceTime camera via ffmpeg and make a RTSP feed available on the network, which I can watch on the second Mac.

2 Answers 2

4

I successfully implemented something close to this (not true RTSP, but instead RTP streaming over UDP) with the following hardware and software:

  • 2012 Macbook Pro, macOS Mojave 10.14.6
  • ffmpeg version 3.4.8
  • ffplay version 4.3.2 (my executable was named ffplay4)

List the audio and video input devices with ffmpeg -f avfoundation -list_devices true -i ""

On the 2012 MBP, the first video device (index 0) is FaceTime HD Camera (Built-in) and the first audio device (index 0) is Built-in Microphone.

The video capture/sending and the video receipt/playback can be done on the same machine, or ffmpeg can send to a remote IP. In this example, it is sending an MPEG transport stream over UDP to the loopback address 127.0.0.1:9988 but that could just as easily be the IP address and port of another Mac:

ffmpeg \
  -f avfoundation \
  -pix_fmt yuyv422 \
  -video_size 320x240 \
  -framerate 15 \
  -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

To receive and play the video:

ffplay4 -i udp://@0.0.0.0:9988

It may take a few seconds to start up and there will be a few errors at first, but the video should begin playing in ffplay4 within a couple seconds.

Bonus: this stream is also viewable with VLC (version 3.0.12). File->Open Network->URL rtp://@127.0.0.1:9988. Again, it will take a few seconds (5-10) to begin displaying the video.

Happy streaming.

3

This is working in M1 Macbook Pro.

ffmpeg \
  -f avfoundation \
  -pix_fmt yuyv422 \
  -video_size 640x480 \
  -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

After running this command you can use VLC media player to stream rtp://127.0.0.1:9988

1
  • Can you add some more details and explain your solution?
    – sfxedit
    Jun 15, 2021 at 12:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .