Skip to content

Instantly share code, notes, and snippets.

@musan6363
Last active June 28, 2021 04:13
Show Gist options
  • Save musan6363/a93b42a4d71f5d831298f29390fb03b8 to your computer and use it in GitHub Desktop.
Save musan6363/a93b42a4d71f5d831298f29390fb03b8 to your computer and use it in GitHub Desktop.
idで始まる全ての動画をOpenFaceに入力するシェルスクリプト
#!/bin/bash
###
# 全ての動画を対象にOpenFaceの実行
# sh ./run_all.sh <対象動画の場所> <出力先>
###
# ln /dev/null /dev/raw1394
echo "Video dir is $1"
echo "Output dir is $2"
# 開始時刻の記録
start_time=`date +%s`
TZ=-9 date '+%a %b %d %H:%M:%S JST %Y' > $2/run_time.txt
# 動画ごとのカウンタ
cnt=0
for file in $(find $1 -name "id*.mov"); do
# 各処理の開始時刻を記録`
begin=`date +%s` # 処理にかかった時間を計算する用
now=`TZ=-9 date '+%a %b %d %H:%M:%S JST %Y'`
echo "${now}, ${file}" # 処理開始からあまりに時間が立っていればその動画に問題があるかも
title=`basename ${file} .mov` # パスと拡張子を除く
mkdir $2/${title}
# メインの処理
build/bin/FaceLandmarkVidMulti -f ${file} -out_dir $2/${title} 1>$2/${title}/output.txt 2>$2/${title}/error.txt
end=`date +%s`
cnt=$((cnt+1))
elp=$((end-begin))
echo "${cnt}, ${elp}, ${title}" >> $2/run_time.txt
done
end_time=`date +%s`
run_time=$((end_time - start_time))
TZ=-9 date '+%a %b %d %H:%M:%S JST %Y' >> $2/run_time.txt
echo $run_time >> $2/run_time.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment