Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # 区切り文字に半角スペースを含まないようにIFSを修正
- PRE_IFS=$IFS
- IFS=$'\n'
- ts=/storage/ts/
- log=/home/shaka/enc.txt
- for file in `\find $ts -maxdepth 1 -type f`; do
- ts_path="$file"
- save_path="${ts_path/\/ts\///mp4/}"
- save_path="${save_path%.*}.mp4"
- if [ -f $save_path ]; then
- echo "already exist $file"
- continue
- fi
- echo -----start encoding @$(date +%Y/%m/%d/%H:%M:%S)----- >> $log
- start=$(date +%s)
- echo $1 >> $log
- ffmpeg -y -i $ts_path -vcodec libx264 -acodec aac -tune animation $save_path 2>&1 | grep "^[^f]" >> $log
- end=$(date +%s)
- diff=$(expr $end - $start)
- echo about $(expr $diff / 60) min. >> $log
- echo ---finish encoding @$(date +%Y/%m/%d/%H:%M:%S)--- >> $log
- echo >> $log
- done
- IFS=$PRE_IFS
- exit
Add Comment
Please, Sign In to add comment