I have a bash script that reads video files in a directory and outputs information into a .csv. The only problem I have at this point is that when I export the duration of all video files in HH:MM:SS format it cuts off the seconds for any duration over an hour so my output looks like 1:25: instead of 1:25:34. Anything under an hour outputs correctly. I know that it is not the .csv part because I put into a temporary .txt file first and it is incorrect in that .txt.
Here's what isn't working:
mediainfo $file_name > tmp_file
DURATION=`grep "Duration " tmp_file |head -n1 |sed -E 's/ //g;s/Duration://g;s/([0-9]*)ms//g;s/(([0-9]*)h)*(([0-9]*)mn)*(([0-9]*)s)*/\2:\4:\6/g;s/::/:0:/g;s/^:/0:/g'`