echo "Installing Window Manager & VNC..."
apt-get install -qq -y xvfb >> install.log
apt-get install -qq -y x11vnc >> install.log
apt-get install -qq -y fluxbox >> install.log
chmod +x x11vnc && mv x11vnc /usr/bin/
# Install avconv + libx264 codec to convert flv to mp4 that is playable on web browsers echo "Installing VNC Screen Recording Utilities"
easy_install vnc2flv 2>&1 >> install.log
apt-get install -qq -y c >> install.log
apt-get install -qq -y libavcodec-extra-53 >> install.log
[[ $? -ne 0 ]] && apt-get install -qq -y libavcodec-extra-54 >> install.log # ubuntu 14
NUM_EXECUTORS="1"
SCREEN_RES="1440x1080x16"
xvfb_vncstart() {
# dropping the vnc password into a text file for the vnc recording tool
local PASSWORD_FILE=/tmp/vnc-password.txt
if [ -f $PASSWORD_FILE ]; then
rm $PASSWORD_FILE
fi
echo "$VNC_PASSWORD" > $PASSWORD_FILE
export VNC_PASSWORD
echo "Starting $NUM_EXECUTORS X servers..."
export NUM_EXECUTORS
for i in $(seq 1 $NUM_EXECUTORS); do
echo "Launching X server $i..."
# Start the X frame buffer implementation
sudo -i -u ubuntu Xvfb :$i +extension GLX -screen 0 $SCREEN_RES -ac &> xvfb-$i.log &
# Sleep a little to give programs a chance to start
sleep 2
# Start the fluxbox window manager.
# We need a light window manager that allows maximizing windows
sudo -i -u ubuntu DISPLAY=:$i fluxbox &> fluxbox-$i.log &
# Sleep a little to give programs a chance to start
sleep 2
# Share the xsession over VNC
sudo -i -u ubuntu x11vnc -forever -display :$i -N -passwdfile /tmp/vnc-password.txt &> vnc-$i.log &
# Sleep a little to give programs a chance to start
sleep 2
done
}
但是即使我尝试运行 startx,视频录制也不起作用。
X.Org X Server 1.15.1
Release Date: 2014-04-13
X Protocol Version 11, Revision 0
Build Operating System: Linux 3.2.0-76-generic x86_64 Ubuntu
Current Operating System: Linux ip-10-0-0-79 3.13.0-123-generic #172-Ubuntu SMP Mon Jun 26 18:04:35 UTC 2017 x86_64
Kernel command line: BOOT_IMAGE=/boot/vmlinuz-3.13.0-123-generic root=UUID=d4f2aafc-946a-4514-930d-4c45e676f198 ro nomodeset console=tty1 console=ttyS0 nomdmonddf nomdmonisw
Build Date: 12 February 2015 02:49:29PM
xorg-server 2:1.15.1-0ubuntu2.7 (For technical support please see http://www.ubuntu.com/support)
Current version of pixman: 0.30.2
Before reporting problems, check http://wiki.x.org
to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
(++) from command line, (!!) notice, (II) informational,
(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.2.log", Time: Fri Jul 14 06:47:49 2017
(==) Using system config directory "/usr/share/X11/xorg.conf.d"
Initializing built-in extension Generic Event Extension
Initializing built-in extension SHAPE
Initializing built-in extension MIT-SHM
Initializing built-in extension XInputExtension
Initializing built-in extension XTEST
Initializing built-in extension BIG-REQUESTS
Initializing built-in extension SYNC
Initializing built-in extension XKEYBOARD
Initializing built-in extension XC-MISC
Initializing built-in extension SECURITY
Initializing built-in extension XINERAMA
Initializing built-in extension XFIXES
Initializing built-in extension RENDER
Initializing built-in extension RANDR
Initializing built-in extension COMPOSITE
Initializing built-in extension DAMAGE
Initializing built-in extension MIT-SCREEN-SAVER
Initializing built-in extension DOUBLE-BUFFER
Initializing built-in extension RECORD
Initializing built-in extension DPMS
Initializing built-in extension Present
Initializing built-in extension DRI3
Initializing built-in extension X-Resource
Initializing built-in extension XVideo
Initializing built-in extension XVideo-MotionCompensation
Initializing built-in extension SELinux
Initializing built-in extension XFree86-VidModeExtension
Initializing built-in extension XFree86-DGA
Initializing built-in extension XFree86-DRI
Initializing built-in extension DRI2
**Loading extension GLX
error setting MTRR (base = 0xf0000000, size = 0x00100000, type = 1) Invalid argument (22)**
我已经在 Google 上搜索过了,但还是没能找到视频无法正常工作的具体答案。任何帮助或提示都会对我有很大帮助。提前感谢您的回复!!!!
答案1
问题现已解决..录制是在 java 进程中完成的.. pb = new ProcessBuilder(screenRecorderProcessLocation, "-an", "-s", System.getenv("SCREEN_RES"), "-f", "x11grab", "-i", "localhost:"+ display, "-vcodec", "libx264", "-r", "24", screenVideoFile.getAbsolutePath());
环境变量中未找到 SCREEN_RES 值,这导致 avconv 停止录制。在对分辨率进行硬编码后,我开始录制视频。最好的检查方法是手动运行录制片段来检查它是否正常工作。然后执行。。20 天后我很幸运,不知道出了什么问题!!大家加油!!学习愉快!!!