Skip to content

Instantly share code, notes, and snippets.

@kakutani
Created January 26, 2010 14:52
Show Gist options
  • Save kakutani/286891 to your computer and use it in GitHub Desktop.
Save kakutani/286891 to your computer and use it in GitHub Desktop.
#!/bin/bash
# taken from http://d.hatena.ne.jp/libkazz/20100108/1263024229
title="05.レクチャー後編, 中埜博 笹川万国"
input=/Users/shintaro/Desktop/alexander/nakano-3.mp4
output=/Users/shintaro/Desktop/alexander/$title
offset=0 #頭だし秒数
last=1904 #動画最後の秒数
overlap=2
term=600 # 10分
cmd=/opt/local/bin/ffmpeg
opt="-sameq -f mp4"
seq=1
cursor=`expr $offset + 1`
while [ $cursor -lt $last ]; do
echo "---$seq---"
$cmd -i "$input" -ss $cursor -t $term $opt "$output-$(printf %02d $seq).mp4"
seq=`printf %02d $(expr $seq + 1)`
if [ $seq = "01" ];then
ss_sec=$term
else
ss_sec=`expr $term - $overlap`
fi
cursor=`expr $cursor + $ss_sec`
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment