PR #21412 opened by VannHarl
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21412
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21412.patch

Adds the "codec attribute" string to output for stremas.
It is the same codec attributes written into HLS/DASH manifests.

Use: ffprobe -show_streams <input>
or:  ffprobe -show_entries stream=codec_attr <input>


>From 7646ea94e76973cd9244418dbf18adf652425d89 Mon Sep 17 00:00:00 2001
From: Vann Harl <[email protected]>
Date: Thu, 8 Jan 2026 15:22:10 +0100
Subject: [PATCH] fftools/ffprobe: add codec_attr for streams

Adds the "codec attribute" string to output for stremas.
It is the same codec attributes written into HLS/DASH manifests.

Use: ffprobe -show_streams <input>
or:  ffprobe -show_entries stream=codec_attr <input>
---
 fftools/Makefile  | 2 ++
 fftools/ffprobe.c | 8 ++++++++
 2 files changed, 10 insertions(+)

diff --git a/fftools/Makefile b/fftools/Makefile
index 01b16fa8f4..b20a586e2c 100644
--- a/fftools/Makefile
+++ b/fftools/Makefile
@@ -50,6 +50,8 @@ OBJS-ffprobe +=                       \
     fftools/textformat/tw_avio.o      \
     fftools/textformat/tw_buffer.o    \
     fftools/textformat/tw_stdout.o    \
+    libavformat/codecstring.o         \
+    libavformat/nal.o                 \
 
 OBJS-ffmpeg += $(COMPAT_OBJS:%=compat/%)
 OBJS-ffplay += fftools/ffplay_renderer.o
diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 67111bc31f..f3439ad69c 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -31,6 +31,7 @@
 
 #include "libavformat/avformat.h"
 #include "libavformat/version.h"
+#include "libavformat/internal.h"
 #include "libavcodec/avcodec.h"
 #include "libavcodec/version.h"
 #include "libavutil/ambient_viewing_environment.h"
@@ -1796,6 +1797,13 @@ static int show_stream(AVTextFormatContext *tfc, 
AVFormatContext *fmt_ctx, int s
         }
     }
 
+    av_bprint_clear(&pbuf);
+    if (ff_make_codec_str(fmt_ctx, stream->codecpar, &stream->avg_frame_rate, 
&pbuf) == 0) {
+        print_str("codec_attr", pbuf.str);
+    } else {
+        print_str_opt("codec_attr", "unknown");
+    }
+
     if (!do_bitexact && (profile = avcodec_profile_name(par->codec_id, 
par->profile)))
         print_str("profile", profile);
     else {
-- 
2.49.1

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to