Commit Graph

110147 Commits

Author SHA1 Message Date
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
Stefano Sabatini
7792f53e5e doc/filters: propose solutions to avoid shell escaping
Reference drawtext textfile option and ffmpeg -filter_complex_script
and -filter_script as possible solutions to avoid shell escaping.

Address issue:
http://trac.ffmpeg.org/ticket/9008
2023-03-29 00:15:19 +02:00
Stefano Sabatini
030b34eac9 doc/filters/drawtext: clarify meaning of strftime format string
Also clarify what should be used instead of the strftime expansion mode.
2023-03-29 00:15:19 +02:00
rcombs
57271e4a68 lavf/oggdec: fix demux with unrecognized header packets
Fixes ticket #10289.

Co-authored-by: James Almer <jamrial@gmail.com>
2023-03-28 16:46:03 -04:00
rcombs
e0835b4878 lavc/vorbis_parser: ignore unrecognized packet types 2023-03-28 16:46:03 -04:00
TADANO Tokumei
b6138633cd lavc/libaribcaption.c: add ARIB caption decoder using libaribcaption
This patch add another ARIB caption decoder using libaribcaption
external library.

Unlike libaribb24, it supports 3 types of subtitle outputs:
* text: plain text
* ass: ASS formatted text
* bitmap: bitmap image

Default subtitle type is ass as same as libaribb24.
Advantages compared with libaribb24 on ASS subtitle are:
* Subtitle positioning.
* Multi-rect subtitle: some captions are displayed at different
  position at a time.
* More stability and reproducibility.

To compile with this feature:
* libaribcaption external library has to be pre-installed.
  https://github.com/xqq/libaribcaption
* configure with `--enable-libaribcaption` option.

`--enable-libaribb24` and `--enable-libaribcaption` options are
not exclusive. If both enabled, libaribcaption precedes as
order listed in `libavcodec/allcodecs.c`.

Signed-off-by: rcombs <rcombs@rcombs.me>
2023-03-28 12:05:19 -04:00
TADANO Tokumei
38bb137e99 lavf/mpegts.c: set some properties for ARIB caption
Some additional properties are set for ARIB caption.
* need_parsing = 0
  ARIB caption doesn't require any parser.
  This avoids "parser not found" warning message.
* need_context_update = 1
  When any profiles are changed, set this flag to notify.

Signed-off-by: rcombs <rcombs@rcombs.me>
2023-03-28 12:04:52 -04:00
TADANO Tokumei
e1dc78a13d lavc/codec_desc.c: remove AV_CODEC_PROP_TEXT_SUB property from ARIB_CAPTION
To support bitmap subtitle output, remove AV_CODEC_PROP_TEXT_SUB
property from codec descriptor for AV_CODEC_ID_ARIB_CAPTION.
This is similar to `libavcodec/libzvbi-teletextdec.c`
(AV_CODEC_ID_DVB_TELETEXT).

Instead, each subtitle decoder has to specify a subtitile format.
`libavcodec/libaribb24.c` uses same AV_CODEC_ID_ARIB_CAPTION and
expects AV_CODEC_PROP_TEXT_SUB to be set, so this adds a line to
specify a format there.

Signed-off-by: rcombs <rcombs@rcombs.me>
2023-03-28 12:02:55 -04:00
James Almer
d6e30291db fate/lavf-container: add missing swscale deps to mxf_dvcpro100 and mxf_ffv1
Signed-off-by: James Almer <jamrial@gmail.com>
2023-03-28 08:54:39 -03:00
Anton Khirnov
b62632e2c9 lavc: turn mentions of AV_CODEC_FLAG_RECON_FRAME in doxy into links 2023-03-28 13:00:42 +02:00
Anton Khirnov
83eb52323c lavc: expand doxy for AV_CODEC_FLAG_RECON_FRAME 2023-03-28 13:00:42 +02:00
Anton Khirnov
5f87c9915d lavc/avcodec: fix documentation typo 2023-03-28 13:00:42 +02:00
Anton Khirnov
ea748c7a4d tools: add an AV_CODEC_CAP_ENCODER_RECON_FRAME test tool 2023-03-28 13:00:42 +02:00
Anton Khirnov
554c6d7cb1 tools/decode_simple: initialize decoder parameters with container info 2023-03-28 13:00:42 +02:00
Anton Khirnov
992e984fa8 tools/decode_simple: always call process_frame(NULL) at the end
Currently this would not be done if max_frames is triggered.

