[FFmpeg-cvslog] doc/examples/transcode: set packet timebase for decoding

Anton Khirnov git at videolan.org
Sat Jun 3 12:29:47 EEST 2023


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Wed May 31 16:58:50 2023 +0200| [828d3b4432dbd9f47526e13544e820c9212efc2f] | committer: Anton Khirnov

doc/examples/transcode: set packet timebase for decoding

It is recommended for callers to set it, though not required.

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

 doc/examples/transcode.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/doc/examples/transcode.c b/doc/examples/transcode.c
index 805a028ed7..84dd9fc8bc 100644
--- a/doc/examples/transcode.c
+++ b/doc/examples/transcode.c
@@ -97,6 +97,11 @@ static int open_input_file(const char *filename)
                    "for stream #%u\n", i);
             return ret;
         }
+
+        /* Inform the decoder about the timebase for the packet timestamps.
+         * This is highly recommended, but not mandatory. */
+        codec_ctx->pkt_timebase = stream->time_base;
+
         /* Reencode video & audio and remux subtitles etc. */
         if (codec_ctx->codec_type == AVMEDIA_TYPE_VIDEO
                 || codec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) {



More information about the ffmpeg-cvslog mailing list