[FFmpeg-cvslog] avformat/demux: add support to derive timestamps from packet durations for video

Paul B Mahol git at videolan.org
Thu May 25 20:56:42 EEST 2023


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sun May 21 02:15:26 2023 +0200| [e7cadd0ee5a3d0da64b6c9a66b6609aef8e1977d] | committer: Paul B Mahol

avformat/demux: add support to derive timestamps from packet durations for video

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

 libavformat/demux.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavformat/demux.c b/libavformat/demux.c
index dec02a1a6b..b3f563ccc7 100644
--- a/libavformat/demux.c
+++ b/libavformat/demux.c
@@ -1195,6 +1195,11 @@ static int parse_packet(AVFormatContext *s, AVPacket *pkt,
                                      st->time_base,
                                      AV_ROUND_DOWN);
             }
+        } else if ((s->iformat->flags & AVFMT_NOTIMESTAMPS) && st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
+            if (st->time_base.num > 0 && st->time_base.den > 0 &&
+                sti->parser->duration) {
+                out_pkt->duration = sti->parser->duration;
+            }
         }
 
         out_pkt->stream_index = st->index;



More information about the ffmpeg-cvslog mailing list