Using the following awk script should work fine:
BEGIN { h=0; m=0; s=0; cs=0; } /Duration:/ { split($2, time_arr, ":"); h = h + time_arr[1]; m = m + time_arr[2]; split(time_arr[3],time_arr2,"."); s = s + time_arr2[1]; cs = cs + time_arr2[2]; } END { s = s + int(cs/100); cs = cs % 100; m = m + int(s / 60); s = s % 60; h = h + int(m / 60); m = m % 60; printf "%02d:%02d:%02d.%02d\n", h, m, s, cs; }
Put this in add_durations.awk , then you can do:
for f in *; do ffmpeg -i "$f" 2>&1; done | awk -f add_durations.awk
Please note that this also converts hours, etc. for you:).
source share