我正在尝试使用 ffmpeg 录制整个屏幕 (1366x768),但如果我将视频大小设置为超过某个大小,就会出现段错误。从输出中可以看出,我在发布此问题前不到 1 小时就从源代码进行了编译。
1366x744(效果很好)
λ ./ffmpeg -f x11grab -r 25 -s 1366x744 -i :0.0+0,24 -vcodec libx264 -threads 0 screen.mkv
ffmpeg version 2.5.1 Copyright (c) 2000-2014 the FFmpeg developers
built on Dec 18 2014 20:32:54 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-pthreads --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-libxvid --enable-x11grab --enable-libvorbis
libavutil 54. 15.100 / 54. 15.100
libavcodec 56. 13.100 / 56. 13.100
libavformat 56. 15.102 / 56. 15.102
libavdevice 56. 3.100 / 56. 3.100
libavfilter 5. 2.103 / 5. 2.103
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
[x11grab @ 0x1ab6f20] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, x11grab, from ':0.0+0,24':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: rawvideo (BGRA / 0x41524742), bgra, 1366x744, 25 fps, 25 tbr, 1000k tbn, 25 tbc
File 'screen.mkv' already exists. Overwrite ? [y/N] n
Not overwriting - exiting
1366x745(段错误)
λ ./ffmpeg -f x11grab -r 25 -s 1366x745 -i :0.0+0,24 -vcodec libx264 -threads 0 screen.mkv
ffmpeg version 2.5.1 Copyright (c) 2000-2014 the FFmpeg developers
built on Dec 18 2014 20:32:54 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-pthreads --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-libxvid --enable-x11grab --enable-libvorbis
libavutil 54. 15.100 / 54. 15.100
libavcodec 56. 13.100 / 56. 13.100
libavformat 56. 15.102 / 56. 15.102
libavdevice 56. 3.100 / 56. 3.100
libavfilter 5. 2.103 / 5. 2.103
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
[1] 31332 segmentation fault (core dumped) ./ffmpeg -f x11grab -r 25 -s 1366x745 -i :0.0+0,24 -vcodec libx264 -threads 0
这里我遗漏了什么吗?
答案1
您的 y 偏移设置为 24。将此值添加到您的输入视频尺寸将得出一个大于您的屏幕尺寸的值 (745 + 24 = 769)。
分段错误看起来很奇怪,因为我认为它ffmpeg
应该提供一个不直观的错误信息。例如:
X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 142 (MIT-SHM)
Minor opcode of failed request: 4 (X_ShmGetImage)
Serial number of failed request: 11
Current serial number in output stream: 11