Ubuntu – How to check how long a video (mp4) is using the shell

.mp4bashcommand linescriptsvideo

I need to ftp upload all the mp4 files in a directory with length > 4 minutes using the shell. I can't find any script to check how long a video is. Does anybody have any idea how to do that?

Thank you very much!

Best Answer

This will give you the length of a video.

ffmpeg -i myvideo 2>&1 | grep Duration | cut -d ' ' -f 4 | sed s/,//