aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2023-03-28 10:43:49 +0200
committerAnton Khirnov <anton@khirnov.net>2023-04-13 15:11:56 +0200
commit3b6b0d1afb4b19e34f2b4732137118482b5b9ec0 (patch)
tree2fca1ae07fcd0265edd0f28843622eaca4ed44ec
parent79e136f14b4f2ef9afdc5cf81fb15f0a4cec0950 (diff)
downloadffmpeg-3b6b0d1afb4b19e34f2b4732137118482b5b9ec0.tar.gz
fftools/ffmpeg: move printing verbose muxing stats to ffmpeg_mux
This is a more appropriate place for this.
-rw-r--r--fftools/ffmpeg.c34
-rw-r--r--fftools/ffmpeg_mux.c37
2 files changed, 37 insertions, 34 deletions
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 48e771cbc5..e1748114b3 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -809,40 +809,6 @@ static void print_final_stats(int64_t total_size)
av_log(NULL, AV_LOG_VERBOSE, " Total: %"PRIu64" packets (%"PRIu64" bytes) demuxed\n",
total_packets, total_size);
}
-
- for (i = 0; i < nb_output_files; i++) {
- OutputFile *of = output_files[i];
- uint64_t total_packets = 0, total_size = 0;
-
- av_log(NULL, AV_LOG_VERBOSE, "Output file #%d (%s):\n",
- i, of->url);
-
- for (j = 0; j < of->nb_streams; j++) {
- OutputStream *ost = of->streams[j];
- enum AVMediaType type = ost->st->codecpar->codec_type;
-
- total_size += ost->data_size_mux;
- total_packets += atomic_load(&ost->packets_written);
-
- av_log(NULL, AV_LOG_VERBOSE, " Output stream #%d:%d (%s): ",
- i, j, av_get_media_type_string(type));
- if (ost->enc_ctx) {
- av_log(NULL, AV_LOG_VERBOSE, "%"PRIu64" frames encoded",
- ost->frames_encoded);
- if (type == AVMEDIA_TYPE_AUDIO)
- av_log(NULL, AV_LOG_VERBOSE, " (%"PRIu64" samples)", ost->samples_encoded);
- av_log(NULL, AV_LOG_VERBOSE, "; ");
- }
-
- av_log(NULL, AV_LOG_VERBOSE, "%"PRIu64" packets muxed (%"PRIu64" bytes); ",
- atomic_load(&ost->packets_written), ost->data_size_mux);
-
- av_log(NULL, AV_LOG_VERBOSE, "\n");
- }
-
- av_log(NULL, AV_LOG_VERBOSE, " Total: %"PRIu64" packets (%"PRIu64" bytes) muxed\n",
- total_packets, total_size);
- }
}
static void print_report(int is_last_report, int64_t timer_start, int64_t cur_time)
diff --git a/fftools/ffmpeg_mux.c b/fftools/ffmpeg_mux.c
index 9a91861bd4..5acd3b9b9d 100644
--- a/fftools/ffmpeg_mux.c
+++ b/fftools/ffmpeg_mux.c
@@ -637,6 +637,41 @@ static int check_written(OutputFile *of)
return ret;
}
+static void mux_final_stats(Muxer *mux)
+{
+ OutputFile *of = &mux->of;
+ uint64_t total_packets = 0, total_size = 0;
+
+ av_log(NULL, AV_LOG_VERBOSE, "Output file #%d (%s):\n",
+ of->index, of->url);
+
+ for (int j = 0; j < of->nb_streams; j++) {
+ OutputStream *ost = of->streams[j];
+ enum AVMediaType type = ost->st->codecpar->codec_type;
+
+ total_size += ost->data_size_mux;
+ total_packets += atomic_load(&ost->packets_written);
+
+ av_log(NULL, AV_LOG_VERBOSE, " Output stream #%d:%d (%s): ",
+ of->index, j, av_get_media_type_string(type));
+ if (ost->enc_ctx) {
+ av_log(NULL, AV_LOG_VERBOSE, "%"PRIu64" frames encoded",
+ ost->frames_encoded);
+ if (type == AVMEDIA_TYPE_AUDIO)
+ av_log(NULL, AV_LOG_VERBOSE, " (%"PRIu64" samples)", ost->samples_encoded);
+ av_log(NULL, AV_LOG_VERBOSE, "; ");
+ }
+
+ av_log(NULL, AV_LOG_VERBOSE, "%"PRIu64" packets muxed (%"PRIu64" bytes); ",
+ atomic_load(&ost->packets_written), ost->data_size_mux);
+
+ av_log(NULL, AV_LOG_VERBOSE, "\n");
+ }
+
+ av_log(NULL, AV_LOG_VERBOSE, " Total: %"PRIu64" packets (%"PRIu64" bytes) muxed\n",
+ total_packets, total_size);
+}
+
int of_write_trailer(OutputFile *of)
{
Muxer *mux = mux_from_of(of);
@@ -668,6 +703,8 @@ int of_write_trailer(OutputFile *of)
}
}
+ mux_final_stats(mux);
+
// check whether anything was actually written
ret = check_written(of);
mux_result = err_merge(mux_result, ret);