[FFmpeg-devel] [PATCH] ffprobe: add stream_index to frame data

Stefano Sabatini stefasab at gmail.com
Thu May 14 09:53:53 CEST 2015


[...]
> From c655acffb8d9acc97e19553c2e464c0d78586063 Mon Sep 17 00:00:00 2001
> From: Dave Rice <dave at dericed.com>
> Date: Wed, 13 May 2015 13:38:29 -0400
> Subject: [PATCH] ffprobe: print stream_index with frame data
> 
> otherwise the frame data can't be associated back to its stream. This
> makes it easier to work with data from multi-track outputs such as:
> ffprobe -f lavfi
> movie=1video_3audio.mov:s=v+a+a+a[out0][out1][out2][out3] -show_streams
> -show_frames
> ---
>  doc/ffprobe.xsd | 1 +
>  ffprobe.c       | 1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/doc/ffprobe.xsd b/doc/ffprobe.xsd
> index d473c9b..5e0f9a9 100644
> --- a/doc/ffprobe.xsd
> +++ b/doc/ffprobe.xsd
> @@ -86,6 +86,7 @@
>              <xsd:element name="side_data_list" type="ffprobe:frameSideDataListType"   minOccurs="0" maxOccurs="1" />
>        </xsd:sequence>
>  
> +      <xsd:attribute name="stream_index"  type="xsd:int"/>
>        <xsd:attribute name="media_type"    type="xsd:string" use="required"/>
>        <xsd:attribute name="key_frame"     type="xsd:int"    use="required"/>
>        <xsd:attribute name="pts"           type="xsd:long" />
> diff --git a/ffprobe.c b/ffprobe.c
> index fadcd93..8ee97f5 100644
> --- a/ffprobe.c
> +++ b/ffprobe.c
> @@ -1822,6 +1822,7 @@ static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream,
>      writer_print_section_header(w, SECTION_ID_FRAME);
>  
>      s = av_get_media_type_string(stream->codec->codec_type);
> +    print_int ("stream_index",          stream->index);
>      if (s) print_str    ("media_type", s);
>      else   print_str_opt("media_type", "unknown");

Nit: maybe you should print this after the media_type, as in the case
of packet.

Note: you also need to update the fate ffprobe references, see the
script in attachment (which I should probably commit).
-- 
FFmpeg = Fundamental and Faithless Multipurpose Practical Energized Gnome
-------------- next part --------------
#! /bin/sh

ffprobe_tests=$(make fate-list | grep ffprobe)

for test in $ffprobe_tests; do
    format=${test##*_}
    ffprobe -show_streams -show_packets -show_format -show_frames -bitexact tests/data/ffprobe-test.nut -of $format > tests/ref/fate/ffprobe_$format
done


More information about the ffmpeg-devel mailing list