Как создать и настроить свой веб-сервер на VDS (05 сен 2024)
Осенью самое время заняться установкой и тюнингом своего веб-сервера. Не правда ли?
Скрипт для создания скринкастов
- Aleksej
- Автор темы
- Не в сети
- Модератор
Less
Больше
11 года 1 мес. назад #1
от Aleksej
Aleksej создал тему: Скрипт для создания скринкастов
Очень удобный скрипт для создания скринкаста в Linux. Найден в Сети, автор мне, к сожалению, неизвестен. Следует отметить, что скрипт работает не со всеми версиями libavcodec... но тем не менее. Создаем файл scrincast.sh, делаем его исполняемым и вперед:
Code:
#!/bin/bash
# list of programs we depend on
progs="xdpyinfo grep head sed ffmpeg pacat parec sox"
# check for programs we depend on
result=0
for prog in $progs
do
type -p $prog > /dev/null
if (( $? != 0 )); then
echo "Error: Cannot find required program '$prog'"
result=1
fi
done
if (( $result != 0 )); then
exit 1
fi
screenSize="640x480" # default if we cant detect it
screenOffset="0,0" # default to top-left corner
frameRate="24" # default frame rate
baseName="capture" # default base filename for capture
# attempt to detect the dimension of the screen for the default
dimensions=`xdpyinfo | grep 'dimensions:' | head -1 | \
sed -e 's/^.* \([0-9]\+x[0-9]\+\) pixels.*$/\1/'`
if [[ "$dimensions" =~ [0-9]+x[0-9]+ ]]; then
screenSize=$dimensions
fi
# collect command line settings
while getopts 'hs:o:t:p' param ; do
case $param in
s)
screenSize="$OPTARG"
;;
o)
screenOffset="$OPTARG"
;;
t)
timeToRecord="$OPTARG"
;;
*)
echo ""
echo "$0 - records screencast"
echo ""
echo "$0 [options] [base-filename]"
echo ""
echo "options:"
echo " -h show brief help"
echo " -s <size> screensize to record as <width>x<height>"
echo " -o <offset> offset off recording area as <xoffset>,<yoffset>"
echo " -t <time> time to record (in seconds)"
echo ""
exit 0
;;
esac
done
shift $(( $OPTIND - 1 ))
# determine basename of files
if [ -n "$1" ] ; then
baseName="$1"
fi
echo ""
echo "Size = $screenSize"
echo "Offset = $screenOffset"
echo "Rate = $frameRate"
echo "Filename = $baseName"
# get ready to start recording
echo ""
if [ -n "$timeToRecord" ]; then
echo "Preparing to capture for $timeToRecord seconds."
else
echo "Preparing to capture."
echo "Press ENTER when finished capturing."
fi
sleep 3
echo ""
# start playing silence to make sure there is always audio flowing
pacat /dev/zero &
pidSilence=$!
# starts recording video using x11grab to make mpeg2video
ffmpeg -y -an \
-s "$screenSize" -r "$frameRate" -f x11grab -i :0.0+"$screenOffset" \
-s "$screenSize" -r "$frameRate" -aspect 16:10 -vcodec mpeg2video -sameq \
-f mpeg2video "$baseName.mpeg" &
pidVideo=$!
# starts recording raw audio
parec --format=s16le --rate=44100 --channels=1 $baseName.raw &
pidAudio=$!
echo ""
echo "Video recording started with process ID $pidVideo"
echo "Audio recording started with process ID $pidAudio"
echo ""
# wait for recording to be done, either by timer or user hitting enter
if [ -n "$timeToRecord" ]; then
sleep "$timeToRecord"
else
read nothing
fi
# stop recordings
echo ""
echo "Terminating recordings ..."
kill -15 $pidVideo $pidAudio
kill -15 $pidSilence
wait
# filter and normalize the audio
echo ""
echo "Filtering and normalizing sound ..."
sox --norm -s -b 16 -L -r 44100 -c 1 "$baseName.raw" "$baseName.wav" highpass 65 lowpass 12k
# encode video and audio into avi file
echo ""
echo "Encoding to final avi ..."
ffmpeg -isync -i "$baseName.wav" -i "$baseName.mpeg" -acodec mp2 -ab 192k -vcodec copy "$baseName.avi"
# convert to ogg
#echo""
#echo "convert to theora"
#ffmpeg2theora "$baseName.avi" -o "$baseName.ogv"
rm "$baseName.wav" "$baseName.raw"
echo ""
echo "DONE! Final media written in file $baseName.avi"
echo ""
exit 0
Пожалуйста Войти или Регистрация, чтобы присоединиться к беседе.
- evgenij
- Не в сети
- Завсегдатай
Less
Больше
- Сообщений: 227
- Спасибо получено: 33
9 года 7 мес. назад #2
от evgenij
Have a lot of fun!
evgenij ответил в теме Скрипт для создания скринкастов
Подтверждаю, скрипт отлично работает. Сразу после запуска получаем следующее сообщение:
- следуем полученному указанию и убираем sameq. Или заменяем, как сказано. Т.е. в итоге получаем следующее:
Code:
Option 'sameq' was removed. If you are looking for an option to preserve the quality (which is not what -sameq was for), use -qscale 0 or an equivalent quality factor option.
Failed to set value '1' for option 'sameq': Invalid argument
- следуем полученному указанию и убираем sameq. Или заменяем, как сказано. Т.е. в итоге получаем следующее:
Code:
#!/bin/bash
# list of programs we depend on
progs="xdpyinfo grep head sed ffmpeg pacat parec sox"
# check for programs we depend on
result=0
for prog in $progs
do
type -p $prog > /dev/null
if (( $? != 0 )); then
echo "Error: Cannot find required program '$prog'"
result=1
fi
done
if (( $result != 0 )); then
exit 1
fi
screenSize="640x480" # default if we cant detect it
screenOffset="0,0" # default to top-left corner
frameRate="24" # default frame rate
baseName="capture" # default base filename for capture
# attempt to detect the dimension of the screen for the default
dimensions=`xdpyinfo | grep 'dimensions:' | head -1 | \
sed -e 's/^.* \([0-9]\+x[0-9]\+\) pixels.*$/\1/'`
if [[ "$dimensions" =~ [0-9]+x[0-9]+ ]]; then
screenSize=$dimensions
fi
# collect command line settings
while getopts 'hs:o:t:p' param ; do
case $param in
s)
screenSize="$OPTARG"
;;
o)
screenOffset="$OPTARG"
;;
t)
timeToRecord="$OPTARG"
;;
*)
echo ""
echo "$0 - records screencast"
echo ""
echo "$0 [options] [base-filename]"
echo ""
echo "options:"
echo " -h show brief help"
echo " -s <size> screensize to record as <width>x<height>"
echo " -o <offset> offset off recording area as <xoffset>,<yoffset>"
echo " -t <time> time to record (in seconds)"
echo ""
exit 0
;;
esac
done
shift $(( $OPTIND - 1 ))
# determine basename of files
if [ -n "$1" ] ; then
baseName="$1"
fi
echo ""
echo "Size = $screenSize"
echo "Offset = $screenOffset"
echo "Rate = $frameRate"
echo "Filename = $baseName"
# get ready to start recording
echo ""
if [ -n "$timeToRecord" ]; then
echo "Preparing to capture for $timeToRecord seconds."
else
echo "Preparing to capture."
echo "Press ENTER when finished capturing."
fi
sleep 3
echo ""
# start playing silence to make sure there is always audio flowing
pacat /dev/zero &
pidSilence=$!
# starts recording video using x11grab to make mpeg2video
ffmpeg -y -an \
-s "$screenSize" -r "$frameRate" -f x11grab -i :0.0+"$screenOffset" \
-s "$screenSize" -r "$frameRate" -aspect 16:10 -vcodec mpeg2video \
-f mpeg2video "$baseName.mpeg" &
pidVideo=$!
# starts recording raw audio
parec --format=s16le --rate=44100 --channels=1 $baseName.raw &
pidAudio=$!
echo ""
echo "Video recording started with process ID $pidVideo"
echo "Audio recording started with process ID $pidAudio"
echo ""
# wait for recording to be done, either by timer or user hitting enter
if [ -n "$timeToRecord" ]; then
sleep "$timeToRecord"
else
read nothing
fi
# stop recordings
echo ""
echo "Terminating recordings ..."
kill -15 $pidVideo $pidAudio
kill -15 $pidSilence
wait
# filter and normalize the audio
echo ""
echo "Filtering and normalizing sound ..."
sox --norm -s -b 16 -L -r 44100 -c 1 "$baseName.raw" "$baseName.wav" highpass 65 lowpass 12k
# encode video and audio into avi file
echo ""
echo "Encoding to final avi ..."
ffmpeg -isync -i "$baseName.wav" -i "$baseName.mpeg" -acodec mp2 -ab 192k -vcodec copy "$baseName.avi"
# convert to ogg
#echo""
#echo "convert to theora"
#ffmpeg2theora "$baseName.avi" -o "$baseName.ogv"
rm "$baseName.wav" "$baseName.raw"
echo ""
echo "DONE! Final media written in file $baseName.avi"
echo ""
exit 0
Have a lot of fun!
Пожалуйста Войти или Регистрация, чтобы присоединиться к беседе.