The MPEG file format has no index or length information embedded. This makes it impossible to know the playing time of the file.
This program will scan a MPEG file and count the number of GOPs and frames. When combined with another tool which reports framerate information, like mpginfo, the exact playing time can be calculated.
usage: mpglen [-a] [-c size] [-d] [-e] [-f] [-g] [-h] [-p] [-t] file [file] ... -a show n total for all files processed as "Total #frames #GOPs\n". -c size process file(s) in chunks of <size> Mb. (Default 4) -d emit debugging messages on stderr. -e easily parseable output "#frames #GOPs filename\n". -f only print "#frames\n". -g only print "#GOPs\n". -p emit progress report as each chunk is processed. -t terse output, only prints "#frames #GOPs\n". -h show this usage message. Setting -d as the first argument will show argument parsing, too. If you use -s, the exit code will report success(0) or failure(-1) Exit codes: 0=Success -1=Parse error -2=m[un]map error -3=Other