1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00
Commit Graph

111296 Commits

Author SHA1 Message Date
Anton Khirnov
57021a68d9 fftools/ffmpeg_mux: set stream duration after the timebase is certainly known
Stop assuming the encoder knows the muxing timebase, which does not
always have to hold (e.g. due to bitstream filters).
2023-06-05 16:15:04 +02:00
Anton Khirnov
ba1141d8a9 fftools/ffmpeg_enc: move nb_frames{dup,drop} globals into OutputStream 2023-06-05 16:15:04 +02:00
Anton Khirnov
09af34dc91 tests/fate/ffmpeg: add tests for -max_error_rate 2023-06-05 16:15:04 +02:00
Michael Niedermayer
b1c3d81e71
avformat/oggparsetheora: clip duration within 64bit
Fixes: signed integer overflow: 9079256848778919936 - -288230376151711746 cannot be represented in type 'long'
Fixes: 58248/clusterfuzz-testcase-minimized-ffmpeg_dem_OGG_fuzzer-6326851353313280

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-06-04 18:21:25 +02:00
Michael Niedermayer
b168aeb734
avcodec/rka: avoid undefined multiply in cmode==0
Fixes: signed integer overflow: -182838 * 32768 cannot be represented in type 'int'
Fixes: 58179/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RKA_fuzzer-5333265899978752

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-06-04 18:21:24 +02:00
Michael Niedermayer
cbe5e480aa
avcodec/rka: use 64bit for srate_pad computation
Fixes: left shift of 538976288 by 13 places cannot be represented in type 'int'
Fixes: 56148/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RKA_fuzzer-6257370708967424

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-06-04 18:21:24 +02:00
Jeremy Wu
b92af7b64e avcodec/aacenc: add strict bit rate control option
In certain use cases, controlling the maximum frame size is critical. An
example is when transmitting AAC packets over Bluetooth A2DP.

While the spec allows the packets to be fragmented (but UNRECOMMENDED),
in practice most headsets do not recognize nor reassemble such packets.

In this patch, we allow setting `bit_rate_tolerance` to 0 to indicate
that the specified bit rate should be treated as an upper bound up to
frame level.

Signed-off-by: Jeremy Wu <jrwu@chromium.org>
2023-06-04 03:36:10 +02:00
Philip Langdale
378fb40282 avutil/hwcontext_vulkan: disable multiplane when deriving from cuda
Today, cuda is not able to import multiplane images, and cuda requires
images to be imported whether you trying to import to cuda or export
from cuda (in the later case, the image is imported and then copied
into on the cuda side). So any interop between cuda and vulkan requires
that multiplane be disabled.

The existing option for this is not sufficient, because when deriving
devices it is not possible to specify any options.

And, it is necessary to derive the Vulkan device, because any pipeline
that involves uploading from cuda to vulkan and then back to cuda must
use the same cuda context on both sides, and the only way to propagate
the cuda context all the way through is to derive the device at each
stage.

ie:

-vf hwupload=derive_device=vulkan,<filters>,hwupload=derive_device=cuda
2023-06-03 16:29:38 -07:00
Rick Kern
4ef5e7d472 lavc/videotoolboxenc: support additional options
Added support for more VideoToolbox encoder options:
- qmin and qmax options are now used
- max_slice_bytes: Max number of bytes per H.264 slice
- max_ref_frames: Limit the number of reference frames
- Disable open GOP when the cgop flag is set
- power_efficient: Enable power-efficient mode

Signed-off-by: Rick Kern <kernrj@gmail.com>
2023-06-03 17:29:07 -04:00
xufuji456
decc776f88 avcodec/videotoolboxenc: add CBP/CHP profile
The CBP/CHP profile has available with H264 in iOS 15.0.
Official Doc: https://developer.apple.com/documentation/videotoolbox/kvtprofilelevel_h264_constrainedbaseline_autolevel

Signed-off-by: Rick Kern <kernrj@gmail.com>
2023-06-03 17:29:07 -04:00
Rick Kern
cab6d7bd71 lavc/videotoolboxenc: use ffmpeg profile constants
Signed-off-by: Rick Kern <kernrj@gmail.com>
2023-06-03 17:29:06 -04:00
Paul B Mahol
2342c05e43 avcodec/magicyuvenc: put some slice work under parallel execution
Speeds up slice threaded encoding.
2023-06-03 11:34:47 +02:00
Anton Khirnov
ba32f28498 doc/examples/transcode: convert timestamps between filtering and encoding
The timebases do not have to match.
2023-06-03 11:27:42 +02:00
Anton Khirnov
811b0e02be doc/examples/transcode: stop using decoder's AVCodecContext.time_base
The contents of this field are not defined for decoding. Use
pkt_timebase, which is the timebase of demuxed packets.

Drop a tautological av_packet_rescale_ts() call, as the stream and
decoder timebases are the same.
2023-06-03 11:27:23 +02:00
Anton Khirnov
828d3b4432 doc/examples/transcode: set packet timebase for decoding
It is recommended for callers to set it, though not required.
2023-06-03 11:27:11 +02:00
Paul B Mahol
6b8d53f728 avcodec/magicyuvenc: add slice encoding support 2023-06-03 00:11:48 +02:00
James Almer
4da14c302f avcodec/av1dec: reset the fragment on extradata reading failure
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-02 14:07:20 -03:00
James Almer
8c6b931f4c avcodec/av1dec: reset the fragment on reading failure
Fixes: NULL pointer dereference
Fixes: 59359/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AV1_fuzzer-6726080594313216

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-02 14:01:10 -03:00
Paul B Mahol
9a9b56c870 avfilter/vf_mix: add fast filtering in case all tmix weights are same 2023-06-02 18:54:32 +02:00
James Almer
da23151eaf avformat/oggparseflac: use the GetByteContext API
All but one read are byte aligned, so there's no point in using the
GetBitContext API.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-06-01 19:51:06 -03:00
Timo Rothenpieler
d2b46c1ef7 avcodec/nvenc: stop using deprecated rc modes with SDK 12.1 2023-06-01 23:47:14 +02:00
Timo Rothenpieler
03823ac0c6 configure: use non-deprecated nvenc GUID for conftest 2023-06-01 23:24:43 +02:00
Paul B Mahol
3cfd85ec20 avfilter/avf_showcqt: switch to activate
And make output frame durations always same.
2023-06-01 20:27:33 +02:00
Paul B Mahol
baa9fccf8d avfilter/vf_mergeplanes: remove hack for linesize calculation 2023-05-31 19:24:03 +02:00
Pierre-Anthony Lemieux
0f2f0dd5b4
avformat/imf: clean-up logging
* remove logging to NULL
 * remove extraneous logging
2023-05-31 09:03:58 -07:00
Anton Khirnov
ba2c791627 fftools/ffmpeg_filter: do not flush encoders on parameter change
It makes no sense to do so.
2023-05-31 16:20:19 +02:00
Anton Khirnov
106167374c fftools/ffmpeg_mux: flush bsfs immediately on exceeding recoding time
Current code marks the output stream as finished and waits for a flush
packet, but that is both unnecessary and suspect, as in theory nothing
should be sent to a finished stream - not even flush packets.
2023-05-31 16:20:19 +02:00
Anton Khirnov
2674532eee fftools/ffmpeg_filter: constify the argument of filtergraph_is_simple() 2023-05-31 16:20:19 +02:00
Anton Khirnov
3bfc2c589a fftools/ffmpeg_filter: make InputStream.filter private
It is no longer accessed outside of ffmpeg_filter.
2023-05-31 16:20:19 +02:00
Anton Khirnov
5924b70075 fftools/ffmpeg_filter: make ifilter_has_all_input_formats() static
It is no longer used outside ffmpeg_filter.
2023-05-31 16:20:19 +02:00
Anton Khirnov
2262df5e8a fftools/ffmpeg_filter: drop unreachable code
Filtergraphs with no inputs are initialized as soon as all their outputs
are bound, so this code should not be reachable.
2023-05-31 16:20:19 +02:00
Anton Khirnov
f3e0a83e8e fftools/ffmpeg_enc: stop configuring filters from encoder flush
There is no way for a filtergraph to have all input parameters, yet not
be configured, so this code should not be reachable.
2023-05-31 16:20:19 +02:00
Anton Khirnov
f8abab673c fftools/ffmpeg: move sub2video handling to ffmpeg_filter
Make all relevant state per-filtergraph input, rather than per-input
stream. Refactor the code to make it work and avoid leaking memory when
a single subtitle stream is sent to multiple filters.
2023-05-31 16:20:19 +02:00
Anton Khirnov
20cacfe493 fftools/ffmpeg: rework setting sub2video parameters
Set them in ifilter_parameters_from_dec(), similarly to audio/video
streams. This reduces the extent to which sub2video filters need to be
treated specially.
2023-05-31 16:20:19 +02:00
Anton Khirnov
ea5c39cef6 fftools/ffmpeg: tweak sub2video_heartbeat() arguments
This function should not take an InputStream, as it only uses it to get
the InputFile and the timebase. Pass those directly instead and avoid
confusion over dealing with multiple InputStreams.
2023-05-31 16:20:19 +02:00
Anton Khirnov
a6d67b11f5 fftools/ffmpeg_filter: move sub2video subtitle queue to InputFilterPriv
This queue should be associated with a specific filtergraph input - if
a subtitle stream is sent to multiple filters then each should have its
own queue.
2023-05-31 16:20:19 +02:00
Anton Khirnov
5d530e3a72 fftools/ffmpeg_dec: move sub2video submission to ffmpeg_filter
This code is a sub2video analogue of ifilter_send_frame(), so it
properly belongs to the filtering code.

