From 9a0ffaab5bac5ce880c88a9d57c6630757e9fce4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?FuMin=20Wang=20=28=E7=8E=8B=E5=AF=8C=E6=B0=91=29?= Date: Thu, 28 Sep 2023 16:20:09 +0800 Subject: [PATCH] Export PTS and DTS as they are required for downstream muxers --- encode.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/encode.go b/encode.go index c8e04b9..e045e6a 100644 --- a/encode.go +++ b/encode.go @@ -57,6 +57,7 @@ type Encoder struct { csp int32 pts int64 + dts int64 nnals int32 nals []*x264c.Nal @@ -229,9 +230,16 @@ func (e *Encoder) Encode(im image.Image) (err error) { } } + e.dts = picOut.IDts + return } +// GetTimestamp returns the current PTS and DTS. +func (e *Encoder) GetTimestamp() (int64, int64) { + return e.pts, e.dts +} + // Flush flushes encoder. func (e *Encoder) Flush() (err error) { var picOut x264c.Picture