Suppose we have video file some_video.
How to get length of it from a shell script (with mplayer/transcode/gstreamer/vlc/ffmpeg/whatever)?
VIDEO_LENGTH_IN_SECONDS=`ffmpeg .... -i some_video ... | grep -o .....`
will return the video duration in seconds.
Something similar to:
This will deliver:
To convert into seconds (and retain the milliseconds), pipe into:
To convert it into milliseconds, pipe into:
If you want just the seconds without the milliseconds, pipe into: