From 8bba8cefc5984722426c190817598f15292cafcc Mon Sep 17 00:00:00 2001 From: WyattBlue Date: Tue, 4 Jun 2024 03:00:10 -0400 Subject: [PATCH 1/2] long doesn't exist anymore --- av/packet.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/av/packet.pyx b/av/packet.pyx index 112421090..63b0b50ab 100644 --- a/av/packet.pyx +++ b/av/packet.pyx @@ -25,7 +25,7 @@ cdef class Packet(Buffer): if input is None: return - if isinstance(input, (int, long)): + if isinstance(input, int): size = input else: source = bytesource(input) From 86882e93b13fb80388d33e9cb972fb4704f03b27 Mon Sep 17 00:00:00 2001 From: WyattBlue Date: Tue, 4 Jun 2024 03:02:34 -0400 Subject: [PATCH 2/2] Clean up time docs --- docs/api/time.rst | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/docs/api/time.rst b/docs/api/time.rst index fd65de1a2..a063e876e 100644 --- a/docs/api/time.rst +++ b/docs/api/time.rst @@ -57,7 +57,7 @@ In many cases a stream has a time base of ``1 / frame_rate``, and then its frame 1 -For convenince, :attr:`.Frame.time` is a ``float`` in seconds: +For convenience, :attr:`.Frame.time` is a ``float`` in seconds: .. doctest:: @@ -65,10 +65,10 @@ For convenince, :attr:`.Frame.time` is a ``float`` in seconds: 0.04 -FFMpeg Internals +FFmpeg Internals ---------------- -.. note:: Time in FFmpeg is not 100% clear to us (see :ref:`authority_of_docs`). At times the FFmpeg documentation and canonical seeming posts in the forums appear contradictory. We've experiemented with it, and what follows is the picture that we are operating under. +.. note:: Time in FFmpeg is not 100% clear to us (see :ref:`authority_of_docs`). At times the FFmpeg documentation and canonical seeming posts in the forums appear contradictory. We've experimented with it, and what follows is the picture that we are operating under. Both :ffmpeg:`AVStream` and :ffmpeg:`AVCodecContext` have a ``time_base`` member. However, they are used for different purposes, and (this author finds) it is too easy to abstract the concept too far. @@ -82,9 +82,6 @@ For encoding, you (the PyAV developer / FFmpeg "user") must set :ffmpeg:`AVCodec You then prepare :ffmpeg:`AVFrame.pts` in :ffmpeg:`AVCodecContext.time_base`. The encoded :ffmpeg:`AVPacket.pts` is simply copied from the frame by the library, and so is still in the codec's time base. You must rescale it to :ffmpeg:`AVStream.time_base` before muxing (as all stream operations assume the packet time is in stream time base). -For fixed-fps content your frames' ``pts`` would be the frame or sample index (for video and audio, respectively). PyAV should attempt to do this. - - Decoding ........