Skip to content

v18.1.0

Latest

Choose a tag to compare

@WyattBlue WyattBlue released this 12 Aug 22:11

Features

  • Infer the specific stream and codec context types for all FFmpeg encoder names in type-checked code by @WyattBlue.
  • Add CodecContext.supported_options to discover generic and codec-specific options by @WyattBlue (#2032).
  • Add Packet.rescale_ts() to rescale packet PTS, DTS, and duration to a new AVRational time base by @WyattBlue.
  • Support reusing the thread's current CUDA context via a current_ctx flag on CudaContext and VideoFrame.from_dlpack, for interop with libraries like PyTorch that initialize CUDA first by @Yozer (#2339).
  • VideoFrame.from_dlpack no longer requires restating primary_ctx/current_ctx when passing an explicit cuda_context; the flags are only validated when explicitly given by @WyattBlue.
  • Support passing an explicit CUDA stream to FFmpeg CUDA operations, including NVENC input and output, via a cuda_stream parameter on CudaContext; currently limited to logical CUDA device 0 by @Yozer (#2360).
  • Add av.AVRational, an exact rational number stored as two int32s that mirrors FFmpeg's AVRational. Codec.frame_rates now holds these rather than fractions.Fraction, and every setter that accepts a Fraction also accepts an AVRational. Unset rational attributes are falsy, so test them with if not stream.time_base: rather than is None by @WyattBlue.
  • Add Frame.metadata, the metadata FFmpeg attaches to a frame, by @WyattBlue.
  • Add CodecContext.level by @WyattBlue.
  • Add VideoCodecContext.field_order by @WyattBlue.
  • VideoFrame.save now forwards keyword arguments to the encoder, letting callers trade file size for speed (e.g. pred="none" or compression_level=1 for PNG, qscale=2 for JPG) by @WyattBlue.
  • Add InputContainer.start_time_realtime, the stream's start time in microseconds since the Unix epoch, which RTSP derives from RTCP sender reports, by @WyattBlue (#2365).

Fixes

  • Fix VideoFrame.save raising AttributeError when given a Path rather than a str by @WyattBlue.
  • Fix a frame rate assigned to a VideoStream after add_stream being dropped from the output; the codec context's frame rate is now copied to the stream before the header is written by @WyattBlue (#2301).
  • Prevent crashes and corrupted output when structural codec properties are changed after an output stream has been opened by @WyattBlue, reported by @oakaigh (#2232).
  • Fix a crash when using a stream that has no CodecContext (a demuxed stream with no available decoder, such as one from a truncated file, or a stream created by add_mux_stream); decoding now raises DecoderNotFoundError, encoding now raises EncoderNotFoundError, and BitStreamFilterContext accepts such a stream as out_stream by @WyattBlue, reported by @justinrmiller (#2344).

Misc

  • Support building from source against FFmpeg 9.0 by @WyattBlue. The binary wheels still ship FFmpeg 8.1.2.

New Contributors

Full Changelog: v18.0.0...v18.1.0