AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / unix / 问题 / 675436
Accepted
LostXOR
LostXOR
Asked: 2021-10-31 09:15:51 +0800 CST2021-10-31 09:15:51 +0800 CST 2021-10-31 09:15:51 +0800 CST

添加音频输入时,ffmpeg 录制速度变慢

  • 772

我正在尝试使用 ffmpeg 录制我的屏幕、麦克风和游戏音频。此命令仅记录我的屏幕。

ffmpeg \
-video_size 2560x1440 \
-framerate 60 \
-f x11grab -i :0 \
-map 0 \
-c:a copy \
-c:v libx264rgb \
-crf 0 \
-preset ultrafast \
video.mkv

它以稳定的 60 fps 记录,ffmpeg 给出输出

[x11grab @ 0x55717ef22dc0] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, x11grab, from ':0':
  Duration: N/A, start: 1635606965.195981, bitrate: N/A
    Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 2560x1440, 60 fps, 1000k tbr, 1000k tbn, 1000k tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264rgb))
Press [q] to stop, [?] for help
[libx264rgb @ 0x55717ef30a40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264rgb @ 0x55717ef30a40] profile High 4:4:4 Predictive, level 5.1, 4:4:4 8-bit
[libx264rgb @ 0x55717ef30a40] 264 - core 155 r2917 0a84d98 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=0 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=0 chroma_qp_offset=0 threads=18 lookahead_threads=3 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=cqp mbtree=0 qp=0
Output #0, matroska, to 'video.mkv':
  Metadata:
    encoder         : Lavf58.29.100
    Stream #0:0: Video: h264 (libx264rgb) (H264 / 0x34363248), bgr0, 2560x1440, q=-1--1, 60 fps, 1k tbn, 60 tbc
    Metadata:
      encoder         : Lavc58.54.100 libx264rgb
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame=  174 fps= 60 q=-1.0 Lsize=    3866kB time=00:00:02.91 bitrate=10854.0kbits/s dup=0 drop=1 speed=1.01x    

如果我尝试通过向命令添加输入来录制音频:

ffmpeg \
-video_size 2560x1440 \
-framerate 60 \
-f x11grab -i :0 \
-f pulse -i "alsa_output.usb-DeSheng_Electronics_Inc._XIBERIA-00.iec958-stereo.>
-f pulse -i "alsa_input.usb-DeSheng_Electronics_Inc._XIBERIA-00.mono-fallback" \
-map 0 -map 1 -map 2 \
-c:a copy \
-c:v libx264rgb \
-crf 0 \
-preset ultrafast \
video.mkv

ffmpeg 给出输出

[x11grab @ 0x55bf9b4e80c0] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, x11grab, from ':0':
  Duration: N/A, start: 1635606747.731781, bitrate: N/A
    Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 2560x1440, 60 fps, 1000k tbr, 1000k tbn, 1000k tbc
Guessed Channel Layout for Input Stream #1.0 : stereo
Input #1, pulse, from 'alsa_output.usb-DeSheng_Electronics_Inc._XIBERIA-00.iec958-stereo.monitor':
  Duration: N/A, start: 1635606747.770507, bitrate: 1536 kb/s
    Stream #1:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Guessed Channel Layout for Input Stream #2.0 : stereo
Input #2, pulse, from 'alsa_input.usb-DeSheng_Electronics_Inc._XIBERIA-00.mono-fallback':
  Duration: N/A, start: 1635606747.811649, bitrate: 1536 kb/s
    Stream #2:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264rgb))
  Stream #1:0 -> #0:1 (copy)
  Stream #2:0 -> #0:2 (copy)
