From: Zhao Zhili <quinkblack@foxmail.com> To: ffmpeg-devel@ffmpeg.org Cc: Zhao Zhili <zhilizhao@tencent.com> Subject: [FFmpeg-devel] [PATCH] avfilter/vf_showinfo: add udu_sei_as_ascii option Date: Wed, 13 Dec 2023 11:46:48 +0800 Message-ID: <tencent_771DC19DB73468DA01F968DE7CFEACA63A0A@qq.com> (raw) From: Zhao Zhili <zhilizhao@tencent.com> Some encoders (e.g., libx264) dump encoder configuration as user data unregistered SEI message. This option try to print it as ascii character when possible. --- doc/filters.texi | 4 ++++ libavfilter/version.h | 2 +- libavfilter/vf_showinfo.c | 14 ++++++++++++-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index 6d00ba2c3f..0d4c5a47a0 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -21796,6 +21796,10 @@ This filter supports the following options: @table @option @item checksum Calculate checksums of each plane. By default enabled. + +@item udu_sei_as_ascii +Try to print user data unregistered SEI as ascii character when possible, +in hex format otherwise. @end table The shown line contains a sequence of key/value pairs of the form diff --git a/libavfilter/version.h b/libavfilter/version.h index 7642b670d1..83931e11dd 100644 --- a/libavfilter/version.h +++ b/libavfilter/version.h @@ -32,7 +32,7 @@ #include "version_major.h" #define LIBAVFILTER_VERSION_MINOR 14 -#define LIBAVFILTER_VERSION_MICRO 100 +#define LIBAVFILTER_VERSION_MICRO 101 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c index 71869446c6..309de28df9 100644 --- a/libavfilter/vf_showinfo.c +++ b/libavfilter/vf_showinfo.c @@ -22,6 +22,7 @@ * filter for showing textual video frame information */ +#include <ctype.h> #include <inttypes.h> #include "libavutil/bswap.h" @@ -52,6 +53,7 @@ typedef struct ShowInfoContext { const AVClass *class; int calculate_checksums; + int udu_sei_as_ascii; } ShowInfoContext; #define OFFSET(x) offsetof(ShowInfoContext, x) @@ -59,6 +61,8 @@ typedef struct ShowInfoContext { static const AVOption showinfo_options[] = { { "checksum", "calculate checksums", OFFSET(calculate_checksums), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1, VF }, + { "udu_sei_as_ascii", "try to print user data unregistered SEI as ascii character when possible", + OFFSET(udu_sei_as_ascii), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VF }, { NULL } }; @@ -418,6 +422,7 @@ static void dump_video_enc_params(AVFilterContext *ctx, const AVFrameSideData *s static void dump_sei_unregistered_metadata(AVFilterContext *ctx, const AVFrameSideData *sd) { const uint8_t *user_data = sd->data; + ShowInfoContext *s = ctx->priv; if (sd->size < AV_UUID_LEN) { av_log(ctx, AV_LOG_ERROR, "invalid data(%"SIZE_SPECIFIER" < " @@ -428,8 +433,13 @@ static void dump_sei_unregistered_metadata(AVFilterContext *ctx, const AVFrameSi av_log(ctx, AV_LOG_INFO, "UUID=" AV_PRI_UUID "\n", AV_UUID_ARG(user_data)); av_log(ctx, AV_LOG_INFO, "User Data="); - for (size_t i = 16; i < sd->size; i++) - av_log(ctx, AV_LOG_INFO, "%02x", user_data[i]); + for (size_t i = 16; i < sd->size; i++) { + const char *format = "%02x"; + + if (s->udu_sei_as_ascii) + format = isprint(user_data[i]) ? "%c" : "\\x%02x"; + av_log(ctx, AV_LOG_INFO, format, user_data[i]); + } av_log(ctx, AV_LOG_INFO, "\n"); } -- 2.25.1 _______________________________________________ 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 reply other threads:[~2023-12-13 3:47 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-12-13 3:46 Zhao Zhili [this message] 2023-12-21 3:05 ` Zhao Zhili 2023-12-28 5:30 ` Zhao Zhili
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=tencent_771DC19DB73468DA01F968DE7CFEACA63A0A@qq.com \ --to=quinkblack@foxmail.com \ --cc=ffmpeg-devel@ffmpeg.org \ --cc=zhilizhao@tencent.com \ /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