![Get total duration of video files in a directory in hours](https://linux22.com/image/183744/Get%20total%20duration%20of%20video%20files%20in%20a%20directory%20in%20hours%20.png)
Based from: Get total duration of video files in a directory
But I need my output to be in hours. Been trying for some time to make this one line output to hours:
find . -maxdepth 1 -exec ffprobe -v quiet -of csv=p=0 -show_entries format=duration {} \; | paste -sd+ -| bc
Any help? Hope it's not a duplicate because all the answer there only output in seconds which is bad and I don't have hope anyone will add to that question anymore
答案1
答案2
That boils down to how to divide a number from the output of a command by 3600.
Which you could do with:
... | awk '{print $0 / 3600}'
Though here, you can do the whole thing with:
exiftool -r -n -q -p '${Duration;$_ = (our $total += $_) / 3600}' . | tail -n 1
(or $_ = ConvertDuration(our $total += $_)
to express it like 4 days 22:14:59
).