Skip to content

Instantly share code, notes, and snippets.

@jbaranski
Last active April 27, 2024 17:31
Show Gist options
  • Save jbaranski/f61c50cc41ed7ef37cf389301d9c3347 to your computer and use it in GitHub Desktop.
Save jbaranski/f61c50cc41ed7ef37cf389301d9c3347 to your computer and use it in GitHub Desktop.
ffmpeg record screen on Mac M1 chip via command line

ffmpeg record screen on Mac M1 chip via command line

  1. Install ffmpeg.

brew install ffmpeg

  1. Figure out which device to use.

ffmpeg -f avfoundation -list_devices true -i ""

Ouput will look like:

ffmpeg version 5.1.2 Copyright (c) 2000-2022 the FFmpeg developers
  built with Apple clang version 14.0.0 (clang-1400.0.29.202)
  configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/5.1.2_3 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-neon
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
[AVFoundation indev @ 0x11f004420] AVFoundation video devices:
[AVFoundation indev @ 0x11f004420] [0] FaceTime HD Camera
[AVFoundation indev @ 0x11f004420] [1] Capture screen 0
[AVFoundation indev @ 0x11f004420] AVFoundation audio devices:
[AVFoundation indev @ 0x11f004420] [0] MacBook Air Microphone
: Input/output error
  1. I want to capture my screen, so I'll use index 1 (IE: [1] Capture Screen 0). Below command will record a video of your screen.

ffmpeg -f avfoundation -i "1:0" output.mkv

  1. Convert the video to a format that can be played by QuickTime player (probably don't need this step if you have a video player capable of playing .mkv but I didn't)

ffmpeg -i output.mkv -c:v prores_ks -profile:v 3 -c:a pcm_s24le output.mov

Notes

  • https://trac.ffmpeg.org/wiki/Capture/Desktop for guidance
  • If you get errors running the above commands, on your system settings, check the following:
    • Privacy and Security | Screen Record - ensure your terminal application is allowed to record screen
    • Privacy and Security | Microphone - ensure your terminal application is allowed to capture mic input (I guess this is optional if you don't care about sound)
@abzrg
Copy link

abzrg commented Jan 23, 2024

Thanks!

I have a problem. It produce some noise especially when I'm talking :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment