Like 0

https://unix.stackexchange.com/questions/587646/how-to-get-the-total-duration-of-all-video-files-in-current-folder-and-sub-direc

jackz revised this gist 1 month ago · f945e24

1 file changed, 16 insertions, 1 deletion

total_folder_duration.sh
@@ -1 +1,16 @@
1 - exiftool -ext mp4 -r -n -q -p '${Duration;$_ = ConvertDuration(our $total += $_)}' . | tail -n 1
1 + # Recursive all files in dir
2 + exiftool -ext mp4 -r -n -q -p '${Duration;$_ = ConvertDuration(our $total += $_)}' . | tail -n 1
3 +
4 + # More control
5 + # calc-durs Replay_* - all files matching glob in single folder only
6 + # calc-durations -r Replay_* - recursive in all folders
7 + calc-durs() {
8 + local -a files
9 + if [[ "$1" == "-r" ]]; then
10 + shift
11 + exiftool -ext mp4 -r -n -q -p '${Duration;$_ = ConvertDuration(our $total += $_)}' -- "${@:-.}" | tail -n 1
12 + else
13 + files=("$@")
14 + exiftool -n -q -p '${Duration;$_ = ConvertDuration(our $total += $_)}' -- "${files[@]}" | tail -n 1
15 + fi
16 + }

jackz revised this gist 1 month ago · dd293f7

1 file changed, 1 insertion

total_folder_duration.sh (file created)
@@ -0,0 +1 @@
1 + exiftool -ext mp4 -r -n -q -p '${Duration;$_ = ConvertDuration(our $total += $_)}' . | tail -n 1