Commit Graph

109746 Commits

Author SHA1 Message Date
Anton Khirnov 935964bd41 doc/ffmpeg: drop non-existent -dc option 2023-01-29 09:12:40 +01:00
Anton Khirnov 9b5036fabd fftools/ffmpeg: add an AVClass to MuxStream/OutputStream
Use it for logging. This makes log messages related to this output
stream more consistent.
2023-01-29 09:12:22 +01:00
Anton Khirnov d2c983c213 fftools/ffmpeg: add an AVClass to Muxer/OutputFile
Use it for logging. This makes log messages related to this output file
more consistent.
2023-01-29 09:10:57 +01:00
Anton Khirnov 425b2c4a56 fftools/ffmpeg: add options for writing encoding stats
Similar to -vstats, but more flexible:
- works for audio as well as video
- frame and/or packet information
- user-specifiable format
2023-01-29 09:09:59 +01:00
Michael Niedermayer b95b2c8492
avcodec/utils: use 32pixel alignment for bink
bink supports 16x16 blocks in chroma planes thus we need to allocate enough.
Fixes: out of array access
Fixes: 55026/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BINK_fuzzer-6013915371012096
Reviewed-by: Peter Ross <pross@xvid.org>

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-01-28 20:50:01 +01:00
Andreas Rheinhardt 35f837710c avfilter/vf_ssim360: Constify AVFilter
This brings ff_vf_ssim360 in line with its declaration in allfilters.c;
this discrepancy is actually undefined behaviour.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-01-28 18:19:53 +01:00
Andreas Rheinhardt 5fd4d3faf1 avfilter/vf_ssim360: Don't initialize twice
The FILTER_INPUTS and FILTER_OUTPUTS macros already set
AVFilter.(inputs|outputs); Clang therefore emits a warning for
this: "initializer overrides prior initialization of this subobject
[-Winitializer-overrides]"

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-01-28 18:19:24 +01:00
Andreas Rheinhardt 54659e329e avfilter/vf_ssim360: Fix left-shift of negative value
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-01-28 18:18:57 +01:00
Martin Storsjö c0cf2c4786 lavfi/vf_ssim360: Fix compilation with MSVC
Don't use "static const" for compile time float constants, but use
defines. This fixes the following error:

src/libavfilter/vf_ssim360.c(549): error C2099: initializer is not a constant

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-01-28 18:20:19 +02:00
Shannon Chen ed519a3690 lavfi: Add vf_ssim360 filter
Customized SSIM for various projections (and stereo formats) of 360 images and videos.

Further contributions by:
Ashok Mathew Kuruvilla
Matthieu Patou
Yu-Hui Wu
Anton Khirnov

Suggested-By: ffmpeg@fb.com
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2023-01-28 12:00:27 +01:00
Paul B Mahol ac37b2c2b1 avfilter/f_reverse: set output frame duration 2023-01-27 23:53:26 +01:00
Paul B Mahol d9b07a9853 avfilter/vf_ciescope: set output frame duration 2023-01-27 23:13:16 +01:00
Paul B Mahol 23d0214939 avfilter/vf_tpad: set output frame duration 2023-01-27 23:01:52 +01:00
Paul B Mahol 7b78684f96 avfilter/vf_random: set output frame duration 2023-01-27 23:01:52 +01:00
Paul B Mahol a749e43c86 avfilter/vf_datascope: call av_frame_copy_props() 2023-01-27 19:50:10 +01:00
Paul B Mahol 01343683fa avcodec: add CBD2 DPCM decoder 2023-01-27 19:45:36 +01:00
Paul B Mahol 0c7da96924 avcodec/wmaprodec: add missing flush call for xma1 2023-01-27 18:46:56 +01:00
Dmitrii Ovchinnikov 5f0a7a9169 libavcodec/amfenc: add AV1 encoding support
Tested-by: Jean-Baptiste Kempf <jb@videolan.org>
2023-01-27 22:38:45 +05:30
Dmitrii Ovchinnikov 23d4f9223a amfenc: Update the min version to 1.4.28.0 for AMF SDK.
Tested-by: Jean-Baptiste Kempf <jb@videolan.org>
2023-01-27 22:35:35 +05:30
Paul B Mahol 40512dbd96 avfilter/af_adynamicequalizer: add auto option 2023-01-27 15:00:53 +01:00
Ashyni 6869a80e76 avfilter/vf_cropdetect: fix type for old_limit 2023-01-27 14:57:28 +01:00
Marton Balint c0bc804e55 avcodec/ffv1: use 64-bit frame counter
Signed-off-by: Marton Balint <cus@passwd.hu>
2023-01-26 20:37:14 +01:00
Marton Balint bdb7338b09 avcodec/ratecontrol: drop remnants of libxvid rate control
Signed-off-by: Marton Balint <cus@passwd.hu>
2023-01-26 20:37:14 +01:00
Marton Balint 103617c93c avcodec/mpegvideo_enc: remove picture_number parameter from encode functions
They are unused.