Note that using sub2video with more than one target for a given input
subtitle stream is currently broken and this commit does not change
that. It will be addressed in following commits.
2023-05-31 16:19:49 +02:00
Anton Khirnov
3d35b73b2a fftools/ffmpeg: constify AVSubtitle parameters as appropriate 2023-05-31 16:15:47 +02:00
Anton Khirnov
ad4efb9158 fftools/ffmpeg_filter: try to configure filtergraphs earlier
When the filtergraph has no inputs, it can be configured immediately
when all its outputs are bound to output streams. This will simplify
treating some corner cases.
2023-05-31 16:15:47 +02:00
Anton Khirnov
7520cd9f07 fftools/ffmpeg_mux_init: move OutputFilter setup code to ffmpeg_filter
That is a more appropriate place for it.
2023-05-31 16:15:47 +02:00
Anton Khirnov
87b576135e fftools/ffmpeg_filter: factor out binding an output stream to OutputFilter
While the new function is trivial for now, it will become more useful in
future commits.
2023-05-31 16:15:47 +02:00
Anton Khirnov
dc5864a00c fftools/ffmpeg_filter: create Input/OutputFilters together with FilterGraph
This way the list of filtergraph inputs/outputs is always known after
FilterGraph creation. This will allow treating simple and complex
filtergraphs in a more uniform manner.
2023-05-31 16:15:47 +02:00
Anton Khirnov
a1061d4bdc fftools/ffmpeg_filter: move some functions higher up
Needed by the following commit.
2023-05-31 16:15:47 +02:00
Anton Khirnov
00183880aa fftools/ffmpeg_filter: decouple allocating InputFilter and binding it to InputStream
Will be useful in future commits.
2023-05-31 16:15:47 +02:00
Anton Khirnov
7ea10bfef3 fftools/ffmpeg_filter: store just the link label in OutputFilter
Not the entire AVFilterInOut. This is simpler.
2023-05-31 16:15:47 +02:00
Anton Khirnov
da7ae627e1 fftools/ffmpeg_filter: always pass graph description to fg_create()
Currently NULL would be passed for simple filtergraphs, which would
make the filter code extract the graph description from the output
stream when needed. This is unnecessarily convoluted.
2023-05-31 16:15:47 +02:00
Anton Khirnov
badf959ed6 fftools/ffmpeg_filter: use a dedicated variable for marking simple filtergraphs
Do not use an unrelated graph property, which will change in future
commits.
2023-05-31 16:15:47 +02:00
Anton Khirnov
b56db2956b fftools/ffmpeg: add logging for creating output streams 2023-05-31 16:15:47 +02:00
Anton Khirnov
eeb7d92ac7 fftools/ffmpeg_mux_init: merge ost_add_from_filter() to ost_add()
This way ost_add() knows about the complex filtergraph it is fed from,
which will become useful in future commits.
2023-05-31 16:15:47 +02:00
Devin Heitmueller
859c34706d avdevice/decklink_common: Convert to using avpriv_packet_list functions
The existing DecklinkQueue implementation was using the PacketList
structure but wasn't using the standard avpriv_packet_list_get and
avpriv_packet_list_put functions.  Convert to using them so we
eliminate the duplicate logic, per Marton Balint's suggestion.

Updated to reflect feedback from Marton Balint provided on 05/11/23.

Signed-off-by: Devin Heitmueller <dheitmueller@ltnglobal.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2023-05-31 00:21:00 +02:00