by abdusco · 3y ago · 0 comments
Also, you might wanna limit concurrency[0] instead of spawning many ffprobe instances at the ~same time.
[0]: https://github.com/sourcegraph/conc
In another note, ChatGPT suggests this shell command to do the same thing. It doesn't process files in parallel though.
find . -name "*.mp4" -print0 | \
xargs -0 -I {} ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 {} | \
awk '{sum += $1} END {print sum}'Although I seriously doubt data hoarders care about that. A movie will be eventually watched someday. If they run out of space, they'll get another drive. Storage is cheap.
You wanna know how long will it take you to finish that lecture playlist you just downloaded. You're a teacher and want to show some videos but you're limited in time. You want to know how many hours of music you've got.
find . -type f -print0 | \
xargs -0 -I {} ffprobe -v quiet -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 {} | \
awk '{s += $1} END {printf "%d:%.2d:%.2d\n", s/3600, s%3600/60, s%3600%60}'