1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00
Commit Graph

120450 Commits

Author SHA1 Message Date
7771a4eecb fftools/textformat: remove leftover comments in mermaid_print_value
Remove some leftover commented code and an extraneous semicolon.

Reviewed-by: softworkz <softworkz@hotmail.com>
2025-06-26 23:23:35 +02:00
0578d4ad2f fftools/textformat: exit early in mermaid_print_value
Doesn't change the logic, instead of exiting in each of the two
branches below, just exit before.

Reviewed-by: softworkz <softworkz@hotmail.com>
2025-06-26 23:23:35 +02:00
540a2497d2 lavc/vvc: Fix condition for using default scaling factor
Add handling here for
sps_scaling_matrix_for_alternative_colour_space_disabled_flag.

Also add parentheses to make behaviour a little more explicit,
where &&'s precedence over || was relied on previously.

Reported-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Frank Plowman <post@frankplowman.com>
2025-06-27 06:06:14 +09:00
f8a9d9473b avformat/whip: check the exchange sdp url is start with http
Make sure the WHIP protocol performs the SDP offer/answer
exchange with the WebRTC peer over HTTP.

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
Reviewed-by: Jack Lau <jacklau1222@qq.com>
2025-06-26 22:20:07 +02:00
87808e38a8 avformat/whip: Remove unnecessary pkt checks
h264_annexb_insert_sps_pps (called after write_packet)
reorganizes PPS, SPS, and IDR packets in H.264 streams.
Since write_packet already validates pkt,
redundant null checks in h264_annexb_insert_sps_pps can be removed.

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
Reviewed-by: Marvin Scholz <epirat07@gmail.com>
2025-06-26 21:46:18 +02:00
1abc25cd23 avformat/iamf_parser: remove unreachable code
expanded_loudspeaker_layout is only present and read on the first layer.

Fixes Coverity issue #1655173.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-06-26 16:33:04 -03:00
bd75fad85f hwcontext_vulkan: fix issues with importing a device
The previous fix just used a local variable for the memory properties,
which did not fix this issue.
2025-06-27 03:09:27 +09:00
f744584f71 avformat/tee: fix multiple bsfs in tee
Since 155508c6e9 specifying multiple
bsfs for different streams was broken:

"[bsfs/a=h264_metadata:bsfs/v=h264_metadata]out.mp4|..."

This incorrectly only parsed the first bsfs specification. The reason
for this is that the dictionary is modified in the iterator, hence
invalidating the iterator. The simplest fix for this is to simply
iterate from the beginning in each loop given that the previous entry
is removed.
2025-06-26 17:35:46 +02:00
64fce7202c acvodec/amfenc: Enable use of AMF Surface in multiple encoders
Fixes the behavior of AMF encoders when the same AMF surface is passed
to multiple encoder objects.
for example when using -filter_complex
2025-06-26 13:48:26 +02:00
b2c0d37be5 avcodec/amfdec: Add VP9 AMF decoder 2025-06-26 13:48:15 +02:00
09cd38e9d5 avcodec/rv60dec: drop unused sum variable in read_slice_sizes
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Peter Ross <pross@xvid.org>
2025-06-26 18:01:03 +10:00
0ffe97d9b9 avformat/mov: Check that sample_count is allocated in mov_parse_heif_items()
Fixes: NULL pointer dereference
Fixes: 416811958/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5425269114732544

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-26 00:40:49 +02:00
36c8eef42c avformat/iamfdec: remove unused variables after recent changes
Fixes -Wunused-but-set-variable warnings

Signed-off-by: James Almer <jamrial@gmail.com>
2025-06-24 20:15:20 -03:00
61773e761e avformat/iamf_writer: fix layout checks when demixing_info is not present
Fixes -Wtautological-overlap-compare warnings

Signed-off-by: James Almer <jamrial@gmail.com>
2025-06-24 19:49:18 -03:00
cbb72e6ab6 avformat/iamf_writer: use named constants in more places
Signed-off-by: James Almer <jamrial@gmail.com>
2025-06-24 14:41:43 -03:00
38f9fbe30d avformat/iamf_writer: reindent after previous commit
Signed-off-by: James Almer <jamrial@gmail.com>
2025-06-24 14:41:43 -03:00
75c514e468 avformat/iamf_writer: add extra constrains for Parameter Sets in Audio Elements
Signed-off-by: James Almer <jamrial@gmail.com>
2025-06-24 14:41:43 -03:00
a3a7b8edc9 avformat/iamf_writer: factor out getting loudspeaker_layout values
Signed-off-by: James Almer <jamrial@gmail.com>
2025-06-24 14:41:43 -03:00
cd2461e627 avformat/iamf: fix setting channel layout for Scalable layers
The way streams are coded in an IAMF struct follows a scalable model where the
channel layouts for each layer may not match the channel order our API can
represent in a Native order layout.

For example, an audio element may have six coded streams in the form of two
stereo streams, followed by two mono streams, and then by another two stereo
streams, for a total of 10 channels, and define for them four scalable layers
with loudspeaker_layout values "Stereo", "5.1ch", "5.1.2ch", and "5.1.4ch".
The first layer references the first stream, and each following layer will
reference all previous streams plus extra ones.
In this case, the "5.1ch" layer will reference four streams (the first two
stereo and the two mono) to encompass six channels, which does not match out
native layout 5.1(side) given that FC and LFE come after FL+FR but before
SL+SR, and here, they are at the end.

For this reason, we need to build Custom order layouts that properly represent
what we're exporting.

----
Before:

  Stream group #0:0[0x12c]: IAMF Audio Element:
    Layer 0: stereo
      Stream #0:0[0x0]: Audio: opus, 48000 Hz, stereo, fltp (default)
    Layer 1: 5.1(side)
      Stream #0:0[0x0]: Audio: opus, 48000 Hz, stereo, fltp (default)
      Stream #0:1[0x1]: Audio: opus, 48000 Hz, stereo, fltp (dependent)
      Stream #0:2[0x2]: Audio: opus, 48000 Hz, mono, fltp (dependent)
      Stream #0:3[0x3]: Audio: opus, 48000 Hz, mono, fltp (dependent)
    Layer 2: 5.1.2
      Stream #0:0[0x0]: Audio: opus, 48000 Hz, stereo, fltp (default)
      Stream #0:1[0x1]: Audio: opus, 48000 Hz, stereo, fltp (dependent)
      Stream #0:2[0x2]: Audio: opus, 48000 Hz, mono, fltp (dependent)
      Stream #0:3[0x3]: Audio: opus, 48000 Hz, mono, fltp (dependent)
      Stream #0:4[0x4]: Audio: opus, 48000 Hz, stereo, fltp (dependent)
    Layer 3: 5.1.4
      Stream #0:0[0x0]: Audio: opus, 48000 Hz, stereo, fltp (default)
      Stream #0:1[0x1]: Audio: opus, 48000 Hz, stereo, fltp (dependent)
      Stream #0:2[0x2]: Audio: opus, 48000 Hz, mono, fltp (dependent)
      Stream #0:3[0x3]: Audio: opus, 48000 Hz, mono, fltp (dependent)
      Stream #0:4[0x4]: Audio: opus, 48000 Hz, stereo, fltp (dependent)
      Stream #0:5[0x5]: Audio: opus, 48000 Hz, stereo, fltp (dependent)

----
AFter:

  Stream group #0:0[0x12c]: IAMF Audio Element:
    Layer 0: stereo
      Stream #0:0[0x0]: Audio: opus, 48000 Hz, stereo, fltp (default)
    Layer 1: 6 channels (FL+FR+SL+SR+FC+LFE)
      Stream #0:0[0x0]: Audio: opus, 48000 Hz, stereo, fltp (default)
      Stream #0:1[0x1]: Audio: opus, 48000 Hz, stereo, fltp (dependent)
      Stream #0:2[0x2]: Audio: opus, 48000 Hz, mono, fltp (dependent)
      Stream #0:3[0x3]: Audio: opus, 48000 Hz, mono, fltp (dependent)
    Layer 2: 8 channels (FL+FR+SL+SR+FC+LFE+TFL+TFR)
      Stream #0:0[0x0]: Audio: opus, 48000 Hz, stereo, fltp (default)
      Stream #0:1[0x1]: Audio: opus, 48000 Hz, stereo, fltp (dependent)
      Stream #0:2[0x2]: Audio: opus, 48000 Hz, mono, fltp (dependent)
      Stream #0:3[0x3]: Audio: opus, 48000 Hz, mono, fltp (dependent)
      Stream #0:4[0x4]: Audio: opus, 48000 Hz, stereo, fltp (dependent)
    Layer 3: 10 channels (FL+FR+SL+SR+FC+LFE+TFL+TFR+TBL+TBR)
      Stream #0:0[0x0]: Audio: opus, 48000 Hz, stereo, fltp (default)
      Stream #0:1[0x1]: Audio: opus, 48000 Hz, stereo, fltp (dependent)
      Stream #0:2[0x2]: Audio: opus, 48000 Hz, mono, fltp (dependent)
      Stream #0:3[0x3]: Audio: opus, 48000 Hz, mono, fltp (dependent)
      Stream #0:4[0x4]: Audio: opus, 48000 Hz, stereo, fltp (dependent)
      Stream #0:5[0x5]: Audio: opus, 48000 Hz, stereo, fltp (dependent)

Signed-off-by: James Almer <jamrial@gmail.com>
2025-06-24 14:41:43 -03:00
e5f23a3c5e tests/iamf: rename BACK to SIDE filterchain labels in the 5.1.4 iamf tests
Cosmetic change to reflect the actual channels used in the layouts.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-06-24 14:41:43 -03:00
534eb7260a tests/iamf: reorder muxed streams
Follows the proper order defined by the spec, even if mostly cosmetic, and is
also preparation for a following change.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-06-24 14:41:43 -03:00
13e81dbd27 avformat/iamf_parse: try to retype the channel layout for ambisonics_mode == 0
In most cases, the channel ids will match the standard Ambisonic Order, saving us the
need to use a custom order layout.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-06-24 14:41:43 -03:00
9b5abbf387 avformat/iamf_writer: ensure each layer's channel layout contains all channels from the previous one
Signed-off-by: James Almer <jamrial@gmail.com>
2025-06-24 14:41:43 -03:00
a7beac704b avformat/iamf_parse: prevent overreads in update_extradata
Fixes: libavcodec/put_bits.h:232:32: runtime error: shift exponent -19 is negative
Fixes: Assertion n>=0 && n<=32 failed at ./libavcodec/get_bits.h:406
Fixes: 398527871/clusterfuzz-testcase-minimized-ffmpeg_dem_IAMF_fuzzer-6602025714647040

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: James Almer <jamrial@gmail.com>
2025-06-24 14:41:43 -03:00
f67ca10f2e avfilter/f_ebur128: properly propagate true peak
After 3b26b782ee, `ebur128->true_peak` was only set to the maximum of the
current "true peak per frame" values, when it should report the true peak for
the entire stream.

Fixes: 3b26b782ee
2025-06-24 12:12:37 +02:00
60fc0288ae hwcontext_vulkan: fix 85c0364b70
The issue is that by moving the mprops loading later, we inadvertently
broke some earlier dependencies.
2025-06-24 16:42:43 +09:00
88fee7046a avcodec/g728dec: Remove AVCodec.sample_fmts
It is unnecessary for decoders (they just set
AVCodecContext.sample_fmt). This also fixes a warning
with Clang (because sample_fmts is set directly,
not via CODEC_SAMPLEFMTS).

Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-23 21:45:17 +02:00
11428896db hwcontext_vulkan: add workaround for broken Nvidia drivers 2025-06-24 02:30:01 +09:00
85c0364b70 hwcontext_vulkan: move ReBAR check into a new function and use it later
The issue is that vulkan_device_create_internal() is only called for
devices that lavu creates by itself.
For external devices, this was never done.

This also solves some mid-function declaration warnings.
2025-06-24 02:30:01 +09:00
5b1301004b avformat/iff: Check nb_channels == 0 in CHNL
Fixes: division by 0
Fixes: 418396712/clusterfuzz-testcase-minimized-ffmpeg_dem_IFF_fuzzer-6104388018176000
Fixes: 418478219/clusterfuzz-testcase-minimized-ffmpeg_dem_IFF_fuzzer-4569544410857472

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-23 16:31:58 +02:00
f06474faf8 tools/target_dec_fuzzer: adjust threshold for VP8
Fixes: Timeout
Fixes: 416589179/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP8_fuzzer-5432788428062720

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-23 16:29:34 +02:00
a8c21a7158 Add FUNDING.json
We have been contacted by Monet du Plessis of the etherium foundation and
Natascha Buck (Grants at the Better Internet Foundation)

"The Ethereum Foundation is thrilled to inform you that your contribution to
 open-source software development through your work on ffmpeg
 https://github.com/FFmpeg/FFmpeg  has been recognized and rewarded by the
 Devcon team! Your project played a fundamental role in the success of Devcon
 <http://devcon.org/>, helping to create a more meaningful experience for
 the Ethereum community. In collaboration with Drips Network
 <https://www.drips.network/>, we are pleased to award you $2,240.00 in
 appreciation of your efforts and to support your continued efforts in
 open-source development."

To be able to claim donations through the drips network we need to
specify a wallet to do so in FUNDING.json

This will also allow FFmpeg to receive future funding and donations
through the drips network.

The specified wallet is a safe wallet backed by a ledger hw wallet.
We can later change who controls the safe wallet. (For example it
could be passed on to the SPI treasurer)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-23 14:48:40 +02:00
6e5f47f6d3 tools/target_dec_fuzzer: Adjust RV60 threshold
Fixes: Timeout
Fixes: 410324670/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RV60_fuzzer-5697706586865664

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-23 14:36:07 +02:00
f8e30d9eeb avcodec/osq: Request a coding mode 2 sample
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-23 14:28:56 +02:00
a5f861d335 avcodec/osq: Switch back to av_ceil_log2()
This returns to code closer to prior 56c334d732
The prior fixes should limit the sum and avoid the need for double argument log2()

Fixes: Assertion n>=0 && n<=32 failed at libavcodec/get_bits.h:406
Fixes: 410109093/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_OSQ_fuzzer-6550900028276736

No testcases except fuzzers

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-23 14:28:55 +02:00
b587afcb65 avcodec/osq: Add note about update_stats() count
It seems this is basically unused and unfinished code

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-23 14:28:55 +02:00
c909ef31be avcodec/osq: Fix signed integer overflow in update_stats()
Fixes: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself
Fixes: 410109093/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_OSQ_fuzzer-6550900028276736

Note, none of the available osq files uses update_stats(), this change may fix or break
files using coding_mode == 2. The code prior looks wrong though

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-23 14:28:55 +02:00
983a3b17e4 libavcodec/hcadec: fix header parsing after 'comp' section
Need to skip 2 more bytes because comp sections are 12 bytes long.
Fixes decryption since ciph_type is now being set.

Signed-off-by: Pavel Roslyy <roslypav@gmail.com>
2025-06-23 14:28:54 +02:00
c94a419e32 avfilter/codecview: Enable QP visualization for H.264
The codecviewfilter, when used with qp=1, did not display quantization parameter values for H.264 streams because the QP table extraction was restricted to MPEG-2 video.

This patch enables H.264 support by updating ff_qp_table_extractto accept AV_VIDEO_ENC_PARAMS_H264. This allows for correct QP overlay on H.264 video

Signed-off-by: Timothee <timothee.informatique@regaud-chapuy.fr>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-23 13:40:52 +02:00
e6298e0759 avformat/rtp: G.728 muxing and demuxing 2025-06-23 17:19:18 +10:00
5a8c2b2b50 avformat/aiff: G.728 muxing and demuxing 2025-06-23 17:19:18 +10:00
dee4edfa63 avformat/riff: G.728 muxing and demuxing 2025-06-23 17:19:18 +10:00
52f62468aa avformat/g728dec: raw G.728 demuxer 2025-06-23 17:19:18 +10:00
a107340035 avcodec/g728dec: G.728 decoder 2025-06-23 17:16:42 +10:00
a3c900a0c4 avcodec/lpc_functions: compute_lpc_coefs: add starting lpc order and err cache parameters 2025-06-23 17:11:09 +10:00
a0b9d61faf avcodec/g728_template: make hist parameter constant 2025-06-23 17:11:07 +10:00
93368029e3 avcodec/g728_template: do_hybrid_window() template
intended for use by RealAudio 2.0 (28.8k) and G.728 decoders.
2025-06-23 17:11:03 +10:00
b1172b8cc6 avcodec/mss2dsp: use FF_PTR_ADD to add offsets to a pointer
Fixes: libavcodec/mss2dsp.c:59:14: runtime error: applying zero offset to null pointer

Tested-by: Kacper Michajlow <kasper93@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2025-06-22 17:50:26 -03:00
f789d60e11 avformat/mov: add more sanity checks when reading clap boxes
If the apperture window is bigger than the canvas, then the clap box is invalid
and there's no point calculating cropping values.

Fixes: libavformat/mov.c:1295:14: runtime error: -256 is outside the range of representable values of type 'unsigned long'

Signed-off-by: James Almer <jamrial@gmail.com>
2025-06-22 10:30:03 -03:00
dbe94e1110 avfilter/x86/f_ebur128: replace AVX2 instruction with AVX equivalent
Using vpbroadcastq in an AVX function will result in SIGILL errors on pre
Haswell/Zen processors.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-06-22 09:31:44 -03:00