Re: [FFmpeg-devel] [PATCH] ffmpeg.c: add an option "detail_stats" to allow ffmpeg to output stats for each stream
On Mon, Nov 12, 2018 at 01:10:55PM -0800, Wang Cao wrote: > Friendly ping! i tried the code and for example -i matrixbench_mpeg2.mpg -map 0:a -map 0:a -map 0:a -map 0:a -map 0:v -map 0:v test.nut -map 0:a -map 0:a -map 0:v -map 0:a -map 0:v -map 0:v test2.nut generates when i stop it: cpb: bitrate max/min/avg: 0/0/20 buffer size: 0 vbv_delay: -1 [nut @ 0x3b419c0] Multiple keyframes with same PTSts/s speed=5.42x Last message repeated 6 times [nut @ 0x3b5abc0] Multiple keyframes with same PTS Last message repeated 271 times size=5285kB time=00:00:44.56 bitrate= 971.6kbits/s speed=5.39x size=5285kB time=00:00:44.56 bitrate= 971.6kbits/s speed=5.39x size=5285kB time=00:00:44.56 bitrate= 971.6kbits/s speed=5.39x size=5285kB time=00:00:44.56 bitrate= 971.6kbits/s speed=5.39x q=31.0 frame= 1115 fps=135 q=31.0 Lsize=5285kB time=00:00:44.56 bitrate= 971.6kbits/s speed=5.39x q=31.0 frame= 1115 fps=135 q=31.0 Lsize=5285kB time=00:00:44.56 bitrate= 971.6kbits/s speed=5.39x size=6285kB time=00:00:44.56 bitrate=1155.5kbits/s speed=5.39x size=6285kB time=00:00:44.56 bitrate=1155.5kbits/s speed=5.39x q=31.0 frame= 1115 fps=135 q=31.0 Lsize=6285kB time=00:00:44.56 bitrate=1155.5kbits/s speed=5.39x size=6285kB time=00:00:44.56 bitrate=1155.5kbits/s speed=5.39x q=31.0 frame= 1115 fps=135 q=31.0 Lsize=6285kB time=00:00:44.56 bitrate=1155.5kbits/s speed=5.39x q=31.0 frame= 1115 fps=135 q=31.0 Lsize=6285kB time=00:00:44.56 bitrate=1155.5kbits/s speed=5.39x video:3083kB audio:2147kB subtitle:0kB other streams:0kB global headers:16kB muxing overhead: 1.048231% video:4625kB audio:1610kB subtitle:0kB other streams:0kB global headers:12kB muxing overhead: 0.803826% Its not easy to read this and know which line represents which stream also this is the same audio stream stored 7 times yet the statistics look nonsensical, one would expect 7 identical bitrates and in fact not 971kbit/sec for a vorbis audio stream with default encoding parameters [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If you fake or manipulate statistics in a paper in physics you will never get a job again. If you fake or manipulate statistics in a paper in medicin you will get a job for life at the pharma industry. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] ffmpeg.c: add an option "detail_stats" to allow ffmpeg to output stats for each stream
Friendly ping! On Tue, Oct 16, 2018 at 3:39 PM Wang Cao wrote: > From: Wang Cao > > - Add an option "detail_stats" to ffmpeg to output stats for each > video/audio streams and each ouptut file ffmpeg output log in print_report. > - Make print_final_stats only output stats for one output instead of > aggregate stats. > > Signed-off-by: Wang Cao > --- > When creating multiple outputs, the original was to aggregate size of > all output files together and I find this may not be intuitive to > users and choose to output the stats for the first output file instead. > Using -detail_stats to ouptut stats for other output files. > > doc/ffmpeg.texi | 4 +++ > fftools/ffmpeg.c | 72 +++- > fftools/ffmpeg.h | 1 + > fftools/ffmpeg_opt.c | 4 ++- > 4 files changed, 59 insertions(+), 22 deletions(-) > > diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi > index 3717f22d42..53a5be9791 100644 > --- a/doc/ffmpeg.texi > +++ b/doc/ffmpeg.texi > @@ -1623,6 +1623,10 @@ rtp stream. (Requires at least one of the output > formats to be rtp). > Allows discarding specific streams or frames of streams at the demuxer. > Not all demuxers support this. > > +@item -detail_stats (@emph{global}) > +Allows printing stats for each output stream and output file at the end of > +processing. > + > @table @option > @item none > Discard no frame. > diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c > index da4259a9a8..7286e75c36 100644 > --- a/fftools/ffmpeg.c > +++ b/fftools/ffmpeg.c > @@ -1530,17 +1530,31 @@ static int reap_filters(int flush) > return 0; > } > > -static void print_final_stats(int64_t total_size) > +static void print_final_stats() > { > uint64_t video_size = 0, audio_size = 0, extra_size = 0, other_size = > 0; > uint64_t subtitle_size = 0; > uint64_t data_size = 0; > +int64_t total_size; > float percent = -1.0; > int i, j; > int pass1_used = 1; > - > -for (i = 0; i < nb_output_streams; i++) { > +int nb_display_streams = 0; > +AVFormatContext *oc; > + > +if (nb_output_streams > 0) { > +nb_display_streams = enable_detail_stats ? nb_output_streams : 1; > +} > +for (i = 0; i < nb_display_streams; i++) { > OutputStream *ost = output_streams[i]; > +if (i > 0 && ost->file_index != output_streams[i-1]->file_index) { > +video_size = 0; > +audio_size = 0; > +extra_size = 0; > +other_size = 0; > +subtitle_size = 0; > +data_size = 0; > +} > switch (ost->enc_ctx->codec_type) { > case AVMEDIA_TYPE_VIDEO: video_size += ost->data_size; break; > case AVMEDIA_TYPE_AUDIO: audio_size += ost->data_size; break; > @@ -1552,7 +1566,13 @@ static void print_final_stats(int64_t total_size) > if ( (ost->enc_ctx->flags & (AV_CODEC_FLAG_PASS1 | > AV_CODEC_FLAG_PASS2)) > != AV_CODEC_FLAG_PASS1) > pass1_used = 0; > -} > + > +// Print stats for each output file. > +if (i == nb_display_streams-1 || ost->file_index != > output_streams[i+1]->file_index) { > +oc = output_files[ost->file_index]->ctx; > +total_size = avio_size(oc->pb); > +if (total_size <= 0) // FIXME improve avio_size() so it works > with non seekable output too > +total_size = avio_tell(oc->pb); > > if (data_size && total_size>0 && total_size >= data_size) > percent = 100.0 * (total_size - data_size) / data_size; > @@ -1568,6 +1588,8 @@ static void print_final_stats(int64_t total_size) > else > av_log(NULL, AV_LOG_INFO, "unknown"); > av_log(NULL, AV_LOG_INFO, "\n"); > +} > +} > > /* print verbose per-stream stats */ > for (i = 0; i < nb_input_files; i++) { > @@ -1680,16 +1702,18 @@ static void print_report(int is_last_report, > int64_t timer_start, int64_t cur_ti > > t = (cur_time-timer_start) / 100.0; > > - > -oc = output_files[0]->ctx; > - > -total_size = avio_size(oc->pb); > -if (total_size <= 0) // FIXME improve avio_size() so it works with > non seekable output too > -total_size = avio_tell(oc->pb); > - > vid = 0; > av_bprint_init(&buf, 0, AV_BPRINT_SIZE_AUTOMATIC); > av_bprint_init(&buf_script, 0, AV_BPRINT_SIZE_AUTOMATIC); > + > +/* need to collect final pts upfront because final stats depend on > pts*/ > +for (i = 0; i < nb_output_streams; i++) { > +ost = output_streams[i]; > +/* compute min output value */ > +if (av_stream_get_end_pts(ost->st) != AV_NOPTS_VALUE) > +pts = FFMAX(pts, av_rescale_q(av_stream_get_end_pts(ost->st), > + ost->st->time_base, > AV_TIME_BASE_Q)); > +} > for (i = 0; i < nb_output_streams; i++) { > float q = -1; > ost = output_streams[i]; > @@ -1697,12 +1721,14 @@ static void print_report(in
[FFmpeg-devel] [PATCH] ffmpeg.c: add an option "detail_stats" to allow ffmpeg to output stats for each stream
From: Wang Cao - Add an option "detail_stats" to ffmpeg to output stats for each video/audio streams and each ouptut file ffmpeg output log in print_report. - Make print_final_stats only output stats for one output instead of aggregate stats. Signed-off-by: Wang Cao --- When creating multiple outputs, the original was to aggregate size of all output files together and I find this may not be intuitive to users and choose to output the stats for the first output file instead. Using -detail_stats to ouptut stats for other output files. doc/ffmpeg.texi | 4 +++ fftools/ffmpeg.c | 72 +++- fftools/ffmpeg.h | 1 + fftools/ffmpeg_opt.c | 4 ++- 4 files changed, 59 insertions(+), 22 deletions(-) diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index 3717f22d42..53a5be9791 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -1623,6 +1623,10 @@ rtp stream. (Requires at least one of the output formats to be rtp). Allows discarding specific streams or frames of streams at the demuxer. Not all demuxers support this. +@item -detail_stats (@emph{global}) +Allows printing stats for each output stream and output file at the end of +processing. + @table @option @item none Discard no frame. diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index da4259a9a8..7286e75c36 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -1530,17 +1530,31 @@ static int reap_filters(int flush) return 0; } -static void print_final_stats(int64_t total_size) +static void print_final_stats() { uint64_t video_size = 0, audio_size = 0, extra_size = 0, other_size = 0; uint64_t subtitle_size = 0; uint64_t data_size = 0; +int64_t total_size; float percent = -1.0; int i, j; int pass1_used = 1; - -for (i = 0; i < nb_output_streams; i++) { +int nb_display_streams = 0; +AVFormatContext *oc; + +if (nb_output_streams > 0) { +nb_display_streams = enable_detail_stats ? nb_output_streams : 1; +} +for (i = 0; i < nb_display_streams; i++) { OutputStream *ost = output_streams[i]; +if (i > 0 && ost->file_index != output_streams[i-1]->file_index) { +video_size = 0; +audio_size = 0; +extra_size = 0; +other_size = 0; +subtitle_size = 0; +data_size = 0; +} switch (ost->enc_ctx->codec_type) { case AVMEDIA_TYPE_VIDEO: video_size += ost->data_size; break; case AVMEDIA_TYPE_AUDIO: audio_size += ost->data_size; break; @@ -1552,7 +1566,13 @@ static void print_final_stats(int64_t total_size) if ( (ost->enc_ctx->flags & (AV_CODEC_FLAG_PASS1 | AV_CODEC_FLAG_PASS2)) != AV_CODEC_FLAG_PASS1) pass1_used = 0; -} + +// Print stats for each output file. +if (i == nb_display_streams-1 || ost->file_index != output_streams[i+1]->file_index) { +oc = output_files[ost->file_index]->ctx; +total_size = avio_size(oc->pb); +if (total_size <= 0) // FIXME improve avio_size() so it works with non seekable output too +total_size = avio_tell(oc->pb); if (data_size && total_size>0 && total_size >= data_size) percent = 100.0 * (total_size - data_size) / data_size; @@ -1568,6 +1588,8 @@ static void print_final_stats(int64_t total_size) else av_log(NULL, AV_LOG_INFO, "unknown"); av_log(NULL, AV_LOG_INFO, "\n"); +} +} /* print verbose per-stream stats */ for (i = 0; i < nb_input_files; i++) { @@ -1680,16 +1702,18 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti t = (cur_time-timer_start) / 100.0; - -oc = output_files[0]->ctx; - -total_size = avio_size(oc->pb); -if (total_size <= 0) // FIXME improve avio_size() so it works with non seekable output too -total_size = avio_tell(oc->pb); - vid = 0; av_bprint_init(&buf, 0, AV_BPRINT_SIZE_AUTOMATIC); av_bprint_init(&buf_script, 0, AV_BPRINT_SIZE_AUTOMATIC); + +/* need to collect final pts upfront because final stats depend on pts*/ +for (i = 0; i < nb_output_streams; i++) { +ost = output_streams[i]; +/* compute min output value */ +if (av_stream_get_end_pts(ost->st) != AV_NOPTS_VALUE) +pts = FFMAX(pts, av_rescale_q(av_stream_get_end_pts(ost->st), + ost->st->time_base, AV_TIME_BASE_Q)); +} for (i = 0; i < nb_output_streams; i++) { float q = -1; ost = output_streams[i]; @@ -1697,12 +1721,14 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti if (!ost->stream_copy) q = ost->quality / (float) FF_QP2LAMBDA; -if (vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) { +if (is_last_report && vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) { av_bprintf(&
Re: [FFmpeg-devel] [PATCH] ffmpeg.c: add an option "detail_stats" to allow ffmpeg to output stats for each stream
On Mon, Aug 27, 2018 at 11:48:46PM -0700, Wang Cao wrote: > From: Wang Cao > > Add an option "detail_stats" to ffmpeg to output stats for each video/audio > streams and each ouptut file ffmpeg output log in print_report. The format of > stats is unchanged. this changes -progress output ./ffmpeg -progress progress -i mm-small-short.mp4 -f null - stream_0_0_q=-0.0 bitrate=N/A total_size=N/A -out_time_us=1002667 -out_time_ms=1002667 -out_time=00:00:01.002667 +out_time_us=100 +out_time_ms=100 +out_time=00:00:01.00 dup_frames=0 drop_frames=0 [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If you fake or manipulate statistics in a paper in physics you will never get a job again. If you fake or manipulate statistics in a paper in medicin you will get a job for life at the pharma industry. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] ffmpeg.c: add an option "detail_stats" to allow ffmpeg to output stats for each stream
From: Wang Cao Add an option "detail_stats" to ffmpeg to output stats for each video/audio streams and each ouptut file ffmpeg output log in print_report. The format of stats is unchanged. Signed-off-by: Wang Cao --- Run after "make fate" and all tests passed. doc/ffmpeg.texi | 4 fftools/ffmpeg.c | 56 +++- fftools/ffmpeg.h | 1 + fftools/ffmpeg_opt.c | 4 +++- 4 files changed, 48 insertions(+), 17 deletions(-) diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index 3717f22d42..53a5be9791 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -1623,6 +1623,10 @@ rtp stream. (Requires at least one of the output formats to be rtp). Allows discarding specific streams or frames of streams at the demuxer. Not all demuxers support this. +@item -detail_stats (@emph{global}) +Allows printing stats for each output stream and output file at the end of +processing. + @table @option @item none Discard no frame. diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 2459374f08..c268be20d4 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -1530,17 +1530,31 @@ static int reap_filters(int flush) return 0; } -static void print_final_stats(int64_t total_size) +static void print_final_stats() { uint64_t video_size = 0, audio_size = 0, extra_size = 0, other_size = 0; uint64_t subtitle_size = 0; uint64_t data_size = 0; +int64_t total_size; float percent = -1.0; int i, j; int pass1_used = 1; - -for (i = 0; i < nb_output_streams; i++) { +int nb_display_streams = 0; +AVFormatContext *oc; + +if (nb_output_streams > 0) { +nb_display_streams = enable_detail_stats ? nb_output_streams : 1; +} +for (i = 0; i < nb_display_streams; i++) { OutputStream *ost = output_streams[i]; +if (i > 0 && ost->file_index != output_streams[i-1]->file_index) { +video_size = 0; +audio_size = 0; +extra_size = 0; +other_size = 0; +subtitle_size = 0; +data_size = 0; +} switch (ost->enc_ctx->codec_type) { case AVMEDIA_TYPE_VIDEO: video_size += ost->data_size; break; case AVMEDIA_TYPE_AUDIO: audio_size += ost->data_size; break; @@ -1552,7 +1566,13 @@ static void print_final_stats(int64_t total_size) if ( (ost->enc_ctx->flags & (AV_CODEC_FLAG_PASS1 | AV_CODEC_FLAG_PASS2)) != AV_CODEC_FLAG_PASS1) pass1_used = 0; -} + +// Print stats for each output file. +if (i == nb_output_streams-1 || ost->file_index != output_streams[i+1]->file_index) { +oc = output_files[ost->file_index]->ctx; +total_size = avio_size(oc->pb); +if (total_size <= 0) // FIXME improve avio_size() so it works with non seekable output too +total_size = avio_tell(oc->pb); if (data_size && total_size>0 && total_size >= data_size) percent = 100.0 * (total_size - data_size) / data_size; @@ -1568,6 +1588,8 @@ static void print_final_stats(int64_t total_size) else av_log(NULL, AV_LOG_INFO, "unknown"); av_log(NULL, AV_LOG_INFO, "\n"); +} +} /* print verbose per-stream stats */ for (i = 0; i < nb_input_files; i++) { @@ -1680,13 +1702,6 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti t = (cur_time-timer_start) / 100.0; - -oc = output_files[0]->ctx; - -total_size = avio_size(oc->pb); -if (total_size <= 0) // FIXME improve avio_size() so it works with non seekable output too -total_size = avio_tell(oc->pb); - vid = 0; av_bprint_init(&buf, 0, AV_BPRINT_SIZE_AUTOMATIC); av_bprint_init(&buf_script, 0, AV_BPRINT_SIZE_AUTOMATIC); @@ -1697,12 +1712,14 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti if (!ost->stream_copy) q = ost->quality / (float) FF_QP2LAMBDA; -if (vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) { +if (is_last_report && vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) { av_bprintf(&buf, "q=%2.1f ", q); av_bprintf(&buf_script, "stream_%d_%d_q=%.1f\n", ost->file_index, ost->index, q); } -if (!vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) { +// Only print the stats for the first stream during processing +if ((is_last_report && (enable_detail_stats && vid || !vid)) || !is_last_report && !vid) { +if (enc->codec_type == AVMEDIA_TYPE_VIDEO) { float fps; frame_number = ost->frame_number; @@ -1761,7 +1778,9 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti ost->st->time_base, AV_TIME_BASE_Q)); if (is_last_report) nb_frames_drop += ost->last_dropped; -} +total_s
Re: [FFmpeg-devel] [PATCH] ffmpeg.c: add an option "detail_stats" to allow ffmpeg to output stats for each stream
On Thu, Aug 23, 2018 at 12:43:25PM -0700, Wang Cao wrote: > From: Wang Cao > > Add an option "detail_stats" to ffmpeg to output stats for each video/audio > streams and each ouptut file ffmpeg output log in print_report. The format of > stats is unchanged. > > Signed-off-by: Wang Cao > --- > doc/ffmpeg.texi | 4 > fftools/ffmpeg.c | 53 +++- > fftools/ffmpeg.h | 1 + > fftools/ffmpeg_opt.c | 4 +++- > 4 files changed, 45 insertions(+), 17 deletions(-) breaks fate: make fate-flv-add_keyframe_index -j12 Segmentation fault (core dumped) make: *** [fate-flv-add_keyframe_index] Error 139 [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I have never wished to cater to the crowd; for what I know they do not approve, and what they approve I do not know. -- Epicurus signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] ffmpeg.c: add an option "detail_stats" to allow ffmpeg to output stats for each stream
From: Wang Cao Add an option "detail_stats" to ffmpeg to output stats for each video/audio streams and each ouptut file ffmpeg output log in print_report. The format of stats is unchanged. Signed-off-by: Wang Cao --- doc/ffmpeg.texi | 4 fftools/ffmpeg.c | 53 +++- fftools/ffmpeg.h | 1 + fftools/ffmpeg_opt.c | 4 +++- 4 files changed, 45 insertions(+), 17 deletions(-) diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index 3717f22d42..53a5be9791 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -1623,6 +1623,10 @@ rtp stream. (Requires at least one of the output formats to be rtp). Allows discarding specific streams or frames of streams at the demuxer. Not all demuxers support this. +@item -detail_stats (@emph{global}) +Allows printing stats for each output stream and output file at the end of +processing. + @table @option @item none Discard no frame. diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 2459374f08..2bd057ace1 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -1530,17 +1530,28 @@ static int reap_filters(int flush) return 0; } -static void print_final_stats(int64_t total_size) +static void print_final_stats() { uint64_t video_size = 0, audio_size = 0, extra_size = 0, other_size = 0; uint64_t subtitle_size = 0; uint64_t data_size = 0; +int64_t total_size; float percent = -1.0; int i, j; int pass1_used = 1; - -for (i = 0; i < nb_output_streams; i++) { +int nb_display_streams = enable_detail_stats ? nb_output_streams : 1; +AVFormatContext *oc; + +for (i = 0; i < nb_display_streams; i++) { OutputStream *ost = output_streams[i]; +if (i > 0 && ost->file_index != output_streams[i-1]->file_index) { +video_size = 0; +audio_size = 0; +extra_size = 0; +other_size = 0; +subtitle_size = 0; +data_size = 0; +} switch (ost->enc_ctx->codec_type) { case AVMEDIA_TYPE_VIDEO: video_size += ost->data_size; break; case AVMEDIA_TYPE_AUDIO: audio_size += ost->data_size; break; @@ -1552,7 +1563,13 @@ static void print_final_stats(int64_t total_size) if ( (ost->enc_ctx->flags & (AV_CODEC_FLAG_PASS1 | AV_CODEC_FLAG_PASS2)) != AV_CODEC_FLAG_PASS1) pass1_used = 0; -} + +// Print stats for each output file. +if (i == nb_output_streams-1 || ost->file_index != output_streams[i+1]->file_index) { +oc = output_files[ost->file_index]->ctx; +total_size = avio_size(oc->pb); +if (total_size <= 0) // FIXME improve avio_size() so it works with non seekable output too +total_size = avio_tell(oc->pb); if (data_size && total_size>0 && total_size >= data_size) percent = 100.0 * (total_size - data_size) / data_size; @@ -1568,6 +1585,8 @@ static void print_final_stats(int64_t total_size) else av_log(NULL, AV_LOG_INFO, "unknown"); av_log(NULL, AV_LOG_INFO, "\n"); +} +} /* print verbose per-stream stats */ for (i = 0; i < nb_input_files; i++) { @@ -1680,13 +1699,6 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti t = (cur_time-timer_start) / 100.0; - -oc = output_files[0]->ctx; - -total_size = avio_size(oc->pb); -if (total_size <= 0) // FIXME improve avio_size() so it works with non seekable output too -total_size = avio_tell(oc->pb); - vid = 0; av_bprint_init(&buf, 0, AV_BPRINT_SIZE_AUTOMATIC); av_bprint_init(&buf_script, 0, AV_BPRINT_SIZE_AUTOMATIC); @@ -1697,12 +1709,14 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti if (!ost->stream_copy) q = ost->quality / (float) FF_QP2LAMBDA; -if (vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) { +if (is_last_report && vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) { av_bprintf(&buf, "q=%2.1f ", q); av_bprintf(&buf_script, "stream_%d_%d_q=%.1f\n", ost->file_index, ost->index, q); } -if (!vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) { +// Only print the stats for the first stream during processing +if ((is_last_report && (enable_detail_stats && vid || !vid)) || !is_last_report && !vid) { +if (enc->codec_type == AVMEDIA_TYPE_VIDEO) { float fps; frame_number = ost->frame_number; @@ -1761,7 +1775,9 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti ost->st->time_base, AV_TIME_BASE_Q)); if (is_last_report) nb_frames_drop += ost->last_dropped; -} +total_size = avio_size(output_files[ost->file_index]->ctx->pb); +if (total_size <= 0) // FIXME improve avio_size(