Добавь в скрипт отображении времени на записи в… · The Chat Archive
Explore / Programming Добавь в скрипт отображении времени на записи в HH:MM:SS.mmm И чтоб цвет надписи… Save Share Download ▾ ReportДобавь в скрипт отображении времени на записи в HH:MM:SS.mmm
И чтоб цвет надписи контрастировал на белом фоне
#!/bin/bash -e
while getopts "mnhv" o
do
case "o " i n ( \? ) e c h o " I n v a l i d o p t i o n : − o" in
(\?) echo "Invalid option: - o " in ( \? ) ec h o " I n v a l i d o pt i o n : − OPTARG" >&2 ;;
(h) less ( r e a d l i (dirname ((OPTIND - 1))
Assistant2023-04-30 11:31 UTC Copy response
#!/bin/bash -e
time_format="HH:MM:SS.mmm"
text_color="black"
while getopts "mnhv" o
do
case "$o" in
(\?) echo "Invalid option: -$OPTARG" >&2 ;;
(h) less $(readlink -f $(dirname $0))/README.md; exit;;
(v) verbose="";; # funnily ffmpeg is verbose by default
(*) break;;
esac
done
shift $((OPTIND - 1))
lockfile=/tmp/r2d2
if test -f $lockfile
then
pid=$(awk '{print $1}' $lockfile)
if kill -0 $pid
then
kill -INT $pid
echo Killed $(cat $lockfile)
logger x11captured: $(du -h $(awk '{print $2}' $lockfile))
rm $lockfile
exit
else
rm $lockfile
fi
fi
output="/home/samoylov/mh/videos/screencast/$(date +%Y-%m-%d)/${1:-$(date +%s)}.mov"
mkdir -p $(dirname $output)
if test -f "$output"
then
echo $output already exists
logger $(basename $0): $output already exists
exit 1
fi
die() { echo "$@"; exit 1; }
require() { which $1 &> /dev/null; }
for prg in xdpyinfo ffmpeg; do
require $prg || die "needs ${prg} installed"
done
res="$(xdpyinfo | awk '/dimensions:/ { print $2; exit }')"
X11GRAB=$(xrectsel "-f x11grab -s %wx%h -i :0.0+%x,%y") || exit -1
FFREPORT=file=/tmp/$(basename $output).log ffmpeg -report -hide_banner -loglevel quiet \
-framerate 24 $X11GRAB -f alsa -ac 2 -i hw:0 \
-vf "drawtext=text='%{localtime\:%$time_format}':x=10:y=10:fontsize=24:fontcolor=$text_color" \
$output &
echo "$! $(readlink -f $output)" > $lockfile
echo -e "\033[1;34m$0\033[m Capturing $res to $output kill $(awk '{print $1}' $lockfile) to kill capture or run $0 again"
Copy first prompt Copy first response
Other models, same or similar prompt Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Details
Provider OpenAI
Model provenance As recorded by source dataset
Turns 1 (2 messages)
Language en
Conversation date Apr 30, 2023
Added to archive Nov 16, 2026
ID 01m7h4190wqja2q1n79np8am37Source & license Imported from WildChat-4.8M (AI2) (source ). Imported records earn no Research Points.
Upstream record: 36260e55e69b0d9a869ec9ee05b4ec16
Zhao et al., WildChat: 1M ChatGPT Interaction Logs in the Wild (ICLR 2024). Contains information from WildChat-4.8M, made available under the ODC Attribution License.
License: ODC-BY-1.0
n k − f (readlink -f ( r e a d l ink − f
0))/README.md; exit;;
(v) verbose="";; # funnily ffmpeg is verbose by default
(*) break;;
esac
done
shift
if test -f l o c k f i l e t h e n p i d = lockfile
then
pid= l oc k f i l e t h e n p i d = (awk '{print 1}' lockfile)
if kill -0 p i d t h e n k i l l − I N T pid
then
kill -INT p i d t h e nk i l l − I N T pid
echo Killed ( c a t (cat ( c a t lockfile)
logger x11captured: ( d u − h (du -h ( d u − h (awk '{print 2}' lockfile))
rm l o c k f i l e e x i t e l s e r m lockfile
exit
else
rm l oc k f i l ee x i t e l ser m lockfile
fi
fi
#output="( d i r n a m e (dirname ( d i r nam e (readlink -f 0 ) ) / 0))/ 0 )) / (date +%Y-%m-%d)/{1:- (date +%s)}.mkv"
output="/home/samoylov/mh/videos/screencast/( d a t e + (date +%Y-%m-%d)/ ( d a t e + {1:-( d a t e + m k d i r − p (date +%s)}.mov"
mkdir -p ( d a t e + mk d i r − p (dirname $output)
Only create RAW file if one does not exist if test -f "o u t p u t " t h e n e c h o output"
then
echo o u tp u t " t h e n ec h o output already exists
logger ( b a s e n a m e (basename ( ba se nam e 0): $output already exists
exit 1
fi
die() { echo "@"; exit 1; }
require() { which 1 &> /dev/null; }
for prg in xdpyinfo ffmpeg; do
require p r g ∣ ∣ d i e " n e e d s prg || die "needs p r g ∣∣ d i e " n ee d s {prg} installed"
done
res="(xdpyinfo | awk '/dimensions:/ { print 2; exit }')"
#FFREPORT=file=/tmp/( b a s e n a m e (basename ( ba se nam e output).log ffmpeg -report -hide_banner -loglevel quiet \
-f x11grab -video_size r e s − i res -i r es − i DISPLAY -f pulse -i default -acodec pcm_s16le -c:v lib#x264 \
$output & X11GRAB=( x r e c t s e l " − f x 11 g r a b − s F F R E P O R T = f i l e = / t m p / (xrectsel "-f x11grab -s %wx%h -i :0.0+%x,%y") || exit -1
FFREPORT=file=/tmp/ ( x r ec t se l " − f x 11 g r ab − s F F R E P O R T = f i l e = / t m p / (basename o u t p u t ) . l o g f f m p e g − r e p o r t − h i d e b a n n e r − l o g l e v e l q u i e t − f r a m e r a t e 24 output).log ffmpeg -report -hide_banner -loglevel quiet \
-framerate 24 o u tp u t ) . l o g f f m p e g − r e p or X11GRAB -f alsa -ac 2 -i hw:0
$output &
echo "! ! ! (readlink -f o u t p u t ) " > output)" > o u tp u t ) " > lockfile
echo -e "\033[1;34m0 \0 33 [ m C a p t u r i n g 0\033[m Capturing 0 \0 33 [ m C a pt u r in g res to o u t p u t k i l l output kill o u tp u t k i l l (awk '{print 1}' lockfile) to kill capture or run $0 again"
Я добавил переменные time_format и text_color в верхнюю часть скрипта, чтобы вы могли легко настроить формат времени и цвет текста. Затем я изменил ffmpeg команду, добавив фильтр видео -vf "drawtext=text='%{localtime\:%$time_format}':x=10:y=10:fontsize=24:fontcolor=$text_color" для отображения текущего времени на записи видео. Замените значения time_format и text_color на желаемые значения для настройки формата времени и цвета текста соответственно.
Not yet included in a published release.
t
−
hi d e b ann er −
l o g l e v e l q u i e t −
f r am er a t e 24