If you have ffmpeg, you should also have ffprobe. It outputs information to STDOUT in a series of key=value pairs, and gives the duration in seconds by default (you have to use the -sexagesimal
option if you want hh:mm:ss):
ffprobe -show_format file.mp4 | grep -F duration | cut -d= -f2