summaryrefslogtreecommitdiff
path: root/ffmpeg.c
diff options
context:
space:
mode:
authorMoritz Barsnick <barsnick@gmx.net>2015-12-11 16:49:14 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2015-12-17 02:17:02 +0100
commit9d1fb9ef313e0fb709ac4c35c7bf00264963fd85 (patch)
tree6328ff29074515cef85f86ca425cc1bd5ed93e74 /ffmpeg.c
parent6ea7dd25c773145b50eed55c2059647bb086aaca (diff)
ffmpeg: add progress speed to status line and report
This adds a computation of the progress speed versus realtime ("Nx") to the status line and to the report log. It uses the progress time as already calculated for total output time as a base. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'ffmpeg.c')
-rw-r--r--ffmpeg.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index 6ff45d98c0..a3c8922564 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1533,10 +1533,12 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti
AVCodecContext *enc;
int frame_number, vid, i;
double bitrate;
+ double speed;
int64_t pts = INT64_MIN + 1;
static int64_t last_time = -1;
static int qp_histogram[52];
int hours, mins, secs, us;
+ float t;
if (!print_stats && !is_last_report && !progress_avio)
return;
@@ -1551,6 +1553,8 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti
last_time = cur_time;
}
+ t = (cur_time-timer_start) / 1000000.0;
+
oc = output_files[0]->ctx;
@@ -1574,7 +1578,7 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti
ost->file_index, ost->index, q);
}
if (!vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) {
- float fps, t = (cur_time-timer_start) / 1000000.0;
+ float fps;
frame_number = ost->frame_number;
fps = t > 1 ? frame_number / t : 0;
@@ -1642,6 +1646,7 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti
mins %= 60;
bitrate = pts && total_size >= 0 ? total_size * 8 / (pts / 1000.0) : -1;
+ speed = t != 0.0 ? (double)pts / AV_TIME_BASE / t : -1;
if (total_size < 0) snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
"size=N/A time=");
@@ -1673,6 +1678,14 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti
av_bprintf(&buf_script, "dup_frames=%d\n", nb_frames_dup);
av_bprintf(&buf_script, "drop_frames=%d\n", nb_frames_drop);
+ if (speed < 0) {
+ snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf)," speed=N/A");
+ av_bprintf(&buf_script, "speed=N/A\n");
+ } else {
+ snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf)," speed=%4.3gx", speed);
+ av_bprintf(&buf_script, "speed=%4.3gx\n", speed);
+ }
+
if (print_stats || is_last_report) {
const char end = is_last_report ? '\n' : '\r';
if (print_stats==1 && AV_LOG_INFO > av_log_get_level()) {