Skip to content

Instantly share code, notes, and snippets.

@mizucoffee
Created November 5, 2016 12:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mizucoffee/51bdb18a8a67dffc6f942db5fa778273 to your computer and use it in GitHub Desktop.
Save mizucoffee/51bdb18a8a67dffc6f942db5fa778273 to your computer and use it in GitHub Desktop.
Chinachuで自動エンコード(監視型)
#!/bin/bash
# /mnt/video1 recordedフォルダ
# /mnt/video2 エンコード先フォルダ
while true
do
for file in `\find /mnt/video1 -maxdepth 1 -type f`; do
cat /mnt/video2/data.csv | grep -F $file
if [ ! $? = 0 ]; then
LINE=`cat /mnt/video2/data.csv | grep -c ''`
echo \"$file\" encode started
echo $LINE.mp4
ffmpeg -y -i $file -f mp4 -vcodec libx264 -vpre ts -r 30000/1001 -movflags faststart -aspect 16:9 -s 1280x720 -bufsize 20000k -maxrate 25000k -acodec libfaac -ac 2 -ar 48000 -ab 128k -threads 4 /mnt/video2/$LINE.mp4
echo "$LINE,/mnt/video2/$LINE.mp4,$file" >> /mnt/video2/data.csv
echo \"$file\" encode finished
channel='#投稿先チャンネルID'
text="エンコード完了: $file"
hook_url="SlackのHookのURL"
curl -X POST --data-urlencode "payload={\"channel\": \"${channel}\", \"text\": \"${text}\"}" ${hook_url}
echo "=============================================================================================="
fi
done
sleep 10s
done
level=41
crf=25
coder=1
flags=+loop
cmp=+chroma
partitions=+parti8x8+parti4x4+partp8x8+partb8x8
me_method=umh
subq=7
me_range=16
g=250
keyint_min=25
sc_threshold=40
i_qfactor=0.71
b_strategy=1
qmin=10
rc_eq='blurCplx^(1-qComp)'
bf=16
bidir_refine=1
refs=6
deblock=0:0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment