[FFmpeg-devel] [PATCH] ffprobe: print start_pts and duration_pts stream information

Stefano Sabatini stefasab at gmail.com
Sat Sep 8 13:02:25 CEST 2012


Add start_pts and duration_pts fields. A duration_time field is added for
overall consistency ("duration" alone does not tell if the duration is a
time or a timestamp), "duration" is kept for backward compatibility but
should be considered deprecated.
---
 doc/ffprobe.xsd |    3 +++
 ffprobe.c       |    6 +++++-
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/doc/ffprobe.xsd b/doc/ffprobe.xsd
index 4340d46..75b2128 100644
--- a/doc/ffprobe.xsd
+++ b/doc/ffprobe.xsd
@@ -121,7 +121,10 @@
       <xsd:attribute name="r_frame_rate"     type="xsd:string" use="required"/>
       <xsd:attribute name="avg_frame_rate"   type="xsd:string" use="required"/>
       <xsd:attribute name="time_base"        type="xsd:string" use="required"/>
+      <xsd:attribute name="start_pts"        type="xsd:long"/>
       <xsd:attribute name="start_time"       type="xsd:float"/>
+      <xsd:attribute name="duration_pts"     type="xsd:long"/>
+      <xsd:attribute name="duration_time"    type="xsd:float"/>
       <xsd:attribute name="duration"         type="xsd:float"/>
       <xsd:attribute name="bit_rate"         type="xsd:int"/>
       <xsd:attribute name="nb_frames"        type="xsd:int"/>
diff --git a/ffprobe.c b/ffprobe.c
index 5f2132d..76f0e85 100644
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -1818,8 +1818,12 @@ static void show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_i
     print_q("r_frame_rate",   stream->r_frame_rate,   '/');
     print_q("avg_frame_rate", stream->avg_frame_rate, '/');
     print_q("time_base",      stream->time_base,      '/');
+    print_ts  ("start_pts",     stream->start_time);
     print_time("start_time",    stream->start_time, &stream->time_base);
-    print_time("duration",      stream->duration,   &stream->time_base);
+    print_ts  ("duration_pts",  stream->duration);
+    print_time("duration_time", stream->duration, &stream->time_base);
+    /* duplicated of duration_time, kept for backward compatibility, will be removed in a future version */
+    print_time("duration",      stream->duration, &stream->time_base);
     if (dec_ctx->bit_rate > 0) print_val    ("bit_rate", dec_ctx->bit_rate, unit_bit_per_second_str);
     else                       print_str_opt("bit_rate", "N/A");
     if (stream->nb_frames) print_fmt    ("nb_frames", "%"PRId64, stream->nb_frames);
-- 
1.7.5.4



More information about the ffmpeg-devel mailing list