Press [q] to stop, [?] for help
[libx264rgb @ 0x55bf9b519d80] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264rgb @ 0x55bf9b519d80] profile High 4:4:4 Predictive, level 5.1, 4:4:4 8-bit
[libx264rgb @ 0x55bf9b519d80] 264 - core 155 r2917 0a84d98 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=0 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=0 chroma_qp_offset=0 threads=18 lookahead_threads=3 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=cqp mbtree=0 qp=0
Output #0, matroska, to 'video.mkv':
  Metadata:
    encoder         : Lavf58.29.100
    Stream #0:0: Video: h264 (libx264rgb) (H264 / 0x34363248), bgr0, 2560x1440, q=-1--1, 60 fps, 1k tbn, 60 tbc
    Metadata:
      encoder         : Lavc58.54.100 libx264rgb
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16, 1536 kb/s
    Stream #0:2: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16, 1536 kb/s
[pulse @ 0x55bf9b4f4000] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
[matroska @ 0x55bf9b518280] Non-monotonous DTS in output stream 0:1; previous: 364, current: 358; changing to 364. This may result in incorrect timestamps in the output file.
frame=   21 fps=0.0 q=0.0 size=       1kB time=00:00:01.01 bitrate=   7.7kbits/sframe=   21 fps= 21 q=0.0 size=       1kB time=00:00:01.01 bitrate=   7.7kbits/s
[matroska @ 0x55bf9b518280] Non-monotonous DTS in output stream 0:1; previous: 843, current: 838; changing to 843. This may result in incorrect timestamps in the output file.
[x11grab @ 0x55bf9b4e80c0] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)

并以 20 fps 的速度记录,同时每隔几秒打印一次“非单调 DTS”和“线程消息队列阻塞”消息。我假设音频以某种方式减慢了视频录制速度,我该如何解决?

ffmpeg video-encoding
  • 1 1 个回答
  • 172 Views

1 个回答

  • Voted
  1. Best Answer
    LostXOR
    2021-11-04T10:18:50+08:002021-11-04T10:18:50+08:00

    对于将来遇到此问题的任何人,我通过在录制期间打开 pavucontrol 来修复它。

    • 0

相关问题

  • 使用 ffmpeg 从 FLAC 到 ALAC 的无损音频转换

  • 来自 PNG 帧的 H.264/MPEG-4:如何以及如何调整压缩

  • ffmpeg 命令在脚本内静默失败,但在直接运行时有效

  • 将 MKV 内的音频转换为 AC3 或 DTS,保留 6.1 声道

  • ffmpeg:普通文件名的“找不到协议”

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    模块 i915 可能缺少固件 /lib/firmware/i915/*

    • 3 个回答
  • Marko Smith

    无法获取 jessie backports 存储库

    • 4 个回答
  • Marko Smith

    如何将 GPG 私钥和公钥导出到文件

    • 4 个回答
  • Marko Smith

    我们如何运行存储在变量中的命令?

    • 5 个回答
  • Marko Smith

    如何配置 systemd-resolved 和 systemd-networkd 以使用本地 DNS 服务器来解析本地域和远程 DNS 服务器来解析远程域?

    • 3 个回答
  • Marko Smith

    dist-upgrade 后 Kali Linux 中的 apt-get update 错误 [重复]

    • 2 个回答
  • Marko Smith

    如何从 systemctl 服务日志中查看最新的 x 行

    • 5 个回答
  • Marko Smith

    Nano - 跳转到文件末尾

    • 8 个回答
  • Marko Smith

    grub 错误:你需要先加载内核

    • 4 个回答
  • Marko Smith

    如何下载软件包而不是使用 apt-get 命令安装它?

    • 7 个回答
  • Martin Hope
    user12345 无法获取 jessie backports 存储库 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl 为什么大多数 systemd 示例都包含 WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky 如何将 GPG 私钥和公钥导出到文件 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll systemctl 状态显示:“状态:降级” 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim 我们如何运行存储在变量中的命令? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S 为什么 /dev/null 是一个文件?为什么它的功能不作为一个简单的程序来实现? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 如何从 systemctl 服务日志中查看最新的 x 行 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - 跳转到文件末尾 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla 为什么真假这么大? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis 在一个巨大的(70GB)、一行、文本文件中替换字符串 2017-12-30 06:58:33 +0800 CST

热门标签

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve