Skip to content

Instantly share code, notes, and snippets.

@musan6363
Last active June 10, 2021 07:15
Show Gist options
  • Save musan6363/f3a8680c59cd8c44a32200bfd28eac37 to your computer and use it in GitHub Desktop.
Save musan6363/f3a8680c59cd8c44a32200bfd28eac37 to your computer and use it in GitHub Desktop.
実行に失敗していた動画のみをOpenFaceの処理対象にするスクリプト.事前に失敗した動画のリストkilled.txtを用意する必要がある.
id0150no01
id0144no01
id0151no01
id0147no01
id0146no01
id0142no01
id0156no01
id0143no01
id0155no01
id0169no01
id0128no04
id0167no03
id0167no04
id0133no01
id0126no01
id0166no03
id0170no04
id0118no01
id0167no05
id0166no02
id0172no02
id0165no04
id0171no04
id0165no03
id0161no03
id0121no01
id0135no01
id0162no05
id0108no01
id0134no01
id0120no01
id0174no04
id0160no03
id0162no03
id0162no04
id0136no01
id0122no01
id0161no05
id0112no01
id0113no01
id0151no03
id0110no01
id0138no01
id0168no03
id0114no01
id0128no01
id0155no03
id0157no03
id0157no04
id0141no02
id0116no01
id0159no01
id0171no01
id0132no03
id0132no04
id0133no03
id0136no03
id0122no03
id0161no01
#!/bin/bash
ln /dev/null /dev/raw1394
# 失敗した動画のファイル名をまとめたテキストファイル
killedtxt="/tmp/killed.txt"
# 開始時刻の記録
start_time=`date +%s`
TZ=-9 date '+%a %b %d %H:%M:%S JST %Y' > /tmp/run_time.txt
# 動画ごとのカウンタ
cnt=0
while read killed
do
file=`find /tmp/rawvideo -name "${killed}.mov"`
# 各処理の開始時刻を記録`
begin=`date +%s` # 処理にかかった時間を計算する用
now=`TZ=-9 date '+%a %b %d %H:%M:%S JST %Y'`
echo "${now}, ${file}" # 処理開始からあまりに時間が立っていればその動画に問題があるかも
title=`basename ${file} .mov` # パスと拡張子を除く
mkdir /tmp/${title}
# メインの処理
build/bin/FaceLandmarkVidMulti -f ${file} -out_dir /tmp/${title} 1>/tmp/${title}/output.txt 2>/tmp/${title}/error.txt
end=`date +%s`
cnt=$((cnt+1))
elp=$((end-begin))
echo "${cnt}, ${elp}, ${title}" >> /tmp/run_time.txt
done < ${killedtxt}
end_time=`date +%s`
run_time=$((end_time - start_time))
TZ=-9 date '+%a %b %d %H:%M:%S JST %Y' >> /tmp/run_time.txt
echo $run_time >> /tmp/run_time.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment