[FFmpeg-cvslog] movenc: Write correct presentation timestamps in tfra

Martin Storsjö git at videolan.org
Sat Nov 8 01:11:15 CET 2014


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Sun Oct 12 00:24:31 2014 +0300| [9cbf70fa0e44613590b019cef1fe99aa3f3c5d9d] | committer: Martin Storsjö

movenc: Write correct presentation timestamps in tfra

Previously we wrote decoding timestamps here, while the specs
say it should be presentation timestamps.

Signed-off-by: Martin Storsjö <martin at martin.st>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9cbf70fa0e44613590b019cef1fe99aa3f3c5d9d
---

 libavformat/movenc.c  |   11 +++++++++++
 libavformat/version.h |    2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 96bb885..3b7f5ae 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -3018,6 +3018,17 @@ static int mov_flush_fragment(AVFormatContext *s)
             info = &track->frag_info[track->nb_frag_info - 1];
             info->offset   = avio_tell(s->pb);
             info->time     = track->frag_start;
+            if (track->entry) {
+                // Try to recreate the original pts for the first packet
+                // from the fields we have stored
+                info->time = track->start_dts + track->frag_start +
+                             track->cluster[0].cts;
+                // If the pts is less than zero, we will have trimmed
+                // away parts of the media track using an edit list,
+                // and the corresponding start presentation time is zero.
+                if (info->time < 0)
+                    info->time = 0;
+            }
             info->duration = duration;
             mov_write_tfrf_tags(s->pb, mov, track);
 
diff --git a/libavformat/version.h b/libavformat/version.h
index c477d5d..f8c5edb 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -31,7 +31,7 @@
 
 #define LIBAVFORMAT_VERSION_MAJOR 56
 #define LIBAVFORMAT_VERSION_MINOR  6
-#define LIBAVFORMAT_VERSION_MICRO  3
+#define LIBAVFORMAT_VERSION_MICRO  4
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
                                                LIBAVFORMAT_VERSION_MINOR, \



More information about the ffmpeg-cvslog mailing list