1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-10 06:10:52 +02:00
Commit Graph

120467 Commits

Author SHA1 Message Date
Kacper Michajłow
5c95e8e3a6 avcodec/srtenc: don't produce SRT files with mixed line endings
Initially, avcodec/srtenc.c was outputting CRLF [1]. Later, a real SRT
muxer was added [2], which outputs LF. The original srtenc.c was
converted to use the muxer [3], changing its output to LF, except for
newline characters within subtitle text.

Fix this to avoid producing SRT files with mixed line endings.

[1] 8e43b6fed9
[2] 9e63c30daa
[3] 55180b3299

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2025-08-03 17:27:35 +00:00
James Almer
5bd7003e81 avformat/mov: move AVC-Intra extradata generation to earlier in the stsd parsing process
This will ensure it will be stored in the stream's private context, so it can
be fetched and replaced as required.

Fixes a regression since eefa6de7d5.
Fixes avc-intra-panasonic-AG-HPX301E.mov

Signed-off-by: James Almer <jamrial@gmail.com>
2025-08-03 16:06:43 +00:00
James Almer
999e3e9bf8 avformat/mov: don't set stsc_count for item streams before the array is allocated
Signed-off-by: James Almer <jamrial@gmail.com>
2025-08-03 13:00:03 -03:00
James Almer
89187a84d3 avformat/mov: free streams earlier on error when parsing infe boxes
Fixes clusterfuzz-testcase-minimized-fuzzer_loadfile-5365661771825152.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-08-03 13:00:03 -03:00
James Almer
11a5333980 avformat/mov: free AVBPrint on error when parsing infe boxes
Should fix memleaks.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-08-03 13:00:03 -03:00
Michael Niedermayer
44864dbbb9 avcodec/vqavideo; Check bytestream2_get_buffer() reading next_codebook_buffer
Fixes: use of uninintilaized memory
Fixes: 423673969/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VQA_fuzzer-6235973619351552

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-08-03 13:19:25 +00:00
Michael Niedermayer
7e9e7cb3b6 avcodec/iff: Clear ham_buf
Fixes: use of uninitialized memory
Fixes: 423673969/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-6651797156724736

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-08-03 13:19:25 +00:00
Michael Niedermayer
715df4b1ff avcodec/imc: Clear padding of buf16
Fixes: use of uninitialized memory
Fixes: 423673969/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IAC_fuzzer-6685890556788736

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-08-03 13:19:25 +00:00
Michael Niedermayer
ea3851bebf avcodec/cri: Check bytestream2_get_buffer() for end
Fixes: use of uninintialized memory
Fixes: 423673969/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CRI_fuzzer-5910856640823296

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-08-03 13:19:25 +00:00
Michael Niedermayer
d9bf3c141b avcodec/cri: Factor read_len out
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-08-03 13:19:25 +00:00
Michael Niedermayer
610d368d9b avcodec/lzf: Check for input space
Fixes: use of uninitialized memory
Fixes: 423673969/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_NOTCHLC_fuzzer-5597015691296768

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-08-03 13:19:25 +00:00
Michael Niedermayer
1687daa93c avcodec/fits: Clear naxis
Fixes: Use of uninitialized memory
Fixes: 423673969/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FITS_DEC_fuzzer-5602250833854464

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-08-03 13:19:25 +00:00
Timo Rothenpieler
16d663d371 forgejo/workflows: add pre-commit based linting 2025-08-03 13:48:47 +02:00
Timo Rothenpieler
262d41c804 all: fix typos found by codespell 2025-08-03 13:48:47 +02:00
Timo Rothenpieler
8d439b2483 all: fix whitespace/new-line issues 2025-08-03 13:48:47 +02:00
Michael Niedermayer
ce0a655f85 avformat/dashdec: Allocate space for appended "/"
Fixes: writing 1 byte over the end of the array
Fixes: BIGSLEEP-433502298/test.xml

Found-by: Google Big Sleep

A prettier solution is welcome!
A testcase exists only for the baseurl case

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-08-03 00:31:12 +02:00
Kacper Michajłow
ff52147f59 avutil/hwcontext_qsv: fix format specifier for HRESULT
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2025-08-02 22:25:28 +00:00
Kacper Michajłow
1a9924d794 avcodec/amfenc: remove unused variables
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2025-08-02 22:25:28 +00:00
Kacper Michajłow
a27c329487 avcodec/ffv1: align function declaration with definition
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2025-08-02 22:25:28 +00:00
Peter Ross
518d9f0dd4 avcodec/g728dec: align static arrays to 32-byte boundary
fixes crash observed on x86_64-apple-darwin23.6.0 / clang-1500.3.9.4

Signed-off-by: Peter Ross <pross@xvid.org>
2025-08-02 21:36:36 +00:00
Michael Niedermayer
aca41d3d93 swscale/output: Fix all bilinear integer overflows
Ticket11686 hinted at one of these overflows
this fixes them all

Issue in line 1325/1326 found by HAORAN FANG <xfanghaoran@gmail.com>

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-08-02 16:26:33 +00:00
Michael Niedermayer
c44d237d80 swscale/output: Fix integer overflow with lum/chr/alpha filter
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-08-02 16:26:33 +00:00
Frank Plowman
f82748d5e0 lavc/vvc: Mark SPS used if multiple CLVSSs use it
Consider the following sequence of NALUs (with some PPSs etc. omitted
for brevity):
1. SPS (ID=0, content=A)
2. IDR (SPS=0)
3. IDR (SPS=0)
4. SPS (ID=0, content=B)
5. TRAIL (SPS=0)

When decode_sps is called for NALU 3., ps->sps_id_used is cleared as
IDRs are one way of forming a CLVSS.  Then, old_sps is non-NULL
containing the result of calling decode_sps for NALU 2.  We haven't
received any SPSs between NALUs 2. and 3., therefore old_sps and rsps
are identical and the function returns.  The issue is that, at this
point, ps->sps_id_used is still zero despite the SPS being used for IDR
3.  This results in the check for conflicting SPSs not working properly
when decode_sps is called for NALU 5., allowing prediction between
pictures with different SPSs and probably all sorts of other
shenanigans.

Patch addresses the problem outlined above by also setting
ps->sps_id_used in the early return case.
2025-08-02 15:04:39 +00:00
vytskalt
2e19e74a29 hwcontext_vulkan: transfer exclusive images to correct queue family in drm->vulkan mapping 2025-08-02 11:02:59 +03:00
averne
bf79148cbb avcodec/proresenc_anatoliy: Remove support for grayscale flag
This results in the encoder producing empty scans for chroma planes,
which is illegal according to the ProRes SMPTE document.
2025-08-02 06:11:39 +00:00
averne
a49108fd29 avcodec/proresdec: Remove grayscale hack
This was introduced in commit 9c43703, to support a codec "extension"
in the prores_aw encoder.
This removes the chroma fill loop, and instead performs the inverse
transform on null coefficients, which achieves the same result and
fixes an off-by-one in the chroma values produced.

Updated test to reflect this change.
2025-08-02 06:11:39 +00:00
James Almer
2b522f537f avformat/mov: add extra sanity checks before setting the primary extradata
Signed-off-by: James Almer <jamrial@gmail.com>
2025-08-01 19:35:43 +00:00
Timo Rothenpieler
c6b3aae0ee avfilter/vf_scale_d3d11: remove unused variable 2025-08-01 20:49:57 +02:00
Timo Rothenpieler
6115f03939 avcodec/mfenc: remove unused variables 2025-08-01 20:49:57 +02:00
Timo Rothenpieler
e5275dbc96 avcodec/mfenc: fix compilation on modern gcc/clang 2025-08-01 20:49:57 +02:00
Timo Rothenpieler
18174cbae8 forgejo/workflows: add compile-only test for win64 2025-08-01 20:49:57 +02:00
James Almer
9aed7383bd avformat/movenc: look for the Intra profile flag before assuming a stream is AVC-Intra
Fixes issue #20018.

Note that Codec Descriptors are not written for all these ai** codec tags, and no
considerations were ever made to ensure parameter sets are present in muxed packets.
Their usage may result in unplayable files if parameter sets are only available
in extradata (Default behavior for x264 encoding when combined with this muxer).

Signed-off-by: James Almer <jamrial@gmail.com>
2025-08-01 14:53:17 +00:00
Michael Niedermayer
ab73bd94a3 avcodec/sanm: Checks related to negative left/top
Fixes: 423673969/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SANM_fuzzer-5466731806261248
Fixes: out of array access

Reviewed-by: Manuel Lauss <manuel.lauss@gmail.com>
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-08-01 16:39:07 +02:00
Michael Niedermayer
b849ac006b avcodec/mpegvideo_dec: Fix lowres=3 field select interlaced mpeg4 frame
Fixes: out of array read in the chroma plane
Fixes: 428034092/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG4_DEC_fuzzer-5582608941776896.test

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-08-01 01:41:26 +02:00
Timo Rothenpieler
2d64d1129f forgejo/workflows: only upload cache if key changed 2025-07-31 22:57:35 +00:00
Kacper Michajłow
901e23675b forgejo/workflows: enable gpl, nonfree and memory poisoning
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2025-07-31 22:03:20 +00:00
Dash Santosh
1e5488951b avcodec/mfenc: propagate error codes properly 2025-07-31 21:07:51 +00:00
Dash Santosh
bd18a6a9e0 avfilter/scale_d3d11: cleanup return path using fail label 2025-07-31 21:07:51 +00:00
Dash Santosh
d56522c6eb avcodec/mfenc: add support for D3D11 input surfaces
Adds D3D11 input surface support to the MediaFoundation encoder (mfenc),
allowing direct encoding of GPU frames without readback to system memory.
This improves performance and compatibility when used alongside scale_d3d11.

Signed-off-by: Dash Santosh <dash.sathyanarayanan@multicorewareinc.com>
2025-07-31 21:07:51 +00:00
Dash Santosh
96821211c2 avfilter: add scale_d3d11 filter
This commit introduces a new hardware-accelerated video filter, scale_d3d11,
which performs scaling and format conversion using Direct3D 11. The filter enables
efficient GPU-based scaling and pixel format conversion (p010 to nv12), reducing
CPU overhead and latency in video pipelines.
2025-07-31 21:07:51 +00:00
Dale Curtis
2ddc3cbd98 avcodec/flacdsp: Fix integer-overflow in flac_lpc_33_c
This fix copies a couple of casts from surrounding functions.
See https://crbug.com/432528781 for stack trace details.

Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-07-31 20:25:15 +02:00
Dariusz Frankiewicz
9d8469e431 avcodec/apv: align APV color format support with latest liboapv version
Signed-off-by: Dariusz Frankiewicz <d.frankiewic@samsung.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-07-31 20:24:40 +02:00
Niklas Haas
03b9180fe3 avfilter/avfiltergraph: add logging for filter formats
There is no convenient way, from the command line, to figure out which
formats a filter actually supports. This commit changes that by adding a
log output, at debug level, to simply print the list of formats each filter
advertises on its links, before any negotiation.

Furthermore, we can use the exact same helper function to also print out the
corresponding filter links when there is an error during format negotiation.

We need to use AV_BRINT_SIZE_UNLIMITED because the default format list for
filters like vf_scale is about 1700 characters long, significantly larger than
the the 1 kB default buffer.
2025-07-31 12:35:32 +00:00
sfan5
1a61db9797 avformat/file: add missing null check in Android content resolver
openFileDescriptor() can return null in certain error conditions.

Signed-off-by: sfan5 <sfan5@live.de>
Reviewed-by: Kacper Michajłow <kasper93@gmail.com>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2025-07-31 19:54:58 +08:00
Zhao Zhili
2a49d05d1a avfilter/vf_vibrance: Update default value of rlum/blum
Fix #9195

It looks like vf_vibrance.c is similar to
https://github.com/zachsaw/RenderScripts/blob/master/RenderScripts/ImageProcessingShaders/SweetFX/Vibrance.hlsl
and
https://github.com/kevinlekiller/kwin-effect-shaders_shaders/blob/main/Vibrance.frag
Originall written by Christian Cann Schuldt Jensen ~ CeeJay.dk.

They use same matrix coeff.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2025-07-31 19:51:23 +08:00
Niklas Haas
b7946098b1 swscale/alphablend: don't overread alpha plane on subsampled odd size
This function overreads the input plane for odd dimensions, because the
chroma plane is always rounded up, which means (xy << subsample) + 1 exceeds
the actual alpha plane size.

To verify:
  valgrind ffmpeg -pix_fmt yuva420p -f lavfi -i color -vf \
  "scale=1x1,format=yuva420p,scale=alphablend=uniform_color,format=yuv420p \
  -vframes 1 -f null -

Fixes: https://trac.ffmpeg.org/ticket/11692
2025-07-31 11:32:20 +00:00
Vittorio Giovara
119d127d05 lavu/spherical: Add support for Spherical Immersive type 2025-07-31 10:58:36 +02:00
Vittorio Giovara
c275f3bfa1 mov: Export frame packing information from pack box 2025-07-31 10:49:27 +02:00
zhaozhenghang
eade338656 libavformat/mov.c: Fix "statement will never be executed" warning
That occurs when H261, H263, and MPEG4 decoders are disabled.

Signed-off-by: zhaozhenghang <15083277223@163.com>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2025-07-31 11:13:04 +08:00
James Almer
1cbf7fc434 tests/fate/mov: add a test muxing multiple stsd entries
Signed-off-by: James Almer <jamrial@gmail.com>
2025-07-30 16:48:14 -03:00