Signed-off-by: Marton Balint <cus@passwd.hu>
2023-01-26 20:37:01 +01:00
Marton Balint 91c29cf934 avcodec/rv20enc: use MpegEncContext->picture_number instead of encode function parameter
They should be the same and that is what most encode functions use.

Signed-off-by: Marton Balint <cus@passwd.hu>
2023-01-26 20:11:41 +01:00
Marton Balint 7e4ad6e6a8 avcodec/mpeg4videoenc: use MpegEncContext->picture_number instead of encode function parameter
They should be the same and that is what most encode functions use.

Signed-off-by: Marton Balint <cus@passwd.hu>
2023-01-26 20:11:41 +01:00
Zhao Zhili 9a180f60a9 avcodec/videotoolbox: don't use av_ prefix for local function
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-01-26 23:48:41 +08:00
Zhao Zhili 5146916a9c avcodec/videotoolbox: fix documents of AVVideotoolboxContext
Since those fields will be overridden by videotoolbox_start(), they
should never be set by user, it can trigger memory leaks otherwise.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-01-26 23:48:36 +08:00
Zhao Zhili d6bd980da6 avcodec/videotoolbox: deprecate creating AVVideotoolboxContext by user
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-01-26 23:48:16 +08:00
Zhao Zhili ade89bc6de avcodec/videotoolbox: prefer hw_frames_ctx/hw_device_ctx over hwaccel_context
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-01-26 23:48:08 +08:00
Zhao Zhili 79e9bdf749 avcodec/videotoolbox: fix NULL pointer dereference
In the code path of av_videotoolbox_default_init/init2(),
avctx->internal->hwaccel_priv_data is NULL and passed to
decoder_cb.decompressionOutputRefCon. Then it will be dereferenced
inside videotoolbox_decoder_callback().

Delay videotoolbox_star() until ff_videotoolbox_common_init() to
fix the bug.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-01-26 23:47:42 +08:00
Zhao Zhili b8fca1f1f5 avformat/teeproto: setup max_packet_size
It's the minimum of all child protocols max_packet_size. Can be used
like this:

ffmpeg -re -i cctv.mp4 -c copy -f mpegts \
  -protocol_whitelist 'tee,file,udp' \
  'tee:out.ts|udp://127.0.0.1:6666?pkt_size=1316'

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-01-26 23:31:44 +08:00
Zhao Zhili 1263b0a6ca avutil/hwcontext_mediacodec: fix backward compatibility
AVMediaCodecDeviceContext without surface or native_window is
useless, it shouldn't be created at all. Such dummy AVHWDeviceContext
is allowed before, and it's used by mpv player. Creating a ANativeWindow
automatically breaks such usecases.

So disable creating a ANativeWindow by default. It can be enabled
via the create_window flag, or by set the AVDictionary of
av_hwdevice_ctx_create(). The downside is that

ffmpeg -hwaccel mediacodec -i input.mp4 \
	-c:a copy -c:v hevc_mediacodec output.mp4

use ByteBuffer mode which isn't as efficient as before. The upside
is libavfilter works now, which should be less surprise.

To enable create_window on ffmpeg command line, use
ffmpeg -hwaccel mediacodec \
	-init_hw_device mediacodec=mediacodec,create_window=1 \
	-i input.mp4 -c:a copy -c:v hevc_mediacodec output.mp4

Users should know what it is to enable create_window. It should
be OK to take sometime to figure out the option. And there are comments
inside hwcontext_mediacodec.h to help user figure it out.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-01-26 23:31:37 +08:00
Paul B Mahol 2c3107c3e9 avformat/bonk: remove unused variable 2023-01-25 18:49:09 +01:00
Leo Izen 6f79f0971e
avcodec/png: support cICP chunks
This commit adds both decode and encode support for cICP chunks, which
allow a PNG image's pixel data to be tagged by any of the enum values in
H.273, without an ICC profile.

Upon decode, if a cICP chunk is present, the PNG decoder will tag output
AVFrames with the resulting enum color, and ignore iCCP, sRGB, gAMA, and
cHRM chunks, as per the spec.

Upon encode, if the color space is known and specified, and it is not sRGB,
the PNG encoder will output a cICP chunk containing the color space. If the
color space is sRGB, then it will output an sRGB chunk instead of a cICP
chunk. If the color space of the input is not unspecified, it will not output
a cICP chunk tagging the PNG as unspecified.

