scripts/secondcount.sh

12 lines
383 B
Bash
Executable File

#!/bin/bash
echo "usage: script.sh folder_without_slash file_extention"
count=0
cd $1
for file in *.$2 ; do
#echo $file
add=$( ffmpeg -i "$file" 2>&1 | grep "Duration" | cut -d ' ' -f 4 | sed s/,// | sed 's@\..*@@g' | awk '{ split($1, A, ":"); split(A[3], B, "."); print 3600*A[1] + 60*A[2] + B[1] }')
# echo "length $add"
count=$(($count + $add))
done
echo "total: $count s"