SF.net SVN: morphix: [2553] trunk/mmaker/utils/auto-testing/ video-qemu-booting-iso.sh
[email protected] Wed, 15 Aug 2007 13:51:54 -0700
| Newsgroups | gmane.linux.morphix.cvs |
|---|---|
| Message-ID | <[email protected]> |
Revision: 2553
http://morphix.svn.sourceforge.net/morphix/?rev=2553&view=rev
Author: bmsleight
Date: 2007-08-15 13:51:53 -0700 (Wed, 15 Aug 2007)
Log Message:
-----------
Now using Twibright-vncrec. Twibrihgt packages soon to be available at debian-restricted.
Modified Paths:
--------------
trunk/mmaker/utils/auto-testing/video-qemu-booting-iso.sh
Modified: trunk/mmaker/utils/auto-testing/video-qemu-booting-iso.sh
===================================================================
--- trunk/mmaker/utils/auto-testing/video-qemu-booting-iso.sh 2007-08-02 19:20:55 UTC (rev 2552)
+++ trunk/mmaker/utils/auto-testing/video-qemu-booting-iso.sh 2007-08-15 20:51:53 UTC (rev 2553)
@@ -3,7 +3,7 @@
# video-qemu-booting-iso.sh #
# #
# Copyleft (c) 2007 Brendan M. Sleight #
-# <bmsleight@barwap._REMOVE_SPAM_TRAP.com> #
+# <bmsleight@barwap._REMOVE_SPAM_TRAP.com> #
# #
# This script is licensed under the GNU GPL v2 or later. #
# #
@@ -11,8 +11,8 @@
# /usr/share/common-licenses/GPL #
# #
# Required packages/applications :- #
-# bash, expect, ffmpeg2thoera, imagemagick, mencoder, #
-# qemu, vncrec, vncserver #
+# bash, expect, ffmpeg2thoera, imagemagick, #
+# twibright-vnc, qemu, vncserver #
# #
# Requires /etc/vnc.conf to be ammended. #
# #
@@ -30,7 +30,7 @@
if [ "$VNCCONF" != "\$vncStartup = \"~/.vnc/xstartup\";" ]
then
echo "Requires vnc.conf to have the line:- "
- echo "\$vncStartup = \"~/.vnc/xstartup\";"
+ echo "\$vncStartup = \"~/.vnc/xstartup\";"
echo "Else two lots of windowm mangers will launched in the extra vnc sessions."
exit
fi
@@ -42,10 +42,9 @@
PASSWD="$RANDOM.$RANDOM.$RANDOM.$RANDOM.$RANDOM"
HOSTNAME=$(hostname)
OLD_DISPLAY="$DISPLAY"
-TODAY=$(date +"%F")
+TODAY=$(date +"%F")
TMP_DIR=/tmp/vqbi.$$.tmp
IPADDRESS="127.0.0.1"
-VNCREC_MOVIE_FRAMERATE=1
}
get_options_and_defaults ()
@@ -62,15 +61,13 @@
if [ "$CONVERT_DIM" = "" ]; then
CONVERT_DIM="800x600"
fi
-if [ "$MCODER_DIM" = "" ]; then
- MCODER_DIM="w=800:h=600"
-fi
-MCODER_DIM_SCALE=$(echo "$MCODER_DIM" | sed s/x/,/g)
+FFMPEG_DIM_SCALE=$(echo "$CONVERT_DIM" | sed s/x/\ -y\ /g)
+FFMPEG_DIM_SCALE="-x $FFMPEG_DIM_SCALE"
if [ "$TIME_Q" = "" ]; then
- TIME_Q="60"
+ TIME_Q="600"
fi
-if [ "$LOGO" = "" ]; then
- LOGO="/home/morph/webconverger/openlogo-75.png"
+if [ "$VQUALITY" = "" ]; then
+ VQUALITY="5"
fi
if [ "$QEMU_BIN" = "" ]; then
QEMU_BIN="qemu"
@@ -116,7 +113,7 @@
start_vnc_record ()
{
-export DISPLAY="$VNSERVER_VNCREC"
+export DISPLAY="$VNSERVER_VNCREC"
export VNCREC_MOVIE_FRAMERATE
echo "Starting vncrec, recording :$VNCSERVER_QMEU_NUMBER. Local display :$VNCSERVER_VNCREC_NUMBER"
vncrec -display :$VNCSERVER_VNCREC_NUMBER -passwd ~/.vnc/passwd -shared -viewonly -encoding raw -record $TMP_DIR/qemu.1.vnc :$VNCSERVER_QMEU_NUMBER &
@@ -146,70 +143,28 @@
let_qemu_run ()
{
-echo "Sleeping for $TIME_Q seconds whilst qemu runs"
+echo "Sleeping for $TIME_Q seconds whilst qemu runs"
sleep $TIME_Q
}
stop_qemu ()
{
-echo "Stopping vncrec and qemu"
+echo "Stopping vncrec and qemu"
killall vncrec
killall $QEMU_BIN
}
stop_vncservers ()
{
-echo "Stopping vncservers"
+echo "Stopping vncservers"
vncserver -kill :$VNCSERVER_QMEU_NUMBER
vncserver -kill :$VNCSERVER_VNCREC_NUMBER
}
-
-export_frames ()
-{
-convert $LOGO -resize 200x200 -negate -gravity South -background Black -font Helvetica-Bold -fill white -splice 0x36 -pointsize 25 -draw "text 0,0 'AutoTesting'" -transparent black $TMP_DIR/minilogo.png
-convert $TMP_DIR/minilogo.png -fill grey50 -colorize 40 $TMP_DIR/minilogo.png
-VNCREC_MOVIE_CMD="convert xpm:- $TMP_DIR/image-%05d.jpg"
-export VNCREC_MOVIE_CMD
-
-vncrec -movie $TMP_DIR/qemu.1.vnc >/dev/null 2>&1 &
-# vncrec can hand sometimes hang and not terminate, after all frames have been generated.
-# So we monitor vncrec and kill vncrec when no further frames are being generated
-MORE_FRAMES=1
-NUMBER_FRAMES=0
-while [ "$MORE_FRAMES" -gt "$NUMBER_FRAMES" ]
-do
- NUMBER_FRAMES="$MORE_FRAMES"
- sleep 60
- MORE_FRAMES=$(ls $TMP_DIR/image-*.jpg | wc -w)
- echo "Frames: $NUMBER_FRAMES to $MORE_FRAMES generated"
-done
-ps ax | grep vncrec
-killall vncrec
-echo "vncrec -movie killed"
-
-for i in $TMP_DIR/image-*.jpg
-do
- convert $i -resize $CONVERT_DIM $i
- echo "Resized $i"
- # The logo is needed to ensure we do not have a blank frame, which mencode can not handle.
- # Heck - it also looks nice IMHO.
- composite -dissolve 15 -gravity northeast $TMP_DIR/minilogo.png $i $i
-done
-echo "Finished making Frames"
-}
-
-
gen_video ()
{
-##Following is ideal - does not work
-#mkfifo -m 660 $TMP_DIR/stream.yuv
-#mplayer -vo yuv4mpeg:file=$TMP_DIR/stream.yuv -ao null -nosound -quiet "mf://$TMP_DIR/*.jpg" -mf fps=4:type=jpg &
-#ffmpeg2theora -v 8 $TMP_DIR/stream.yuv -o $VIDEO
-#sleep 5
-
-mencoder mf://"$TMP_DIR/*.jpg" -mf w=800:h=600:fps=4:type=jpg -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell -oac copy -o $TMP_DIR/tmp.avi
-ffmpeg2theora -o $VIDEO $TMP_DIR/tmp.avi --artist "AutoTesting" --title "Video of Qemu booting $ISO" --date "$TODAY"
+#Need to runs some tests to ensure vncrec -movie does temriante at end of session.
+vncrec -movie $TMP_DIR/qemu.1.vnc | ffmpeg2theora $FFMPEG_DIM_SCALE --videoquality $VQUALITY --inputfps 40 --artist "AutoTesting" --title "Video of Qemu booting $ISO" --date "$TODAY" -o $VIDEO -
}
clean_up ()
@@ -217,11 +172,11 @@
DISPLAY="$OLD_DISPLAY"
export DISPLAY="$OLD_DISPLAY"
rm $TMP_DIR -r
-rm /tmp/video-qemu-booting-iso.lock
+rm /tmp/video-qemu-booting-iso.lock
}
-while getopts s:p:g:d:t:l:q: opt
+while getopts s:p:g:d:t:v:q: opt
do
case "$opt" in
s) SENDKEYS="$OPTARG";;
@@ -229,30 +184,30 @@
g) GEOMETRY="$OPTARG";;
d) CONVERT_DIM="$OPTARG";;
t) TIME_Q="$OPTARG";;
- l) LOGO="$OPTARG";;
+ v) VQUALITY="$OPTARG";;
q) QEMU_BIN="$OPTARG";;
-
+
\?) # unknown flag
echo >&2 \
- "usage: $0 [-s \"keys,to,send,to,qemu\"] [-p port_number for qemu-monitor] [-g geometry of vncsession] [-d dimensions of video] [-t time to run qemu] [-l logo] [-q alternative qemu binary name] IsoToTest.iso Video.ogg "
+ "usage: $0 [-s \"keys,to,send,to,qemu\"] [-p port_number for qemu-monitor] [-g geometry of vncsession] [-d dimensions of video] [-t time to run qemu] [-v (0 to 10) encoding quality for video] [-q alternative qemu binary name] IsoToTest.iso Video.ogg "
exit 1;;
esac
done
shift `expr $OPTIND - 1`
if [ -z "$1" -a -z "$2" ]; then
- echo "usage: $0 [-s \"keys,to,send,to,qemu\"] [-p port_number for qemu-monitor] [-g geometry of vncsession] [-d dimensions of video] [-t time to run qemu] [-l logo] IsoToTest.iso Video.ogg "
+ echo "usage: $0 [-s \"keys,to,send,to,qemu\"] [-p port_number for qemu-monitor] [-g geometry of vncsession] [-d dimensions of video] [-t time to run qemu] [-v (0 to 10) encoding quality for video] [-q alternative qemu binary name] IsoToTest.iso Video.ogg "
echo
echo " This script boots a livecd using qemu and records a video of the process. "
- echo
+ echo
echo " It is worth noting that this script takes a long time to run and heavy usage of CPU."
echo " There is heavy usage of the qemu, imagemagik tools. "
echo " For every second of running qemu the script it can take up to 12s to compile the video."
echo " For example using -t 300 will about one hour."
echo
echo " Minimum geometry for qemu -g 1024x768"
- echo
+ echo
echo " Launches a couple of vncserver session, kills other vncrec and qemu sessions running."
exit
fi
@@ -269,7 +224,6 @@
start_qemu
let_qemu_run
stop_qemu
-export_frames
gen_video
stop_vncservers
clean_up
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/