Let's say I have a directory with 5 video files in it. How can I measure the total duration of all video files in this directory from terminal. Also, I want to be able to do this recursively to any subdirectories it may has. I don't want to use VLC or any other GUI tools, since I've many directories to perform this action on, and it take a lot of time for me to do it.
1 Answer
As noted in comments, the command from anotehr thread works for a single directory, but not multiple subdirectories.
This command will use find to get files from all subdirectories (ending in .mp4)
find ./ -name *.mp4 -exec exiftool -S -n {} \;
exiftool -S -n ./*.mp4 | awk '/^Duration/ {print $2}' | paste -sd+ -| bc
man find
is your friend): what-maxdepth
is, what-exec
is. Experiment. Edit the question and tell us what exactly you have tried, where you are stuck. Not knowing is not a shame, nor is failing; but not trying is.