Created
February 1, 2015 04:11
-
-
Save hilbix/97af7e815b40bd395530 to your computer and use it in GitHub Desktop.
Print runtime length of a video (and number of estimated frames)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| avcheck() | |
| { | |
| avprobe "$1" -show_packets 2>/dev/null | | |
| awk -F'=' -vN="$1" ' | |
| /^\[/ { if (arm && k["codec_type"]=="video") { last=k["dts_time"]; # printf "%s", k["flags"]; | |
| }; delete k; arm=1; next; } | |
| arm { k[$1]=$2; } | |
| $0=="codec_type=video" { frames++; } | |
| END { printf("%-40s %d:%02d:%02d %s\n", N, last/3600, last/60%60, last%60, frames); }' | |
| } | |
| for a | |
| do | |
| avcheck "$a" | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment