ffmpeg progress
| #! /usr/bin/env gawk | |
| function seconds(h, m, s) { | |
| return h * 3600 + m * 60 + s | |
| } | |
| BEGIN { | |
| RS = "[\r\n]" | |
| } | |
| /^\[/ { | |
| print $0 | |
| } | |
| match($0, /^ Duration: (\w+):(\w+):(\w+)/, m) { | |
| duration = seconds(m[1], m[2], m[3]) | |
| } | |
| match($0, /^frame=.*time=(\w+):(\w+):(\w+)/, m) { | |
| if (!duration) { | |
| printf("%s\r", $0) | |
| } else { | |
| progress = seconds(m[1], m[2], m[3]) / duration * 100 | |
| printf("%d%%\r", progress) | |
| } | |
| } | |
| /^video:/ { | |
| print "" | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment