From 58065a91aadd74ab3426b76e40d4f6d1cb630b6f Mon Sep 17 00:00:00 2001 From: Taner Sener Date: Tue, 20 Sep 2022 00:15:28 +0100 Subject: [PATCH] print muxing overhead in a single line --- .../src/main/cpp/fftools_ffmpeg.c | 17 ++++++++++------- apple/src/fftools_ffmpeg.c | 17 ++++++++++------- linux/src/fftools_ffmpeg.c | 17 ++++++++++------- 3 files changed, 30 insertions(+), 21 deletions(-) diff --git a/android/ffmpeg-kit-android-lib/src/main/cpp/fftools_ffmpeg.c b/android/ffmpeg-kit-android-lib/src/main/cpp/fftools_ffmpeg.c index c3bdc67..7f4cab3 100644 --- a/android/ffmpeg-kit-android-lib/src/main/cpp/fftools_ffmpeg.c +++ b/android/ffmpeg-kit-android-lib/src/main/cpp/fftools_ffmpeg.c @@ -37,6 +37,7 @@ * - volatile dropped from thread local variables * - setvbuf call dropped * - flushing stderr dropped + * - muxing overhead printed in single line * * 08.2020 * -------------------------------------------------------- @@ -1531,6 +1532,7 @@ static void print_final_stats(int64_t total_size) float percent = -1.0; int i, j; int pass1_used = 1; + char percentString[50] = {0}; for (i = 0; i < nb_output_streams; i++) { OutputStream *ost = output_streams[i]; @@ -1550,17 +1552,18 @@ static void print_final_stats(int64_t total_size) if (data_size && total_size>0 && total_size >= data_size) percent = 100.0 * (total_size - data_size) / data_size; - av_log(NULL, AV_LOG_INFO, "video:%1.0fkB audio:%1.0fkB subtitle:%1.0fkB other streams:%1.0fkB global headers:%1.0fkB muxing overhead: ", + if (percent >= 0.0) + sprintf(percentString, "%f%%", percent); + else + sprintf(percentString, "unknown"); + + av_log(NULL, AV_LOG_INFO, "video:%1.0fkB audio:%1.0fkB subtitle:%1.0fkB other streams:%1.0fkB global headers:%1.0fkB muxing overhead: %s\n", video_size / 1024.0, audio_size / 1024.0, subtitle_size / 1024.0, other_size / 1024.0, - extra_size / 1024.0); - if (percent >= 0.0) - av_log(NULL, AV_LOG_INFO, "%f%%", percent); - else - av_log(NULL, AV_LOG_INFO, "unknown"); - av_log(NULL, AV_LOG_INFO, "\n"); + extra_size / 1024.0, + percentString); /* print verbose per-stream stats */ for (i = 0; i < nb_input_files; i++) { diff --git a/apple/src/fftools_ffmpeg.c b/apple/src/fftools_ffmpeg.c index c3bdc67..7f4cab3 100644 --- a/apple/src/fftools_ffmpeg.c +++ b/apple/src/fftools_ffmpeg.c @@ -37,6 +37,7 @@ * - volatile dropped from thread local variables * - setvbuf call dropped * - flushing stderr dropped + * - muxing overhead printed in single line * * 08.2020 * -------------------------------------------------------- @@ -1531,6 +1532,7 @@ static void print_final_stats(int64_t total_size) float percent = -1.0; int i, j; int pass1_used = 1; + char percentString[50] = {0}; for (i = 0; i < nb_output_streams; i++) { OutputStream *ost = output_streams[i]; @@ -1550,17 +1552,18 @@ static void print_final_stats(int64_t total_size) if (data_size && total_size>0 && total_size >= data_size) percent = 100.0 * (total_size - data_size) / data_size; - av_log(NULL, AV_LOG_INFO, "video:%1.0fkB audio:%1.0fkB subtitle:%1.0fkB other streams:%1.0fkB global headers:%1.0fkB muxing overhead: ", + if (percent >= 0.0) + sprintf(percentString, "%f%%", percent); + else + sprintf(percentString, "unknown"); + + av_log(NULL, AV_LOG_INFO, "video:%1.0fkB audio:%1.0fkB subtitle:%1.0fkB other streams:%1.0fkB global headers:%1.0fkB muxing overhead: %s\n", video_size / 1024.0, audio_size / 1024.0, subtitle_size / 1024.0, other_size / 1024.0, - extra_size / 1024.0); - if (percent >= 0.0) - av_log(NULL, AV_LOG_INFO, "%f%%", percent); - else - av_log(NULL, AV_LOG_INFO, "unknown"); - av_log(NULL, AV_LOG_INFO, "\n"); + extra_size / 1024.0, + percentString); /* print verbose per-stream stats */ for (i = 0; i < nb_input_files; i++) { diff --git a/linux/src/fftools_ffmpeg.c b/linux/src/fftools_ffmpeg.c index c3bdc67..7f4cab3 100644 --- a/linux/src/fftools_ffmpeg.c +++ b/linux/src/fftools_ffmpeg.c @@ -37,6 +37,7 @@ * - volatile dropped from thread local variables * - setvbuf call dropped * - flushing stderr dropped + * - muxing overhead printed in single line * * 08.2020 * -------------------------------------------------------- @@ -1531,6 +1532,7 @@ static void print_final_stats(int64_t total_size) float percent = -1.0; int i, j; int pass1_used = 1; + char percentString[50] = {0}; for (i = 0; i < nb_output_streams; i++) { OutputStream *ost = output_streams[i]; @@ -1550,17 +1552,18 @@ static void print_final_stats(int64_t total_size) if (data_size && total_size>0 && total_size >= data_size) percent = 100.0 * (total_size - data_size) / data_size; - av_log(NULL, AV_LOG_INFO, "video:%1.0fkB audio:%1.0fkB subtitle:%1.0fkB other streams:%1.0fkB global headers:%1.0fkB muxing overhead: ", + if (percent >= 0.0) + sprintf(percentString, "%f%%", percent); + else + sprintf(percentString, "unknown"); + + av_log(NULL, AV_LOG_INFO, "video:%1.0fkB audio:%1.0fkB subtitle:%1.0fkB other streams:%1.0fkB global headers:%1.0fkB muxing overhead: %s\n", video_size / 1024.0, audio_size / 1024.0, subtitle_size / 1024.0, other_size / 1024.0, - extra_size / 1024.0); - if (percent >= 0.0) - av_log(NULL, AV_LOG_INFO, "%f%%", percent); - else - av_log(NULL, AV_LOG_INFO, "unknown"); - av_log(NULL, AV_LOG_INFO, "\n"); + extra_size / 1024.0, + percentString); /* print verbose per-stream stats */ for (i = 0; i < nb_input_files; i++) {