I have a list of .ts files: out1.ts ... out749.ts   out8159.ts  out8818.tsHow can I get the total duration (running time) of all these files?
Get total duration of video files in a directory
shell script;video
I have no .ts here but this works for .mp4. Use ffprobe (part of ffmpeg) to get the time in seconds, e.g:ffprobe -v quiet -of csv=p=0 -show_entries format=duration Inception.mp4 275.690000so for all .mp4 files in the current dir:find . -maxdepth 1 -iname '*.mp4' -exec ffprobe -v quiet -of csv=p=0 -show_entries format=duration {} \;149.233333130.146667275.690000then use paste to pass the output to bc and get the total time in seconds:find . -maxdepth 1 -iname '*.mp4' -exec ffprobe -v quiet -of csv=p=0 -show_entries format=duration {} \; | paste -sd+ -| bc555.070000So, for .ts files you could try:find . -maxdepth 1 -iname '*.ts' -exec ffprobe -v quiet -of csv=p=0 -show_entries format=duration {} \; | paste -sd+ -| bcAnother tool that works for the video files I have here is exiftool, e.g.:exiftool -S -n Inception.mp4 | grep ^DurationDuration: 275.69exiftool -q -p '$Duration#' Inception.mp4275.69Total length for all .mp4 files in the current directory:exiftool -S -n ./*.mp4 | awk '/^Duration/ {print $2}' | paste -sd+ -| bc555.070000000000exiftool -q -p '$Duration#' ./*.mp4 | awk '{sum += $0}; END{print sum}'555.070000000000You could also pipe the output to another command to convert the total to DD:HH:MM:SS, see the answers here.Or use exiftool's internal ConvertDuration for that (you need a relatively recent version though):exiftool -n -q -p '${Duration;our $sum;$_=ConvertDuration($sum+=$_)                    }' ./*.mp4| tail -n10:09:15