Makes no difference in either of the tools currently using
decode_simple, but may be important in future tools.
2023-03-28 13:00:42 +02:00
U. Artie Eoff
9bf1848acf lavfi: add hwdevice flag to hwupload/hwmap
This fixes a regression introduced by:

  commit 3f63685c35
   and
  commit 632c349931

...where command-lines like:

ffmpeg -v verbose -hwaccel qsv \
  -init_hw_device qsv=qsv,child_device=/dev/dri/renderD128 \
  -hwaccel_output_format qsv -f rawvideo -pix_fmt yuv420p \
  -s:v 352x288 -r:v 25 -i input.yuv \
  -vf 'format=nv12,hwupload=extra_hw_frames=120' \
  -an -c:v h264_qsv -y output.h264

ffmpeg -v verbose -hwaccel qsv \
  -init_hw_device qsv=qsv,child_device=/dev/dri/renderD128 \
  -hwaccel_output_format qsv -f rawvideo -pix_fmt nv12 \
  -s:v 352x288 -r:v 25 -i input.yuv \
  -vf 'format=nv12|qsv,hwupload=extra_hw_frames=16,vpp_qsv=procamp=1:saturation=1.0,hwdownload,format=nv12' \
  -pix_fmt nv12 -f rawvideo -fps_mode passthrough -an -y output.yuv

...produced errors like:

[hwupload @ 0x55b6171d0dc0] A hardware device reference is required to upload frames to.
[Parsed_hwupload_1 @ 0x55b6172053c0] Query format failed for 'Parsed_hwupload_1': Invalid argument
Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2023-03-27 17:14:31 +02:00
Anton Khirnov
3f4c41839d lavf: return AVERROR_EOF rather than EIO on EOF 2023-03-27 17:14:31 +02:00
J. Dekker
2e61ae2cbe fate: specify EC-off for damaged inter samples
The previous commit allowed turning on error correction for interlaced
samples. Turning it off amounts to a no-op for FATE. These samples
should be tested with EC1-3 (guess_mvs/deblock/favor_inter)
additionally.

Signed-off-by: J. Dekker <jdek@itanimul.li>
2023-03-27 14:00:05 +02:00
Fei Wang
c549bc9d96 lavc/vaapi_hevc: Remove duplicate code
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
2023-03-27 09:28:59 +02:00
Fei Wang
9026f446d6 lavc/hevcdec: Initialize missed parameters in slice header for IDR frame
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
2023-03-27 09:28:59 +02:00
Fei Wang
c38370dc5d avcodec/hevcdec: Replace number with enum
Keep same style with IS_IDR()/IS_BLA().

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
2023-03-27 09:14:00 +02:00
J. Dekker
f7abe92bd7 avcodec/er: remove check for fields
This change on its own is almost certainly not correct; however, in
testing, many samples show notable improvement.

Signed-off-by: J. Dekker <jdek@itanimul.li>
2023-03-27 08:46:07 +02:00
J. Dekker
4f55568217 configure: add LTO optarg
This allows users to specify an argument such as './configure
--enable-lto=thin' to use ThinLTO with Clang. The old functionality with
'./configure --enable-lto' is preserved.

Signed-off-by: J. Dekker <jdek@itanimul.li>
2023-03-27 08:42:44 +02:00
Fei Wang
ee8fc4f355 lavc/vp9: Add RGB* formats for VAAPI hwaccel
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
2023-03-27 11:53:37 +08:00