On Sun, 27 Sept 2026, 17:10 James Almer via ffmpeg-devel, <
[email protected]> wrote:

> PR #24746 opened by James Almer (jamrial)
> URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24746
> Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24746.patch
>
> Same as profile, if it's unknown, don't print it.
>
> It makes even more sense here given it's not a string, and ffprobe is
> printing a "-99" which means nothing to a casual reader.
>
>
> From b0c9c5cd1199ae4ba8da5e64ded35ebdd4f62d9a Mon Sep 17 00:00:00 2001
> From: James Almer <[email protected]>
> Date: Sun, 27 Sep 2026 21:04:15 -0300
> Subject: [PATCH] fftools/ffprobe: make level an optionally print value
>
> Same as profile, if it's unknown, don't print it.
> It makes even more sense here given it's not a string, and ffprobe is
> printing a "-99" which means nothing to a casual reader.
>
> Signed-off-by: James Almer <[email protected]>
> ---
>  fftools/ffprobe.c           | 6 +++++-
>  tests/ref/fate/ffprobe_json | 3 ---
>  tests/ref/fate/ffprobe_xml  | 6 +++---
>  tests/ref/fate/ffprobe_xsd  | 6 +++---
>  4 files changed, 11 insertions(+), 10 deletions(-)
>
> diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
> index f998bd05fb..55a7ebf84b 100644
> --- a/fftools/ffprobe.c
> +++ b/fftools/ffprobe.c
> @@ -448,6 +448,7 @@ static void log_callback(void *ptr, int level, const
> char *fmt, va_list vl)
>  } while (0)
>
>  #define print_int(k, v)         avtext_print_integer(tfc, k, v, 0)
> +#define print_int_opt(k, v)     avtext_print_integer(tfc, k, v,
> AV_TEXTFORMAT_PRINT_STRING_OPTIONAL)
>  #define print_q(k, v, s)        avtext_print_rational(tfc, k, v, s)
>  #define print_str(k, v)         avtext_print_string(tfc, k, v, 0)
>  #define print_str_opt(k, v)     avtext_print_string(tfc, k, v,
> AV_TEXTFORMAT_PRINT_STRING_OPTIONAL)
> @@ -1923,7 +1924,10 @@ static int show_stream(AVTextFormatContext *tfc,
> AVFormatContext *fmt_ctx, int s
>          } else
>              print_str_opt("profile", "unknown");
>      }
> -    print_int("level", par->level);
> +    if (par->level != AV_LEVEL_UNKNOWN)
> +        print_int("level", par->level);
> +    else
> +        print_int_opt("level", par->level);
>
>      s = av_get_media_type_string(par->codec_type);
>      if (s) print_str    ("codec_type", s);
> diff --git a/tests/ref/fate/ffprobe_json b/tests/ref/fate/ffprobe_json
> index 34f6f71274..83699510b8 100644
> --- a/tests/ref/fate/ffprobe_json
> +++ b/tests/ref/fate/ffprobe_json
> @@ -547,7 +547,6 @@
>          {
>              "index": 0,
>              "codec_name": "pcm_s16le",
> -            "level": -99,
>              "codec_type": "audio",
>              "codec_tag_string": "PSD[16]",
>              "codec_tag": "0x10445350",
> @@ -593,7 +592,6 @@
>          {
>              "index": 1,
>              "codec_name": "rawvideo",
> -            "level": -99,
>              "codec_type": "video",
>              "codec_tag_string": "RGB[24]",
>              "codec_tag": "0x18424752",
> @@ -643,7 +641,6 @@
>          {
>              "index": 2,
>              "codec_name": "rawvideo",
> -            "level": -99,
>              "codec_type": "video",
>              "codec_tag_string": "RGB[24]",
>              "codec_tag": "0x18424752",
> diff --git a/tests/ref/fate/ffprobe_xml b/tests/ref/fate/ffprobe_xml
> index 3ee2895eaa..ba922711f4 100644
> --- a/tests/ref/fate/ffprobe_xml
> +++ b/tests/ref/fate/ffprobe_xml
> @@ -32,14 +32,14 @@
>      </packets_and_frames>
>
>      <streams>
> -        <stream index="0" codec_name="pcm_s16le" level="-99"
> codec_type="audio" codec_tag_string="PSD[16]" codec_tag="0x10445350"
> sample_fmt="s16" sample_rate="44100" channels="1" bits_per_sample="16"
> initial_padding="0" r_frame_rate="0/0" avg_frame_rate="0/0"
> time_base="1/44100" start_pts="0" start_time="0.000000" bit_rate="705600"
> nb_read_frames="6" nb_read_packets="6">
> +        <stream index="0" codec_name="pcm_s16le" codec_type="audio"
> codec_tag_string="PSD[16]" codec_tag="0x10445350" sample_fmt="s16"
> sample_rate="44100" channels="1" bits_per_sample="16" initial_padding="0"
> r_frame_rate="0/0" avg_frame_rate="0/0" time_base="1/44100" start_pts="0"
> start_time="0.000000" bit_rate="705600" nb_read_frames="6"
> nb_read_packets="6">
>              <disposition default="0" dub="0" original="0" comment="0"
> lyrics="0" karaoke="0" forced="0" hearing_impaired="0" visual_impaired="0"
> clean_effects="0" attached_pic="0" timed_thumbnails="0" non_diegetic="0"
> captions="0" descriptions="0" metadata="0" dependent="0" still_image="0"
> multilayer="0"/>
>              <tags>
>                  <tag key="encoder" value="Lavc pcm_s16le"/>
>                  <tag key="E" value="mc²"/>
>              </tags>
>          </stream>
> -        <stream index="1" codec_name="rawvideo" level="-99"
> codec_type="video" codec_tag_string="RGB[24]" codec_tag="0x18424752"
> width="320" height="240" coded_width="320" coded_height="240"
> has_b_frames="0" sample_aspect_ratio="1:1" display_aspect_ratio="4:3"
> pix_fmt="rgb24" refs="1" r_frame_rate="25/1" avg_frame_rate="25/1"
> time_base="1/51200" start_pts="0" start_time="0.000000" nb_read_frames="4"
> nb_read_packets="4">
> +        <stream index="1" codec_name="rawvideo" codec_type="video"
> codec_tag_string="RGB[24]" codec_tag="0x18424752" width="320" height="240"
> coded_width="320" coded_height="240" has_b_frames="0"
> sample_aspect_ratio="1:1" display_aspect_ratio="4:3" pix_fmt="rgb24"
> refs="1" r_frame_rate="25/1" avg_frame_rate="25/1" time_base="1/51200"
> start_pts="0" start_time="0.000000" nb_read_frames="4" nb_read_packets="4">
>              <disposition default="1" dub="0" original="0" comment="0"
> lyrics="0" karaoke="0" forced="0" hearing_impaired="0" visual_impaired="0"
> clean_effects="0" attached_pic="0" timed_thumbnails="0" non_diegetic="0"
> captions="0" descriptions="0" metadata="0" dependent="0" still_image="0"
> multilayer="0"/>
>              <tags>
>                  <tag key="encoder" value="Lavc rawvideo"/>
> @@ -47,7 +47,7 @@
>                  <tag key="duration_ts"
> value="field-and-tags-conflict-attempt"/>
>              </tags>
>          </stream>
> -        <stream index="2" codec_name="rawvideo" level="-99"
> codec_type="video" codec_tag_string="RGB[24]" codec_tag="0x18424752"
> width="100" height="100" coded_width="100" coded_height="100"
> has_b_frames="0" sample_aspect_ratio="1:1" display_aspect_ratio="1:1"
> pix_fmt="rgb24" refs="1" r_frame_rate="25/1" avg_frame_rate="25/1"
> time_base="1/51200" start_pts="0" start_time="0.000000" nb_read_frames="4"
> nb_read_packets="4">
> +        <stream index="2" codec_name="rawvideo" codec_type="video"
> codec_tag_string="RGB[24]" codec_tag="0x18424752" width="100" height="100"
> coded_width="100" coded_height="100" has_b_frames="0"
> sample_aspect_ratio="1:1" display_aspect_ratio="1:1" pix_fmt="rgb24"
> refs="1" r_frame_rate="25/1" avg_frame_rate="25/1" time_base="1/51200"
> start_pts="0" start_time="0.000000" nb_read_frames="4" nb_read_packets="4">
>              <disposition default="0" dub="0" original="0" comment="0"
> lyrics="0" karaoke="0" forced="0" hearing_impaired="0" visual_impaired="0"
> clean_effects="0" attached_pic="0" timed_thumbnails="0" non_diegetic="0"
> captions="0" descriptions="0" metadata="0" dependent="0" still_image="0"
> multilayer="0"/>
>              <tags>
>                  <tag key="encoder" value="Lavc rawvideo"/>
> diff --git a/tests/ref/fate/ffprobe_xsd b/tests/ref/fate/ffprobe_xsd
> index 980f8fd93b..faeeaccadc 100644
> --- a/tests/ref/fate/ffprobe_xsd
> +++ b/tests/ref/fate/ffprobe_xsd
> @@ -32,14 +32,14 @@
>      </packets_and_frames>
>
>      <streams>
> -        <stream index="0" codec_name="pcm_s16le" level="-99"
> codec_type="audio" codec_tag_string="PSD[16]" codec_tag="0x10445350"
> sample_fmt="s16" sample_rate="44100" channels="1" bits_per_sample="16"
> initial_padding="0" r_frame_rate="0/0" avg_frame_rate="0/0"
> time_base="1/44100" start_pts="0" start_time="0.000000" bit_rate="705600"
> nb_read_frames="6" nb_read_packets="6">
> +        <stream index="0" codec_name="pcm_s16le" codec_type="audio"
> codec_tag_string="PSD[16]" codec_tag="0x10445350" sample_fmt="s16"
> sample_rate="44100" channels="1" bits_per_sample="16" initial_padding="0"
> r_frame_rate="0/0" avg_frame_rate="0/0" time_base="1/44100" start_pts="0"
> start_time="0.000000" bit_rate="705600" nb_read_frames="6"
> nb_read_packets="6">
>              <disposition default="0" dub="0" original="0" comment="0"
> lyrics="0" karaoke="0" forced="0" hearing_impaired="0" visual_impaired="0"
> clean_effects="0" attached_pic="0" timed_thumbnails="0" non_diegetic="0"
> captions="0" descriptions="0" metadata="0" dependent="0" still_image="0"
> multilayer="0"/>
>              <tags>
>                  <tag key="encoder" value="Lavc pcm_s16le"/>
>                  <tag key="E" value="mc²"/>
>              </tags>
>          </stream>
> -        <stream index="1" codec_name="rawvideo" level="-99"
> codec_type="video" codec_tag_string="RGB[24]" codec_tag="0x18424752"
> width="320" height="240" coded_width="320" coded_height="240"
> has_b_frames="0" sample_aspect_ratio="1:1" display_aspect_ratio="4:3"
> pix_fmt="rgb24" refs="1" r_frame_rate="25/1" avg_frame_rate="25/1"
> time_base="1/51200" start_pts="0" start_time="0.000000" nb_read_frames="4"
> nb_read_packets="4">
> +        <stream index="1" codec_name="rawvideo" codec_type="video"
> codec_tag_string="RGB[24]" codec_tag="0x18424752" width="320" height="240"
> coded_width="320" coded_height="240" has_b_frames="0"
> sample_aspect_ratio="1:1" display_aspect_ratio="4:3" pix_fmt="rgb24"
> refs="1" r_frame_rate="25/1" avg_frame_rate="25/1" time_base="1/51200"
> start_pts="0" start_time="0.000000" nb_read_frames="4" nb_read_packets="4">
>              <disposition default="1" dub="0" original="0" comment="0"
> lyrics="0" karaoke="0" forced="0" hearing_impaired="0" visual_impaired="0"
> clean_effects="0" attached_pic="0" timed_thumbnails="0" non_diegetic="0"
> captions="0" descriptions="0" metadata="0" dependent="0" still_image="0"
> multilayer="0"/>
>              <tags>
>                  <tag key="encoder" value="Lavc rawvideo"/>
> @@ -47,7 +47,7 @@
>                  <tag key="duration_ts"
> value="field-and-tags-conflict-attempt"/>
>              </tags>
>          </stream>
> -        <stream index="2" codec_name="rawvideo" level="-99"
> codec_type="video" codec_tag_string="RGB[24]" codec_tag="0x18424752"
> width="100" height="100" coded_width="100" coded_height="100"
> has_b_frames="0" sample_aspect_ratio="1:1" display_aspect_ratio="1:1"
> pix_fmt="rgb24" refs="1" r_frame_rate="25/1" avg_frame_rate="25/1"
> time_base="1/51200" start_pts="0" start_time="0.000000" nb_read_frames="4"
> nb_read_packets="4">
> +        <stream index="2" codec_name="rawvideo" codec_type="video"
> codec_tag_string="RGB[24]" codec_tag="0x18424752" width="100" height="100"
> coded_width="100" coded_height="100" has_b_frames="0"
> sample_aspect_ratio="1:1" display_aspect_ratio="1:1" pix_fmt="rgb24"
> refs="1" r_frame_rate="25/1" avg_frame_rate="25/1" time_base="1/51200"
> start_pts="0" start_time="0.000000" nb_read_frames="4" nb_read_packets="4">
>              <disposition default="0" dub="0" original="0" comment="0"
> lyrics="0" karaoke="0" forced="0" hearing_impaired="0" visual_impaired="0"
> clean_effects="0" attached_pic="0" timed_thumbnails="0" non_diegetic="0"
> captions="0" descriptions="0" metadata="0" dependent="0" still_image="0"
> multilayer="0"/>
>              <tags>
>                  <tag key="encoder" value="Lavc rawvideo"/>
> --
> 2.52.0
>
> _______________________________________________
> ffmpeg-devel mailing list -- [email protected]
> To unsubscribe send an email to [email protected]


Makes sense

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

Reply via email to