| 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 | } |
| 17 |
jackz / Get Total Duration of Folder of Videos
Last active 1 month ago
https://unix.stackexchange.com/questions/587646/how-to-get-the-total-duration-of-all-video-files-in-current-folder-and-sub-direc