gpt4 book ai didi

macos - 如何使用ffmpeg在macos上录制音视频?

转载 作者:行者123 更新时间:2023-12-04 23:11:35 29 4
gpt4 key购买 nike

$ ffmpeg -f avfoundation -list_devices true -i ""
...
[AVFoundation indev @ 0x7fa8c24312c0] AVFoundation video devices:
[AVFoundation indev @ 0x7fa8c24312c0] [0] FaceTime HD Camera
[AVFoundation indev @ 0x7fa8c24312c0] [1] Capture screen 0
[AVFoundation indev @ 0x7fa8c24312c0] AVFoundation audio devices:
[AVFoundation indev @ 0x7fa8c24312c0] [0] MacBook Pro Microphone
这些是我的音频和视频设备。
我正在尝试从屏幕的麦克风和视频捕获中录制音频。
但是,当我尝试运行命令时,出现此错误:
$ ffmpeg -f avfoundation -i "1:0"  \             
~/Videos/screencast.mp4
ffmpeg version 4.3.2 Copyright (c) 2000-2021 the FFmpeg developers
built with Apple clang version 12.0.0 (clang-1200.0.32.29)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.3.2 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --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-librtmp --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
[AVFoundation indev @ 0x7fced1c315c0] Configuration of video device failed, falling back to default.
[avfoundation @ 0x7fced2009000] Selected pixel format (yuv420p) is not supported by the input device.
[avfoundation @ 0x7fced2009000] Supported pixel formats:
[avfoundation @ 0x7fced2009000] uyvy422
[avfoundation @ 0x7fced2009000] yuyv422
[avfoundation @ 0x7fced2009000] nv12
[avfoundation @ 0x7fced2009000] 0rgb
[avfoundation @ 0x7fced2009000] bgr0
[avfoundation @ 0x7fced2009000] Overriding selected pixel format to use uyvy422 instead.
另外我想在右下角捕捉相机。这就是我在 Linux 上的做法,但基础知识甚至不适用于 MacOS。
screencap() {
file=`date +%Y-%m-%d-%H.%M.%S`
ffmpeg -f alsa -i pulse -f x11grab -thread_queue_size 64 -i :0.0 \
-video_size 384x216 -i /dev/video0 \
-filter_complex 'overlay=main_w-overlay_w:main_h-overlay_h' \
-r 60 -preset ultrafast ~/Videos/screencast-${file}.mp4
}

最佳答案

在使用 FFMPEG 录制我的 MacOs 屏幕后,我总是在 FFMPEG 挂起之前收到相同的错误:

Configuration of video device failed, falling back to default.


最后,我找到了适合我的解决方案。
问题是由 引起的权限不足Screen Recording环境。
添加后 (或任何其他终端应用程序)到允许的应用程序,以下 FFMPEG 命令按预期工作:
ffmpeg -f avfoundation -i "2:0" output.mkv
不要忘记编辑屏幕/音频索引
enter image description here

关于macos - 如何使用ffmpeg在macos上录制音视频?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66644217/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com