Commit Graph

110170 Commits

Author SHA1 Message Date
Anton Khirnov 1d3f7178ae lavf/mux: clarify log messages when choosing oformat fails
Current log messages talk about 'suitable' output formats. This is
confusing, because it suggests that some formats are suitable, while
others are not, which is not the case.

Also, suggest possible user actions when format cannot be guessed from a
filename.
2023-04-04 11:44:54 +02:00
Anton Khirnov dffb058f3b lavf: fall back to a more meaningful log instance name
An uninitialized AVFormatContext instance with neither iformat nor
oformat set will currently log as 'NULL', which is confusing and
unhelpful. Print 'AVFormatContext' instead, which provides more
information.

This happens e.g. if choosing an output format fails in
avformat_alloc_output_context2().

E.g. with the following commandline:
 ffmpeg -i <input> -f foobar -y /dev/null
before: [NULL @ 0x5580377834c0] Requested output format 'foobar' is not a suitable output format
after:  [AVFormatContext @ 0x55fa15bb34c0] Requested output format 'foobar' is not a suitable output format
2023-04-04 11:42:52 +02:00
James Almer 97c95961f0 avcodec/libfdk-aaceenc: add a flush callback
Signed-off-by: James Almer <jamrial@gmail.com>
2023-04-03 20:15:13 -03:00
James Almer 4c00aa036e avcodec/libx264: add a flush callback
Signed-off-by: James Almer <jamrial@gmail.com>
2023-04-03 20:15:13 -03:00
Kyle Manning 9a245bdf5d avcodec/nvenc: fix b-frame DTS behavior with fractional framerates
When using fractional framerates (or any fraction with a numerator != 1),
DTS values for packets would be calculated incorrectly.

Signed-off-by: Kyle Manning <tt2468@irltoolkit.com>
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2023-04-03 11:59:36 +02:00
Gyan Doshi 6941788d24 avformat/movenc: correct loci parameter handling
3GPP TS 26.244 Table 8.10 specifies that longitude is written before
latitude. The MOV demuxer already expects the correct order. So, write
them in that order.

However, the user supplied string may also be used in MOV mode which
requires ISO 6709 format which specifies latitude first. The demuxer
also exports the loci value in that format. So parser adjusted as well.
2023-04-03 15:00:16 +05:30
Michael Niedermayer c6dedaf491
tests: Add more j2k tests to cover a wider range of cases
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-04-02 23:54:52 +02:00
Michael Niedermayer 5666c3b8be
avcodec/j2kenc: Add alpha support
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-04-02 23:54:52 +02:00
Michael Niedermayer 60ccb3fe78
Remove libopenjpeg decoder
We do not support other video/image decoders when we have our own.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-04-02 23:54:51 +02:00
Michael Niedermayer 35b8b4f229
avcodec/j2kenc: support threads
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-04-02 23:54:51 +02:00
Michael Niedermayer b2404bd9aa
avcodec/j2kenc: More complete list of supported pixel formats
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-04-02 23:54:51 +02:00
Michael Niedermayer b41dabd00d
avcodec/j2kenc: Planar RGB support
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-04-02 23:54:50 +02:00
Michael Niedermayer ad4d647591
avcodec/j2kenc: Replace RGB24 special case by generic test
This fixes RGB48 with libavcodec as decoder

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-04-02 23:54:50 +02:00
Michael Niedermayer 7fb70d27a2
avcodec/j2kenc: Replace BGR48 / GRAY16 test by test for number of bits
BGR48 is not supported and this was probably meant to be RGB48 so this fixes
RGB48 a bit

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-04-02 23:54:50 +02:00
Michael Niedermayer 644d15716d
avcodec/j2kenc: simplify pixel format setup
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-04-02 23:54:49 +02:00
Michael Niedermayer b7418f768c
avcodec/j2kenc: Add AV_PIX_FMT_YUV440P
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-04-02 23:54:49 +02:00
Michael Niedermayer 816676085e
avcodec/j2kenc: Fix funky bpno errors on decoding
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-04-02 23:54:49 +02:00
Michael Niedermayer 0adb375377
avcodec/j2kenc: remove misleading pred value
This field is only checked for being 0 or not and not zero means 5/3

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-04-02 23:54:48 +02:00
Michael Niedermayer f6955b6df4
avcodec/j2kenc: fix 5/3 DWT identifer
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-04-02 23:54:48 +02:00
Michael Niedermayer dab1cd2dc0
avcodec/vp3: Check width to avoid assertion failure
Fixes: Assertion failure on x86-32
       av_assert2(block_w * sizeof(pixel) <= FFABS(buf_linesize)); in ff_emulated_edge_mc()
Fixes: 39641/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_THEORA_fuzzer-5925660741206016

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-04-02 23:54:48 +02:00
Michael Niedermayer 6d1d8609ac
avcodec/g729postfilter: Limit shift in long term filter
Fixes: shift exponent 34 is too large for 32-bit type 'int'
Fixes: 57389/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ACELP_KELVIN_fuzzer-6229522659016704

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-04-02 23:54:47 +02:00
Michael Niedermayer c2ed905b68
avcodec/vc1dec: Use av_fast_realloc() for slices
Fixes: Timeout
Fixes: 57281/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1IMAGE_fuzzer-4594141064724480

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-04-02 23:54:47 +02:00
Michael Niedermayer 1942dbb8ca
avcodec/wavarc: Fix several integer overflows
Fixes: signed integer overflow: -532410125 + -1759642300 cannot be represented in type 'int'
Fixes: 57045/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVARC_fuzzer-637023665297817

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-04-02 23:54:47 +02:00
Marton Balint 5f92a19231 avformat/assenc: avoid incorrect copy of null terminator
When writing a subtitle SSA/ASS subtitle file, the AVCodecParameters::extradata
buffer is written directly to the output.  In the case where the buffer is
filled from a matroska source file produced by some older versions of
Handbrake, this buffer ends with a null terminating character, which is then
erroneously copied into the middle of the output file. The change here avoids
this problem by treating it as a string rather than a raw buffer. This way it
is agnostic as to whether the source buffer was null terminated or not.

Fixes ticket #10203.

Reported-by: Tim Angus <tim at ngus.net>
Signed-off-by: Marton Balint <cus@passwd.hu>
2023-04-02 21:31:05 +02:00
Devin Heitmueller 85c62b48e9 avcodec/bytestream: fix warnings with signed/unsigned compare in bytestream.h
When including the header in decklink_enc.cpp it would be fed
through the C++ compiler rather than the C compiler, which has
more strict warnings when comparing signed/unsigned values.

Make the local variables unsigned to match the arguments they are
being passed for those functions.

Signed-off-by: Devin Heitmueller <dheitmueller@ltnglobal.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2023-04-02 21:31:05 +02:00
Stefano Sabatini 9d140ecaf8 lavfi/unsharp: clarify invalid filter param constraints
Clarify failure in case of x/y building a too big matrix.

Example:
$ ffmpeg -hide_banner -f lavfi -i color=c=white:size=640x360,unsharp=lx=5:ly=23 -f null -t 1 -
[Parsed_unsharp_1 @ 0x5650e1c30240] luma matrix size (lx/2+ly/2)*2=26 greater than maximum value 25
color=c=white:size=640x360,unsharp=lx=5:ly=23: Invalid argument

Fix trac issue:
http://trac.ffmpeg.org/ticket/6033
2023-04-02 17:07:51 +02:00
Stefano Sabatini 774d358e0f tools/zmqshell: port to python3
Also extend docs, use argparse and logging.
2023-04-02 16:28:54 +02:00
Stefano Sabatini 686e14e9fb doc/platform: drop reference to ffmpeg.zeranoe.com
It was closed in September 2020.

Fix issue:
http://trac.ffmpeg.org/ticket/9734
2023-04-02 16:28:54 +02:00
Stefano Sabatini 627d5a87bb doc/ffmpeg: slightly rework introductory examples
In particular, add a sentence to introduce the example, and add a
simpler starting example with no options.

Also use different format for input.avi and output.mp4, to convey
that the conversion also works on the container format.

Address issue:
http://trac.ffmpeg.org/ticket/8730
2023-04-02 16:28:54 +02:00
Stefano Sabatini ee25a434dc doc/filters/find_rect: extend documentation
Document metadata entries set by the filter, extend and clarify
options, add additional example showing how to extract the generated
data.

Address issue:
http://trac.ffmpeg.org/ticket/8766
2023-04-02 16:22:14 +02:00
Stefano Sabatini 26eb3129df lavc: clarify color_range semantics
Extend description for decoding and encoding use cases.

Address issue: http://trac.ffmpeg.org/ticket/443
2023-04-02 16:22:14 +02:00
Samuel Raposo Vieira Mira b4eca5cce2 avcodec/mediacodec: add mpeg4 encoder
This patch will add MPEG4 encoder using Android Mediacodec

Signed-off-by: Samuel Mira <samuel.mira@qt.io<mailto:samuel.mira@qt.io>>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-04-02 15:10:15 +08:00
Samuel Raposo Vieira Mira 139f3352ed avcodec/mediacodec: add vp9 encoder using mediacodec
The only encoders avaliable using mediacodec were h264 and hevc. This
patch adds the vp9 encoder.

Signed-off-by: Samuel Mira <samuel.mira@qt.io<mailto:samuel.mira@qt.io>>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-04-02 15:09:45 +08:00
Gyan Doshi dd7e30724b avformat/tcp: correct strdup check
Fixes CID 1524608.
2023-04-02 10:18:56 +05:30
Martin Storsjö c221036502 libavformat: Improve ff_configure_buffers_for_index for excessive deltas
Previously, the ff_configure_buffers_for_index function had
upper sanity limits of 16 MB (1<<24) for buffer_size and
8 MB (1<<23) for short_seek_threshold.

However, if the index contained entries with a much larger
delta, setting pos_delta to a value larger than the sanity
limit, we would end up not increasing the buffer size at all.

Instead, ignore the individual deltas that are excessive, but
increase the buffer size based on the deltas that are below the
sanity limit.

Only count deltas that are below 1<<23, 8 MB; pos_delta gets doubled
before setting the buffer size - this matches the previous maximum
buffer size of 1<<24, 16 MB.

This can happen e.g. with a mov file with some tracks containing
some samples that belong in the start of the file, at the end of
the mdat, while the rest of the file is mostly reasonably interleaved;
previously those samples caused the maximum pos_delta to skyrocket,
skipping any buffer size enlargement.

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-04-02 00:34:53 +03:00
Martin Storsjö 33d06de638 libavformat: Account for negative position differences in ff_configure_buffers_for_index
When scanning through the index, account for the fact that the
compared samples may be located in an unexpected order in the file;
this function is mainly interested in the absolute difference between
file locations.

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-04-02 00:34:46 +03:00
Christopher Degawa 182663a58a get_cabac_inline_x86: Don't inline the assembly function on 32 bit
While the inline cabac assembly has worked correctly in i386 builds
historically, modern compiler updates has started showing issues
with it, when the function gets inlined into larger contexts that
fail to provide the amount of free registers as this function
requires.

This was an issue with Clang on Windows on i386, which was fixed
in c6d284b945324a7bc70ea8b9056040c8148aa835. However, recently
the same issues also have started showing up with GCC (both for
Windows and Linux). Whether the issue appears seems dependent on
a lot of optimizer tuning (e.g. the issue appears or goes away
depenent on the combinaton of -march= and -mtune= options),
potentially due to the compiler making different decisions on
how much to inline.

