Skip to content

Instantly share code, notes, and snippets.

@hungtcs
Last active December 22, 2023 06:26
Show Gist options
  • Save hungtcs/4920734a0d274eee34b1ad5892563699 to your computer and use it in GitHub Desktop.
Save hungtcs/4920734a0d274eee34b1ad5892563699 to your computer and use it in GitHub Desktop.
ffmpeg 录制屏幕
# Linux:录制当前显示器
# - show_region: 显示录制区域
# - framerate: 录制的帧率
# - video_size: 录制区域的大小
# - $DISPLAY+0,0: `$DISPLAY`:环境变量,当前显示器
# `+0,0` 录制区域偏移量
# x11grab: http://underpop.online.fr/f/ffmpeg/help/x11grab.htm.gz
ffmpeg -f x11grab -show_region 1 -framerate 8 -video_size 1024x768 -i $DISPLAY+0,0 -y output.mp4
# MacOS 录制屏幕
# 列出可用设备
ffmpeg -f avfoundation -list_devices true -i ""
# 录制指定设备
ffmpeg -f avfoundation -i "<screen device index>:<audio device index>" output.mkv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment