1
0
mirror of https://git.ffmpeg.org/ffmpeg.git synced 2026-10-24 02:09:03 +03:00
Commit Graph

127957 Commits

Author SHA1 Message Date
Michael Niedermayer
47b92841e3 Prepare release/9.1
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-10-23 06:46:55 +02:00
Michael Niedermayer
66143d6aaa Bump minor version for release/9.1
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-10-23 06:44:03 +02:00
Michael Niedermayer
5f9d764fff Changelog: Add 9.1 2026-10-23 06:44:03 +02:00
Michael Niedermayer
e525b51aa0 doc/APIchanges: fill in missing things
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-10-23 06:44:02 +02:00
Zhao Zhili
c569ebacce aarch64/h26x: reuse the shared qpel hv window rotation
The eight positions of the eight-row window are the same walk for every
vertical tail, and calc_all already carries it. The wider weighted tails stay
as they are: calc_all2 fixes its window to v16..v31, so handing them over means
moving their accumulators and weight vectors out of that range first.

No functional changes.
2026-10-23 03:42:41 +00:00
Zhao Zhili
9a0e010a9c aarch64/h26x: load a weighted qpel hv row with one instruction
The unweighted step macros in this file let a post-indexed load walk the
intermediate plane, while these weighted steps loaded a row and then advanced
sp with a separate add. Fold the advance into the load.

The step macro now names its row register without a width letter, which is
what the next change needs in order to drive these tails from calc_all.
2026-10-23 03:42:41 +00:00
Zhao Zhili
dd04dc6fc6 aarch64/h26x: share the weighted qpel hv vertical tail up to 8 wide
No functional changes.
2026-10-23 03:42:41 +00:00
Zhao Zhili
e79dcfabf0 aarch64/h26x: factor the weighted qpel hv vertical row step into macros
No functional changes.
2026-10-23 03:42:41 +00:00
Jun Zhao
1a24bd6c7f tests/fate: add an ID3v2 chapter size round-trip
Cover ID3v2.3 and ID3v2.4 with a chapter title long enough that a plain
size and a synchsafe size differ. Print the CHAP size bytes, declared and
actual tag lengths, chapter counts, titles and timings for FATE to compare
against its reference output.

Also give the first embedded text frame an oversized length and verify
through the reference that both chapters and their timings survive.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2026-10-23 09:25:28 +08:00
Jun Zhao
e828b52165 avformat/id3v2: honor the tag version in CHAP frame sizes
ID3v2.3 stores a frame size as a plain 32-bit integer. ID3v2.4 stores it
as a synchsafe integer. write_chapter() always wrote the plain form, and
read_chapter() always read it that way. Once an embedded text frame
reached 128 bytes, the size no longer fitted and the chapter was dropped.

Write the CHAP header with the same version rule as other frames. Read an
embedded frame with that rule, and keep the chapter when a subframe size
does not fit.

Fixes: https://code.ffmpeg.org/FFmpeg/FFmpeg/issues/25357
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2026-10-23 07:06:02 +08:00
Kyle Swanson
179d083493 avfilter/vf_libvmaf: use vmaf_picture_wrap() if available
Signed-off-by: Kyle Swanson <kswanson@netflix.com>
2026-10-22 20:55:23 +00:00
James Almer
db21684c3a avcodec/version: fix minor version
It was wrongly reduced in 0ec6a0872d.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-10-22 17:44:38 -03:00
Michael Niedermayer
e914b1cb0c tests/fate/seek: pin the HLS video encoder thread count
The generated MPEG-2 video depends on the automatic slice thread count.
Use a single video encoder thread so CPU availability cannot change the
fixture. The current master seek reference does not sample the packets
whose sizes expose this difference on release/9.0, so it is unchanged.

Validated fate-seek-hls with freshly generated input three times each
under CPU affinity masks containing one, two, and eight CPUs.

Related-to: #24579
Assisted-by: Fairy
2026-10-22 19:50:58 +00:00
Michael Niedermayer
2668cb6e31 avformat/asfdec_f: export stream-specific metadata in the stream
Store such entries in the metadata of the corresponding stream.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-10-22 16:39:53 +00:00
Michael Niedermayer
dadf0b5b2e avformat/asfdec_f: pass the target dictionary to get_tag()
Allows storing tags in a dictionary other than the format metadata.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-10-22 16:39:53 +00:00
hayateppp
303510f9d1 avcodec/cuviddec: drain queued output before parsing more input
A queued display entry holds a decode surface index, not a copy of its
pixels. Parsing another packet can reuse that surface before the entry
is mapped, associating a later image with the queued timestamp. The
queue occupancy check does not protect individual surface lifetimes.

Consume queued output before fetching another packet. In particular,
this drains both deinterlaced fields before submitting further input.

A generated 120-frame interlaced H.264 stream decoded with -deint bob
produces 157 incorrect images out of 240 on an RTX 5090. With this guard,
all 240 images match the software-decoded, spatially constant source
frames, and diagnostic logging no longer observes queued surface reuse.

Based on the candidate fix provided by hayateppp in issue #25210.
The original report's private inputs remain untested here.

Assisted-by: Fairy
2026-10-22 12:17:34 +00:00
Kieran Kunhya
a2ff5eb55f avcodec/hevc/pred_template: substitute out-of-picture samples with constrained intra pred
When the bottom-left (or top-right) reference samples cross the picture
edge, the part outside the picture was filled from the last in-picture
sample before the constrained_intra_pred substitution, which only runs up
to the picture edge. If that sample belongs to an inter CU, its raw value
stayed in the out-of-picture part instead of the substituted one
(8.4.4.2.2), and the prediction no longer matched the encoder or HM.

Seen with x265 at 1080p, 64x64 CTBs and constrained intra prediction:
TUs in the partial bottom CTB row next to inter CUs mismatch from there
on.
2026-10-22 11:46:09 +00:00
lusoris
bf0e831606 doc/encoders: add a section for the NVENC encoders
h264_nvenc, hevc_nvenc and av1_nvenc had no entry in encoders.texi.
Document them in one section: hardware input and devices, the generic
options they map, the options common to all three (presets and tuning,
rate control, lookahead, AQ and B-frames, SEI and side data), and the
options specific to each codec.

Option names, named values, ranges and defaults follow the AVOption
tables in nvenc_h264.c, nvenc_hevc.c and nvenc_av1.c, checked against
ffmpeg -h encoder=<name> from a build against nv-codec-headers 13.1.
Options that depend on the SDK version state the version they need.

Signed-off-by: lusoris <lusoris@proton.me>
2026-10-22 04:32:31 +00:00
Stefan Singer
9295e3ef65 avfilter/whisper: include detected language in JSON output
The whisper filter exposes segment timestamps and text in JSON but omits the language selected by whisper.cpp. Clients consuming multilingual transcripts cannot distinguish the language of each transcription chunk without detecting it again.

Read whisper_full_lang_id() after each successful transcription and include its language code in JSON segments when available. This leaves the configured language and audio-frame metadata unchanged. Document that the code applies to the whole chunk, not to individual segments.

Tested with a minimal --enable-whisper build, make fate (without external SAMPLES), and a local WAV transcription using a multilingual tiny model.

Signed-off-by: Stefan Singer <stefan.singer@quartr.se>
2026-10-22 04:31:40 +00:00
Marvin Scholz
23918b3200 avcodec: nellymoser: reject invalid sample rate
Nellymoser expects the caller to set the samplerate, as it
doesn't read it from the bitstream. However the generic check
for this is bypassed as it has the AV_CODEC_CAP_CHANNEL_CONF
capability because it does set the channel configuration,
however that cap also bypasses the generic samplerate check.

This is mostly harmless as nellymoser doesn't care about the
samplerate, but since f566032bfd it would cause an AVERROR_BUG
to be returned to the caller, so better reject it outright in
the decoder.

Signed-off-by: Marvin Scholz <epirat07@gmail.com>
2026-10-22 03:14:59 +00:00
Romain Beauxis
8191fa0b8c avformat/hls: accept EXT-X-START in Master Playlists
EXT-X-START may appear in both Master and Media Playlists (RFC 8216
4.3.5.2). Parsing it allocated a Media Playlist, so a Master Playlist
carrying it before its EXT-X-STREAM-INF entries was rejected since
0e6eef3551.

Record the offset while parsing and apply it once the playlist type is
known. A value from a Master Playlist applies to all its Media
Playlists, which then ignore their own, as RFC 8216 4.3.5 recommends.

Defer EXT-X-ENDLIST the same way, so that it is not lost when it
precedes the first tag allocating the Media Playlist.
2026-10-22 02:51:14 +00:00
Romain Beauxis
a4dbdc7333 fate/libavformat: add hls-parse tests
A Master Playlist carrying EXT-X-START before its variants is rejected
with "Master Playlist tag found in a Media Playlist", as recorded in the
master-start references.

The media-start-endlist and master-media-start cases record behaviour
that must be kept: an EXT-X-ENDLIST following EXT-X-START, and a start
offset carried only by a Media Playlist.
2026-10-22 02:51:14 +00:00
Romain Beauxis
1b552f55db libavformat/tests: add an HLS playlist parsing test program
Parse a playlist, then optionally a Media Playlist into the first
playlist it declared, as hls_read_header() does, and print the parsed
playlists with their finished state and EXT-X-START offset.
2026-10-22 02:51:14 +00:00
Michael Niedermayer
5fd305b8f4 avfilter/firequalizer: avoid overflow selecting RDFT length
The nsamples_max doubling can overflow int for an accepted delay, causing an undersized RDFT and an out-of-bounds write during kernel generation. Compare in int64_t so excessive delays take the existing error path.

Add a FATE check for the reported delay.

Fixes: #24344
Reported-by: yijan4845
Assisted-by: Fairy
2026-10-22 01:26:03 +00:00
Kacper Michajłow
8cc7403a43 configure: do not enable leftover funcs in check_class_headers_cxx
The function probes classes and not function. This was copy paste error
that ended up here.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2026-10-21 23:31:13 +00:00
Kacper Michajłow
4288315738 configure: store probed symbols in a volatile intptr_t
Cast each probed symbol to intptr_t and store it in a static volatile
object instead of casting it to long in a wrapper function whose address
main() masks. The volatile stores keep the references under LTO and
intptr_t avoids the pointer truncation warnings on LLP64 targets
(-Wpointer-to-int-cast). Also deduplicate it with check_host_lib.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2026-10-21 23:31:13 +00:00
James Almer
9e6f96bac1 avformat/movenc: wrap AVIF specific functions with a preprocessor check
Signed-off-by: James Almer <jamrial@gmail.com>
2026-10-21 18:35:41 -03:00
James Almer
bcb0ac1d9d avformat/movenc: flag the alpha image in AVIF as hidden
Signed-off-by: James Almer <jamrial@gmail.com>
2026-10-21 18:35:41 -03:00
James Almer
7461dbcb55 avformat/movenc: use bitstream information to write AVIF parameters if needed
If the pixel format is a hardware one, components will be unset, and we will
end up writing an invalid pixi box.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-10-21 18:35:41 -03:00
James Almer
e4eee6c222 tests/fate/mov: add a simple muxing test for AVIF
Signed-off-by: James Almer <jamrial@gmail.com>
2026-10-21 18:35:41 -03:00
Marcos Ashton Iglesias
9bab434b5f avcodec/x86/vvc: add AVX2 pred_planar
Widths 4 to 64 at 8 bit, with the height a runtime argument as in the
C code. Factoring 2^min(logw,logh) out of the numerator keeps the whole
kernel in words: the largest intermediate is 32704, when max(w,h) is 64.
The term that is linear in y is carried as a running accumulator, so a
row costs one pmullw and three shifts per column group. Widths 32 and 64
run two column groups per pass and write a row with a single 32 byte
store.

checkasm --bench on a Core Ultra 7 155H:

vvc_pred_planar_4x4_8_c:          63.0
vvc_pred_planar_4x4_8_avx2:       20.3 ( 3.10x)
vvc_pred_planar_8x8_8_c:         216.7
vvc_pred_planar_8x8_8_avx2:       35.6 ( 6.09x)
vvc_pred_planar_16x16_8_c:       966.4
vvc_pred_planar_16x16_8_avx2:     80.3 (12.03x)
vvc_pred_planar_32x32_8_c:      3032.7
vvc_pred_planar_32x32_8_avx2:    251.5 (12.06x)
vvc_pred_planar_64x64_8_c:     10389.9
vvc_pred_planar_64x64_8_avx2:    967.1 (10.74x)
2026-10-21 21:21:22 +00:00
Hankang Li
724c1e0061 tests/checkasm: Add checkasm test for vvc intra prediction
Covers pred_dc, pred_planar, pred_v, pred_h, pred_mip and both
pred_angular functions for every block shape from 4x4 to 64x64 at 8, 10
and 12 bit. Only pred_planar has asm so far, added in the next commit;
the other checks are skipped until there is asm for them.

This is the test from #22808, squashed. Changes from it: top_buf and
left_buf are sized for 16 bit samples, 778 bytes rather than 405, which
randomize_buffers() overran; bit_depth is declared in its loop;
mode_category is always set; top and left are filled independently, so
swapping the edges fails; pred_planar is tested down to a height of 1,
which ISP splits and chroma produce.

Co-authored-by: Marcos Ashton Iglesias <marcosashiglesias@gmail.com>
2026-10-21 21:21:22 +00:00
Nicholas Carlini
847acdff18 avcodec/hevc: re-validate non-base layer SPS when the base SPS changes
Fixes: out of array access
Fixes: Ot8zjwCVrunh
Regression since: f926b60455

Found-by: Nicholas Carlini <nicholas@carlini.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-10-21 20:27:40 +00:00
Michael Niedermayer
8540c00f1b avcodec/hevc: keep the active VPS when clearing a layer's SPS
set_sps() with a NULL SPS released s->vps before returning, also when only
a non-base layer was cleared while the base layer keeps decoding. The next
base-layer frame then dereferenced the NULL VPS in ff_hevc_is_alpha_video().
Release s->vps only when a new SPS is installed alongside it.

Assisted-by: Fairy
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-10-21 20:27:40 +00:00
Michael Niedermayer
9d106b2bb5 avutil/tests/hwcontext_cuda: test transfers of bottom-up frames
Upload from and download into frames with negative linesizes, in
every combination with top-down ones.

Assisted-by: Claude
2026-10-21 19:32:23 +00:00
Michael Niedermayer
0bcba575db avutil/hwcontext_cuda: support frames with negative linesizes
A bottom-up software frame, as vflip produces, was handed to
cuMemcpy2DAsync() with its negative linesize as the pitch and copy
width, which the driver rejected, so uploading or downloading such a
frame failed.

The device only copies rows upwards through memory, so transfer such a
frame through a top-down copy of it in a transfer buffer.

Fixes: ogLupSp7oZ6D
Found-by: Joshua Rogers <joshua.rogers@aisle.com>
Assisted-by: Claude
2026-10-21 19:32:23 +00:00
Michael Niedermayer
8493e8bad3 avfilter/vf_hwupload_cuda: give the preceding filter transfer buffers to write into
The frames a filter in front of hwupload_cuda produces are allocated
with av_hwframe_get_transfer_buffer(), so that the upload reads from
memory the device transfers directly from.

Assisted-by: Claude
2026-10-21 19:32:23 +00:00
Michael Niedermayer
7e99475ce9 avfilter/video: factor set_link_props() out of ff_default_get_video_buffer2()
Assisted-by: Claude
2026-10-21 19:32:23 +00:00
Michael Niedermayer
4d218e16d4 avutil/hwcontext_cuda: allocate transfer buffers from page-locked memory
The device transfers directly to and from page-locked host memory,
while pageable memory is copied through a buffer of the driver.
Pageable memory remains in use when page-locked memory cannot be
allocated and with ffnvcodec headers that lack cuMemHostAlloc().

As a page-locked source is read by the device after the upload
returns, uploads now wait for the transfer to complete, like downloads.

ffmpeg -hwaccel cuda -i hevc.mp4 -f null - on a RTX 5090, mean of 10
runs: 1080p 1773 -> 1855 fps, 2160p 497 -> 533 fps, 4320p 112 -> 124 fps.

Assisted-by: Claude
2026-10-21 19:32:23 +00:00
Michael Niedermayer
e9d2baffa4 avutil/hwcontext: let the hardware context type allocate transfer buffers
A device may transfer faster to or from memory it allocated itself
than ordinary memory.

Assisted-by: Claude
2026-10-21 19:32:23 +00:00
Michael Niedermayer
5ac6d116e7 avutil/hwcontext: pool the frames av_hwframe_transfer_data() allocates
A destination frame without buffers was allocated anew for every
download. For large frames the allocation costs more than the
transfer.

ffmpeg -hwaccel cuda -i hevc.mp4 -f null - on a RTX 5090, mean of 10
runs: 2160p 390 -> 497 fps, 4320p 33 -> 112 fps, 1080p unchanged at
1772 fps.

Assisted-by: Claude
2026-10-21 19:32:23 +00:00
Michael Niedermayer
b8249f73a7 avutil/hwcontext: add av_hwframe_get_transfer_buffer()
It allocates the buffers of a software frame used for a transfer to or
from a hardware frames context out of a pool kept by that context.

Assisted-by: Claude
2026-10-21 19:32:23 +00:00
Michael Niedermayer
501d815ec4 avutil/frame: let libavutil allocate a video frame's buffer with its own allocator
ff_frame_get_video_buffer() lays a video frame out like
av_frame_get_buffer() does, but takes the buffer from a callback, so
that the memory can come from a pool or from a device specific
allocator.

Assisted-by: Claude
2026-10-21 19:32:23 +00:00
Marvin Scholz
8319541103 avcodec/aac: fix null dereference in che_configure
During USAC decoding (ff_aac_usac_decode_frame), configuration elements
can be mapped and instantiated via che_configure(). For newly allocated
ChannelElement structs, che_configure calls sbr_ctx_alloc_init() which
dynamically allocates ac->che[type][id]. However, che_configure did not
subsequently map the output pointer of the nested SingleChannelElement
elements back to their statically-sized internal ret_buf arrays, causing
a null pointer dereference during IMDCT windowing.

The fix explicitly initializes these pointers following allocation.

Signed-off-by: Marvin Scholz <epirat07@gmail.com>
2026-10-21 19:13:48 +00:00
Marvin Scholz
3a5eb948e7 avcodec/mvcdec: zero-initialize color array
Fixes MSAN use-of-uninitialized-value.

Signed-off-by: Marvin Scholz <epirat07@gmail.com>
2026-10-21 19:06:35 +00:00
Zhao Zhili
adfe258a6a aarch64/h26x: share the qpel_uni_w narrowing across widths
The weighted narrowing after the horizontal filter was repeated at every
width. Sharing one stage at a time rather than a whole block at a time
keeps the serial sqxtn/sqxtn2/sqxtun chain of a block from stalling an
in-order core.
2026-10-21 17:53:37 +00:00
Zhao Zhili
b9305c490f aarch64/h26x: fold qpel horizontal variant tails into macros
post_h_2reg and post_h_4reg hold the blend-and-narrow sequence shared by
the qpel_uni and qpel_bi width wrappers.
2026-10-21 17:53:37 +00:00
Zhao Zhili
5ac09008c8 avcodec/mediacodecdec_common: drop the MediaTek crop workaround
MediaTek decoders report a default crop rectangle in the initial output
format, and the workaround stopped reading the "crop" rectangle from
them on the NDK path so that the default did not reach the codec
context. The initial format no longer sets the crop rectangle of the
codec context, while the workaround also discards the correct rectangle
these decoders report with INFO_OUTPUT_FORMAT_CHANGED, which leaves the
frames at the full width and height of the output buffers.

This reverts commit 7fe9d12f25.
2026-10-21 17:39:04 +00:00
Zhao Zhili
379f568b5c avcodec/mediacodecdec_common: ignore stream info of the initial format
Until the codec signals INFO_OUTPUT_FORMAT_CHANGED, MediaCodec returns
the output format set up at configure time. The decoder parsed that
format right after start() and copied its crop rectangle, display size
and color description into the codec context, although at that point
the codec has not decoded anything and these fields hold its defaults.
For a 1920x1080 HLG stream, c2.xring.hevc.decoder reports the crop
rectangle Rect(0, 0, 175, 143) and BT.601 SDR color there, and MediaTek
decoders report rectangles such as Rect(0, 0, 318, 238). Callers reading
the codec context after avcodec_open2() got 176x144 or 319x239 and a
wrong color description instead of the stream properties.

Keep the values set by the caller until the codec signals a format
change. The pixel format is still taken from the initial format, as it
reflects the configuration. If the first output buffer arrives without
a format change, the initial format describes the decoded frames and is
applied at that point.
2026-10-21 17:39:04 +00:00
Zhao Zhili
23045b25ed compat/w32pthreads: drop the cancellation stubs
0830e9116f added pthread_setcancelstate() and the PTHREAD_CANCEL_*
values for the udp receive thread, which is no longer cancelled and
does not call them. No other file refers to them.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2026-10-21 17:37:13 +00:00