Fixes: https://trac.ffmpeg.org/ticket/8903

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-04-02 00:34:10 +03:00
Leo Izen c125860892
avcodec/pngenc: write sBIT chunks
Add support for writing sBIT chunks, which mark the significant
bit depth of the PNG file. This obtains the metadata using the field
bits_per_raw_sample of AVCodecContext.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2023-04-01 00:37:55 -04:00
Leo Izen 84b454935f
avcodec/pngdec: support sBIT chunks
Add support for reading sBIT chunks, which mark the significant
bit depth of the PNG file. This passes the metadata using the field
bits_per_raw_sample of AVCodecContext.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2023-04-01 00:37:25 -04:00
James Almer 113f684271 doc/encoders: add an entry for the frame_length option from libfdk-aac
Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: James Almer <jamrial@gmail.com>
2023-03-31 10:17:57 -03:00
Raphael Schlarb d2e1389285 avcodec/libfdk-accenc: Add option to set frame length when encoding with libfdk_aac
Some specifications require the size of ld/eld frames to be 480 samples
instead of the default 512. libfdk_aac provides an option to set an alternative
frame size, but it's not exposed via the ffmpeg interface.
This patch adds a frame_length option to solve this problem.

Signed-off-by: Raphael Schlarb <info@raphael.schlarb.one>
Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: James Almer <jamrial@gmail.com>
2023-03-31 08:46:29 -03:00
Haihao Xiang 412d43b09a lavfi/vf_vpp_qsv: only add the given output sw format to output pad
Otherwise the output format is not changed when output is in system
memory. For example, the output format is still p010le in the following
case:

$ ffmpeg -qsv_device /dev/dri/renderD128 -f lavfi -i testsrc -vf
"format=p010le,vpp_qsv=extra_hw_frames=8:format=nv12" -f null -
...
Output #0, null, to 'pipe:':
  Metadata:
    encoder         : Lavf60.4.100
  Stream #0:0: Video: wrapped_avframe, p010le(tv, progressive), 320x240
[SAR 1:1 DAR 4:3], q=2-31, 200 kb/s, 25 fps, 25 tbn

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-03-31 10:27:58 +08:00
Paul B Mahol b75159682a avfilter/af_rubberband: use correct array for multichannels 2023-03-30 14:08:52 +02:00
jackarain 4d216654ca libavformat/tcp: add local_addr/local_port for network option
Signed-off-by: jackarain <jack.wgm@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2023-03-30 12:09:49 +02:00
Stefano Sabatini 0684e58886 doc/filters/paletteuse: mention none dithering value
Fix issue:
http://trac.ffmpeg.org/ticket/9950
2023-03-29 00:15:19 +02:00
Stefano Sabatini 64016356bc doc/outdevs/sdl: update options documentation
Drop mention of missing icon_title option, document window_borderless option.

Fix issue:
http://trac.ffmpeg.org/ticket/9583
2023-03-29 00:15:19 +02:00
Stefano Sabatini 42d99d5132 doc/outdevs/sdl: sort options by name 2023-03-29 00:15:19 +02:00
Stefano Sabatini 47c56ff554 doc/filters/aspect: update documentation
Drop mention of unsupported N:M syntax, dropped since 0ed61546c4.

Also, drop reference of common expression constants, and fix
description of a expression parameter.

Fix issue:
http://trac.ffmpeg.org/ticket/9974
2023-03-29 00:15:19 +02:00
Stefano Sabatini 7d58df7bb2 lavfi/aspect: apply style fixes 2023-03-29 00:15:19 +02:00
Stefano Sabatini 5c13307989 doc/filters: mentions that whitespaces are ignored in the filtergraph specification
Also provide example showing how to use this feature to improve filtergraph
readability.

Address issue:
http://trac.ffmpeg.org/ticket/8115
2023-03-29 00:15:19 +02:00