makedist-recordvm: create better and less preview images by decreasing rate; fix preview*.jpg images size
This commit is contained in:
parent
91c16825d5
commit
3069b88a8f
@ -7,14 +7,36 @@ EXECUTION_TIME=200
|
||||
VIDEO_EXT=.flv
|
||||
VIDEO_EXT2=.ogv
|
||||
|
||||
[ $1 ] || {
|
||||
function usage() {
|
||||
echo "Usage:"
|
||||
echo "recordvm.sh iso_path"
|
||||
echo "recordvm.sh iso_path [--recreate-images] [-h]"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
opts=($@)
|
||||
|
||||
while test -n "$1" ; do
|
||||
case $1 in
|
||||
"--recreate-images") RECREATE_IMAGES=1;;
|
||||
"-h") usage; exit 0 ;;
|
||||
*) if [ -z "$ISO_PATH" ]; then
|
||||
ISO_PATH=$1
|
||||
else
|
||||
echo "Error: extra argument $1 specified; aborting."
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
[ "$ISO_PATH" ] || {
|
||||
echo "Error: ISO path was not specified; aborting."
|
||||
usage
|
||||
exit 1
|
||||
}
|
||||
|
||||
ISO_DIR=`dirname $ISO_PATH`
|
||||
ISO_NAME=`basename $ISO_PATH`
|
||||
|
||||
@ -23,6 +45,7 @@ ISO_NAME=`basename $ISO_PATH`
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ ! "$RECREATE_IMAGES" ]; then
|
||||
echo "Preparing ISO image $ISO_PATH"
|
||||
ln -sf $ISO_PATH $RECORDVM_DATA/recordvm.iso
|
||||
echo "Starting virtual machine for $ISO_PATH"
|
||||
@ -101,19 +124,21 @@ done
|
||||
else
|
||||
xkill -id $WINID -display $VBOX_DISPLAY
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Creating preview images"
|
||||
rm -f $ISO_DIR/preview/*.jpg
|
||||
ffmpeg -y -i $ISO_DIR/preview/$ISO_NAME${VIDEO_EXT} -r 1 -f image2 $ISO_DIR/preview/image-%03d.jpg >/dev/null
|
||||
for i in `seq 200 -1 1`; do
|
||||
f=`printf %03d $i`
|
||||
ffmpeg -y -i $ISO_DIR/preview/$ISO_NAME${VIDEO_EXT} -r 0.1 -f image2 $ISO_DIR/preview/image-%02d.jpg >/dev/null
|
||||
for i in `seq 22 -1 1`; do
|
||||
f=`printf %02d $i`
|
||||
[ -e $ISO_DIR/preview/image-$f.jpg ] && {
|
||||
convert -size 320x200 $ISO_DIR/preview/image-$f.jpg $ISO_DIR/preview/preview.jpg
|
||||
convert -size 400x300 $ISO_DIR/preview/image-$f.jpg $ISO_DIR/preview/preview-400x300.jpg
|
||||
convert -resize 320x200 $ISO_DIR/preview/image-$f.jpg $ISO_DIR/preview/preview.jpg
|
||||
convert -resize 400x300 $ISO_DIR/preview/image-$f.jpg $ISO_DIR/preview/preview-400x300.jpg
|
||||
break
|
||||
}
|
||||
done
|
||||
|
||||
if [ ! "$RECREATE_IMAGES" ]; then
|
||||
echo "Creating ${VIDEO_EXT2} video from ${VIDEO_EXT}"
|
||||
#ffmpeg -y -i $ISO_DIR/preview/$ISO_NAME${VIDEO_EXT} $ISO_DIR/preview/$ISO_NAME${VIDEO_EXT2} >/dev/null
|
||||
ffmpeg2theora -y -i $ISO_DIR/preview/$ISO_NAME${VIDEO_EXT} $ISO_DIR/preview/$ISO_NAME${VIDEO_EXT2} >/dev/null
|
||||
@ -125,6 +150,7 @@ done
|
||||
for f in `ls $ISO_DIR/preview/*${VIDEO_EXT2}`; do
|
||||
[ "$f" = "$ISO_DIR/preview/$ISO_NAME${VIDEO_EXT2}" ] || rm -f $f
|
||||
done
|
||||
fi
|
||||
|
||||
echo "Done."
|
||||
exit 0
|
||||
|
Loading…
Reference in New Issue
Block a user