From: Anton Khirnov <anton@khirnov.net>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH 6/9] fftools/ffmpeg: print keyframe information with -stats_*
Date: Thu, 14 Dec 2023 20:31:35 +0100
Message-ID: <20231214193138.2503-6-anton@khirnov.net> (raw)
In-Reply-To: <20231214193138.2503-1-anton@khirnov.net>
---
doc/ffmpeg.texi | 3 +++
fftools/ffmpeg.h | 1 +
fftools/ffmpeg_enc.c | 2 ++
fftools/ffmpeg_mux_init.c | 1 +
4 files changed, 7 insertions(+)
diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index f157c06e12..059102b75a 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -2207,6 +2207,9 @@ Current bitrate in bits per second. Post-encoding only.
@item abr (@emph{packet})
Average bitrate for the whole stream so far, in bits per second, -1 if it cannot
be determined at this point. Post-encoding only.
+
+@item key (@emph{packet})
+Character 'K' if the packet contains a keyframe, character 'N' otherwise.
@end table
Directives tagged with @emph{packet} may only be used with
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 96f4e757e1..03dbb528c0 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -465,6 +465,7 @@ enum EncStatsType {
ENC_STATS_PKT_SIZE,
ENC_STATS_BITRATE,
ENC_STATS_AVG_BITRATE,
+ ENC_STATS_KEYFRAME,
};
typedef struct EncStatsComponent {
diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c
index 9141dab6a4..d774a7e008 100644
--- a/fftools/ffmpeg_enc.c
+++ b/fftools/ffmpeg_enc.c
@@ -520,6 +520,8 @@ void enc_stats_write(OutputStream *ost, EncStats *es,
case ENC_STATS_DTS: avio_printf(io, "%"PRId64, pkt->dts); continue;
case ENC_STATS_DTS_TIME: avio_printf(io, "%g", pkt->dts * av_q2d(tb)); continue;
case ENC_STATS_PKT_SIZE: avio_printf(io, "%d", pkt->size); continue;
+ case ENC_STATS_KEYFRAME: avio_write(io, (pkt->flags & AV_PKT_FLAG_KEY) ?
+ "K" : "N", 1); continue;
case ENC_STATS_BITRATE: {
double duration = FFMAX(pkt->duration, 1) * av_q2d(tb);
avio_printf(io, "%g", 8.0 * pkt->size / duration);
diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c
index f870d48136..0203701d78 100644
--- a/fftools/ffmpeg_mux_init.c
+++ b/fftools/ffmpeg_mux_init.c
@@ -309,6 +309,7 @@ static int enc_stats_init(OutputStream *ost, EncStats *es, int pre,
{ ENC_STATS_PKT_SIZE, "size", 0, 1 },
{ ENC_STATS_BITRATE, "br", 0, 1 },
{ ENC_STATS_AVG_BITRATE, "abr", 0, 1 },
+ { ENC_STATS_KEYFRAME, "key", 0, 1 },
};
const char *next = fmt_spec;
--
2.42.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2023-12-14 19:33 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-14 19:31 [FFmpeg-devel] [PATCH 1/9] fftools/ffmpeg_mux: stop logging to AVFormatContext Anton Khirnov
2023-12-14 19:31 ` [FFmpeg-devel] [PATCH 2/9] fftools/ffmpeg: deprecate -fps_mode/vsync drop Anton Khirnov
2023-12-14 19:31 ` [FFmpeg-devel] [PATCH 3/9] fftools/ffmpeg_mux: factor timestamps processing out of write_packet() Anton Khirnov
2023-12-14 19:31 ` [FFmpeg-devel] [PATCH 4/9] fftools/cmdutils: change option flags to (1 << N) style Anton Khirnov
2023-12-14 19:31 ` [FFmpeg-devel] [PATCH 5/9] fftools/ffmpeg_mux_init: change 1-bit bitfields from int to unsigned Anton Khirnov
2023-12-14 19:31 ` Anton Khirnov [this message]
2023-12-14 19:31 ` [FFmpeg-devel] [PATCH 7/9] doc/ffmpeg: drop misleading claims from -stats_*_fmt Anton Khirnov
2023-12-14 19:31 ` [FFmpeg-devel] [PATCH 8/9] fftools/ffmpeg_mux: deduplicate uniniting EncStats Anton Khirnov
2023-12-14 19:31 ` [FFmpeg-devel] [PATCH 9/9] fftools/ffmpeg: use a mutex for enc_stats_write() Anton Khirnov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231214193138.2503-6-anton@khirnov.net \
--to=anton@khirnov.net \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git