我正在尝试在 Debian 10.4 笔记本电脑上录制视频(屏幕截图)。
我使用的命令曾经在 Mint 19.3 上运行良好,在相同的硬件上。我猜 Debian 10.4 上的 ffmpeg 版本较新。
命令是:
ffmpeg -f alsa -ac 2 -i pulse -f x11grab -r 10 -s 1366x768 -i :0.0 -qmin 1 -qmax 1 -vcodec flv -pix_fmt yuv420p -preset ultrafast -crf 0 -threads 0 -y screen-movie.temp.flv
输出是:
ffmpeg version 4.1.6-1~deb10u1 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 8 (Debian 8.3.0-6)
configuration: --prefix=/usr --extra-version='1~deb10u1' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, alsa, from 'pulse':
Duration: N/A, start: 1597616399.164690, bitrate: 1536 kb/s
Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
[x11grab @ 0x55f7452a4380] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #1, x11grab, from ':0.0':
Duration: N/A, start: 1597616399.267230, bitrate: N/A
Stream #1:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 1366x768, 10 fps, 1000k tbr, 1000k tbn, 1000k tbc
Codec AVOption preset (Configuration preset) specified for output file #0 (screen-movie.temp.flv) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
Codec AVOption crf (Select the quality for constant quality mode) specified for output file #0 (screen-movie.temp.flv) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
Stream mapping:
Stream #1:0 -> #0:0 (rawvideo (native) -> flv1 (flv))
Stream #0:0 -> #0:1 (pcm_s16le (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
[swscaler @ 0x55f7452beec0] Warning: data is not aligned! This can lead to a speed loss
[alsa @ 0x55f74527da40] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
Output #0, flv, to 'screen-movie.temp.flv':
Metadata:
encoder : Lavf58.20.100
Stream #0:0: Video: flv1 (flv) ([2][0][0][0] / 0x0002), yuv420p(progressive), 1366x768, q=1-1, 200 kb/s, 10 fps, 1k tbn, 10 tbc
Metadata:
encoder : Lavc58.35.100 flv
Side data:
cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
Stream #0:1: Audio: mp3 (libmp3lame) ([2][0][0][0] / 0x0002), 48000 Hz, stereo, s16p
Metadata:
encoder : Lavc58.35.100 libmp3lame
frame= 69 fps= 10 q=31.0 Lsize= 2867kB time=00:00:06.88 bitrate=3409.7kbits/s speed=1.01x
video:2753kB audio:108kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.205926%
它挂在那里。 ffmpeg 进程的 strace 显示:
[pid 26482] getpid() = 26482
[pid 26482] poll([{fd=3, events=POLLIN|POLLERR|POLLNVAL}], 1, -1) = 1 ([{fd=3, revents=POLLIN}])
[pid 26482] getpid() = 26482
[pid 26482] poll([{fd=3, events=POLLIN|POLLERR|POLLNVAL}], 1, -1) = 1 ([{fd=3, revents=POLLIN}])
[pid 26482] getpid() = 26482
[pid 26482] poll([{fd=3, events=POLLIN|POLLERR|POLLNVAL}], 1, -1) = 1 ([{fd=3, revents=POLLIN}])
[pid 26482] getpid() = 26482
[pid 26482] poll([{fd=3, events=POLLIN|POLLERR|POLLNVAL}], 1, -1) = 1 ([{fd=3, revents=POLLIN}])
[pid 26482] getpid() = 26482
[pid 26482] poll([{fd=3, events=POLLIN|POLLERR|POLLNVAL}], 1, -1) = 1 ([{fd=3, revents=POLLIN}])
[pid 26482] getpid() = 26482
[pid 26482] poll([{fd=3, events=POLLIN|POLLERR|POLLNVAL}], 1, -1) = 1 ([{fd=3, revents=POLLIN}])
[pid 26482] getpid() = 26482
[pid 26482] poll([{fd=3, events=POLLIN|POLLERR|POLLNVAL}], 1, -1) = 1 ([{fd=3, revents=POLLIN}])
[pid 26482] getpid() = 26482
[pid 26482] poll([{fd=3, events=POLLIN|POLLERR|POLLNVAL}], 1, -1) = 1 ([{fd=3, revents=POLLIN}])
[pid 26482] getpid() = 26482
[pid 26482] poll([{fd=3, events=POLLIN|POLLERR|POLLNVAL}], 1, -1) = 1 ([{fd=3, revents=POLLIN}])
[pid 26482] getpid() = 26482
[pid 26482] poll([{fd=3, events=POLLIN|POLLERR|POLLNVAL}], 1, -1) = 1 ([{fd=3, revents=POLLIN}])
[pid 26482] getpid() = 26482
[pid 26482] poll([{fd=3, events=POLLIN|POLLERR|POLLNVAL}], 1, -1) = 1 ([{fd=3, revents=POLLIN}])
[pid 26482] getpid() = 26482
[pid 26482] poll([{fd=3, events=POLLIN|POLLERR|POLLNVAL}], 1, -1) = 1 ([{fd=3, revents=POLLIN}])
[pid 26482] getpid() = 26482
[pid 26482] poll([{fd=3, events=POLLIN|POLLERR|POLLNVAL}], 1, -1) = 1 ([{fd=3, revents=POLLIN}])
[pid 26482] getpid() = 26482
[pid 26482] poll([{fd=3, events=POLLIN|POLLERR|POLLNVAL}], 1, -1) = 1 ([{fd=3, revents=POLLIN}])
[pid 26482] getpid() = 26482
[pid 26482] poll([{fd=3, events=POLLIN|POLLERR|POLLNVAL}], 1, -1) = 1 ([{fd=3, revents=POLLIN}])
[pid 26482] getpid() = 26482
[pid 26482] poll([{fd=3, events=POLLIN|POLLERR|POLLNVAL}], 1, -1) = 1 ([{fd=3, revents=POLLIN}])
[pid 26482] getpid() = 26482
[pid 26482] poll([{fd=3, events=POLLIN|POLLERR|POLLNVAL}], 1, -1) = 1 ([{fd=3, revents=POLLIN}])
[pid 26482] getpid() = 26482
[pid 26482] poll([{fd=3, events=POLLIN|POLLERR|POLLNVAL}], 1, -1) = 1 ([{fd=3, revents=POLLIN}])
[pid 26482] getpid() = 26482
[pid 26482] poll([{fd=3, events=POLLIN|POLLERR|POLLNVAL}], 1, -1) = 1 ([{fd=3, revents=POLLIN}])
[pid 26482] getpid() = 26482
[pid 26482] poll([{fd=3, events=POLLIN|POLLERR|POLLNVAL}], 1, -1) = 1 ([{fd=3, revents=POLLIN}])
[pid 26482] getpid() = 26482
[pid 26482] poll([{fd=3, events=POLLIN|POLLERR|POLLNVAL}], 1, -1^C) = 1 ([{fd=3, revents=POLLIN}])
我在 Debian 上使用的 ffmpeg 版本是: 4.1.6-1~deb10u1 。
我尝试删除 crf 和预设,还尝试添加 -thread_queue_size 为 512。此外,我尝试了 -r 16 和 -r 32。其中一些有助于消除警告,但没有一个消除挂起。
有谁知道如何让这个以前工作的命令再次工作?
谢谢!
答案1
我不确定这部分是否正确:-f alsa -ac 2 -i pulse
那么相反呢-f pulse -ac 2 -i default
?