Skip to content

Commit ea9d3a5

Browse files
committed
bump(main/python-torchvision): 0.24.0 + ffmpeg-8.0 compat
- Backport upstream PR (pytorch/vision#9245)
1 parent 44b547f commit ea9d3a5

File tree

2 files changed

+35
-3
lines changed

2 files changed

+35
-3
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
From b574ff86f23b6b2391e93042230f355daa5e8d0f Mon Sep 17 00:00:00 2001
2+
From: Dominik Mierzejewski <dominik@greysector.net>
3+
Date: Fri, 17 Oct 2025 10:51:13 +0200
4+
Subject: [PATCH] Add compatibility with FFmpeg 8.0
5+
6+
key_frame was deprecated in 2023 (FFmpeg 6.1):
7+
8+
2023-05-04 - 0fc9c1f6828 - lavu 58.7.100 - frame.h
9+
Deprecate AVFrame.interlaced_frame, AVFrame.top_field_first, and
10+
AVFrame.key_frame.
11+
Add AV_FRAME_FLAG_INTERLACED, AV_FRAME_FLAG_TOP_FIELD_FIRST, and
12+
AV_FRAME_FLAG_KEY flags as replacement.
13+
---
14+
torchvision/csrc/io/decoder/video_stream.cpp | 4 ++++
15+
1 file changed, 4 insertions(+)
16+
17+
diff --git a/torchvision/csrc/io/decoder/video_stream.cpp b/torchvision/csrc/io/decoder/video_stream.cpp
18+
index fa08c65cac1..8f232ae0283 100644
19+
--- a/torchvision/csrc/io/decoder/video_stream.cpp
20+
+++ b/torchvision/csrc/io/decoder/video_stream.cpp
21+
@@ -122,7 +122,11 @@ int VideoStream::copyFrameBytes(ByteStorage* out, bool flush) {
22+
void VideoStream::setHeader(DecoderHeader* header, bool flush) {
23+
Stream::setHeader(header, flush);
24+
if (!flush) { // no frames for video flush
25+
+#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(58,7,100)
26+
+ header->keyFrame = (frame_)->flags & AV_FRAME_FLAG_KEY;
27+
+#else
28+
header->keyFrame = frame_->key_frame;
29+
+#endif
30+
header->fps = av_q2d(av_guess_frame_rate(
31+
inputCtx_, inputCtx_->streams[format_.stream], nullptr));
32+
}

packages/python-torchvision/build.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ TERMUX_PKG_HOMEPAGE=https://github.com/pytorch/vision
22
TERMUX_PKG_DESCRIPTION="Datasets, Transforms and Models specific to Computer Vision"
33
TERMUX_PKG_LICENSE="BSD 3-Clause"
44
TERMUX_PKG_MAINTAINER="@termux"
5-
TERMUX_PKG_VERSION=0.21.0
6-
TERMUX_PKG_REVISION=2
5+
TERMUX_PKG_VERSION=0.24.0
76
TERMUX_PKG_SRCURL=https://github.com/pytorch/vision/archive/refs/tags/v${TERMUX_PKG_VERSION}.tar.gz
8-
TERMUX_PKG_SHA256=0a4a967bbb7f9810f792cd0289a07fb98c8fb5d1303fae8b63e3a6b05d720058
7+
TERMUX_PKG_SHA256=f799cdd1d67a3edbcdc6af8fb416fe1b019b512fb426c0314302cd81518a0095
98
TERMUX_PKG_DEPENDS="libc++, ffmpeg, python, python-numpy, python-pillow, python-pip, python-torch, libjpeg-turbo, libpng, libwebp, zlib"
109
TERMUX_PKG_SETUP_PYTHON=true
10+
TERMUX_PKG_AUTO_UPDATE=true
1111

1212
termux_step_pre_configure() {
1313
CXXFLAGS+=" -I${TERMUX_PYTHON_HOME}/site-packages/torch/include"

0 commit comments

Comments
 (0)