Get the Total Time of Videos in a Directory
Say you have a directory of videos going to stream using OBS. You may want to sync them to the actual time to provide a guide of what is playing and will be coming up. You need to have ffmpeg installed to use ffprobe.
Add the videos to a directory. Then run this little bash script to get the total time in seconds:
for f in ./*.webm
do ffprobe -v quiet -of csv=p=0 -show_entries format=duration "$f"
done | awk '{sum += $1}; END{print sum}'
The above example is only getting times for .webm
videos. If you have a variety of video file types can use the wildcard *
to get all.
Follow me on Twitter