In either the sRGB case or the non-SRGB case, gAMA and cHRM are still written
as fallbacks provided the info is known.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2023-01-25 08:09:24 -05:00
Leo Izen f7bab37c8e
avcodec/pngdec: support decoding sRGB chunks
If an sRGB chunk is present in the PNG file, this commit will cause the
png decoder to ignore the cHRM and gAMA chunks and tag the resulting AVFrames
with BT.709 primaries, and ISO/IEC 61966-2-1 transfer. If these tags are
present in the AVFrame, pngenc.c already writes this chunk, so no change was
needed on the encode-side.

The PNG spec does not define what happens if sRGB and iCCP are present at
the same time, it just recommends that this not happen. As of this patch,
the decoder will have the ICC profile take precedence, and it will not tag
the pixel data as sRGB.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2023-01-25 08:09:20 -05:00
Leo Izen 2548c32cc1
avcodec/png: use libavutil/csp.h for cHRM chunks
The cHRM chunk is descriptive. That is, it describes the primaries that should
be used to interpret the pixel data in the PNG file. This is notably different
from Mastering Display Metadata, which describes which subset of the presented
gamut is relevant. MDM describes a gamut and says colors outside the gamut are
not required to be preserved, but it does not actually describe the gamut that
the pixel data from the frame resides in. Thus, to decode a cHRM chunk present
in a PNG file to Mastering Display Metadata is incorrect.

This commit changes this behavior so the cHRM chunk, if present, is decoded to
color metadata. For example, if the cHRM chunk describes BT.709 primaries, the
resulting AVFrame will be tagged with AVCOL_PRI_BT709, as a description of its
pixel data. To do this, it utilizes libavutil/csp.h, which exposes a funcction
av_csp_primaries_id_from_desc, to detect which enum value accurately describes
the white point and primaries represented by the cHRM chunk.

This commit also changes pngenc.c to utilize the libavuitl/csp.h API, since it
previously duplicated code contained in that API. Instead, taking advantage of
the API that exists makes more sense. pngenc.c does properly utilize the color
tags rather than incorrectly using MDM, so that required no change.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2023-01-25 08:09:16 -05:00
Stefano Sabatini 843a446713 ffprobe: fix data hash rendering
Print data hash before side data list, fix wrong nesting level of data hash
element.

In particular, fix trac issue:
http://trac.ffmpeg.org/ticket/7217
2023-01-24 23:58:00 +01:00
Stefano Sabatini b6219c9114 ffprobe: use pkt->dts to compute interval ts when pts is missing
For some samples the pkt->pts is always missing, use the pkt->dts
instead.

Fix trac issue:
http://trac.ffmpeg.org/ticket/4427
2023-01-24 23:58:00 +01:00
Mark Thompson aaa49a7a42 cbs_av1: Remove constraint on MDCV luminance values
While desiring min to be less than max feels entirely sensible,
unfortunately the standard does not actually have this requirement.
2023-01-24 21:41:55 +00:00
Paul B Mahol 20b96494de avfilter/vf_scdet: fix introduced discrepancy with latest change 2023-01-24 22:02:45 +01:00
Ashyni 69c060bea2 avfilter/vf_cropdetect: add ability to change limit at runtime
Fixes: https://trac.ffmpeg.org/ticket/9851

Signed-off-by: Ashyni <jeffrey.c@tuta.io>
2023-01-24 21:53:53 +01:00
Paul B Mahol 3110e28456 avcodec/dpcm: add .flush
Otherwise after seek, DC offset for audio samples might be big.
2023-01-24 16:58:01 +01:00
Paul B Mahol b8640bfc99 avformat: add WADY demuxer 2023-01-24 16:58:01 +01:00
Paul B Mahol c5a545cff8 avcodec: add WADY DPCM decoder 2023-01-24 16:58:01 +01:00
Leo Izen 9d5e66942c avcodec/libjxldec: fix gamma22 and gamma28 recognition
Gamma 2.2 and Gamma 2.8 are tagged in the file as 0.45455 and 0.35714,
respectively (i.e. 1/2.2 and 1/2.8). Trying to identify them as 2.2 and
2.8 instead of these values will cause the transfer function to not
properly be recognized. This patch fixes this.
2023-01-22 17:00:57 +02:00
Paul B Mahol ab8cde6efa avfilter/vf_dblur: also filter last scanline 2023-01-19 12:33:55 +01:00
Paul B Mahol 31c15a0880 avfilter/vf_dblur: allow radius < 1.0 2023-01-19 12:33:55 +01:00
Anton Khirnov ba36e6ed52 lavc/tests/bitstream: test bits_*_signed_nz and bits_peek_signed* 2023-01-18 09:41:32 +01:00
Anton Khirnov 0b33310cd0 lavc/bitstream: avoid UB in bits_{read,peek}_signed(0)
bits_*_signed(0) will currently invoke an undefined shift by
8 * sizeof(int).

Add bits_*_signed_nz() that only works for n>0, analogous to
bits_read_nz(). Add an explicit check for n=0 in bits_*_signed().

Found-by: James Almer
2023-01-18 09:41:32 +01:00