Commit Graph

110720 Commits

Author SHA1 Message Date
Anton Khirnov
09c686788e fftools/ffmpeg: attach InputStream.dts to demuxed packets when needed
This way computing it and using it for streamcopy does not need to
happen in sync. Will be useful in following commits, where updating
InputStream.dts will be moved to the demuxing thread.
2023-05-15 10:57:19 +02:00
Anton Khirnov
abf9532bda fftools/ffmpeg_demux: move preparing DemuxMsg to separate function
Will be useful in following commits, which will move more code into this
function.
2023-05-15 10:57:19 +02:00
Anton Khirnov
989e87b03c fftools/ffmpeg: stop using decoder properties in ist_dts_update()
This code runs post-demuxing and is not synchronized with the decoder
output (which may be delayed with respect to its input by arbitrary and
unknowable amounts), so accessing any decoder properties is incorrect.
2023-05-15 10:57:19 +02:00
Anton Khirnov
0d25b404d4 fftools/ffmpeg: reindent after previous commit 2023-05-15 10:57:19 +02:00
Anton Khirnov
702ff2d281 fftools/ffmpeg: consolidate InputStream.[next_]dts updates
Move them to a separate function called right after timestamp
discontinuity processing. This is now possible, since these values have
no interaction with decoding anymore.
2023-05-15 10:57:19 +02:00
Anton Khirnov
a238ba9c3c fftools/ffmpeg: stop using deprecated ticks_per_frame 2023-05-15 10:56:48 +02:00
Anton Khirnov
7d1d61cc5f lavc: deprecate AVCodecContext.ticks_per_frame
For encoding, this field is entirely redundant with
AVCodecContext.framerate.

For decoding, this field is entirely redundant with
AV_CODEC_PROP_FIELDS.
2023-05-15 10:56:18 +02:00
Anton Khirnov
2953ebe7b6 tests/fate: add a simple test for libx264
Since this is an external encoder not under our control, we cannot test
the encoded output exactly as is done for internal encoders. We can
still test however that the output is decodable and produces the
expected number of frames with expected dimensions, pixel formats, and
timestamps.
2023-05-15 10:39:02 +02:00
Anton Khirnov
f618004bc1 lavc/libvpxenc: send frame durations to the encoder
Adapt similar code from libaomenc - stop using ticks_per_frame except as
a last resort.
2023-05-15 10:32:05 +02:00
Anton Khirnov
2ad468ed1f lavc/libkvazaar,libopenh264enc: drop redundant checks
The same check is present in encode_preinit_video().
2023-05-15 10:32:05 +02:00
Anton Khirnov
aa3b0f4376 libaomenc: use AVCodecContext.framerate when available 2023-05-15 10:32:05 +02:00
Anton Khirnov
3fabf71207 lavc/msmpeg4enc: use AVCodecContext.framerate when available 2023-05-15 10:32:05 +02:00
Anton Khirnov
dc20baa049 lavc/ratecontrol: use AVCodecContext.framerate when available 2023-05-15 10:32:05 +02:00
Anton Khirnov
e930b834a9 lavf: use AV_CODEC_PROP_FIELDS where appropriate
H.264 and mpeg12 parsers need to be adjusted at the same time to stop
using the value of AVCodecContext.ticks_per_frame, because it is not set
correctly unless the codec has been opened. Previously this would result
in both the parser and lavf seeing the same incorrect value, which would
cancel out.
Updating lavf and not the parsers would result in correct value in lavf,
but the wrong one in parsers, which would break some tests.
2023-05-15 10:31:55 +02:00
Anton Khirnov
70433abf7f lavc/codec_desc: add a property for codecs that support field coding
Multiple places currently use AVCodecContext.ticks_per_frame > 1 to
identify such codecs, which
* requires a codec context
* requires it to be open
2023-05-15 10:31:55 +02:00
Anton Khirnov
78e84c054a fftools/ffmpeg: fix computing video frame duration from repeat_pict
This field contains the number of _field_ durations by which the
standard frame duration should be extended.
2023-05-15 10:31:55 +02:00
Anton Khirnov
d45a296732 lavu/frame: extend AVFrame.repeat_pict documentation 2023-05-15 10:31:55 +02:00
Anton Khirnov
02823210d7 fftools/opt_common: stop printing deprecated AV_CODEC_CAP_SUBFRAMES 2023-05-15 10:24:54 +02:00
Anton Khirnov
8b20d0dcb5 lavc: deprecate AV_CODEC_CAP_SUBFRAMES
There is nothing meaningful the caller can do with it.
2023-05-15 10:24:54 +02:00
Anton Khirnov
51d6ae099f lavc/decode: drop a useless warning
Decoders will currently warn if an audio decoder not marked with
AV_CODEC_CAP_SUBFRAMES consumes less than the whole packet, but
* this happens for regular files
* this has no negative consequences
* there is no meeaningful action that can or should be taken in response

The warning is thus useless noise.
2023-05-15 10:24:54 +02:00
Michael Niedermayer
954d16fa3f
avformat/hls: Try to implement RFC8216 playlist refusal
This should fix the regression since 6b1f68ccb0

Should fix Ticket10353 (please test and report cases that still fail)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-15 03:02:28 +02:00
Michael Niedermayer
a7b06bfc5d
avformat: add ff_match_url_ext()
Match url against a list of extensions similar to av_match_ext()

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-15 03:02:28 +02:00
Paul B Mahol
2a74826b02 avfilter/*xfade: reduce memory consumption
There is no always need for new buffers.
2023-05-14 23:35:50 +02:00
James Almer
6759983bdc avcodec/cbs_av1: add valid range of values for num_units_in_decoding_tick
The spec states "num_units_in_decoding_tick shall be greater than 0".

Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-14 17:09:38 -03:00
Paul B Mahol
66175c2dca avfilter/f_graphmonitor: set output frame duration 2023-05-14 20:58:08 +02:00
Paul B Mahol
932ccf9e7d avfilter/f_loop: free video frames once not needed 2023-05-14 20:58:08 +02:00
Paul B Mahol
c27895bb98 avfilter/f_graphmonitor: add nozero display mode 2023-05-14 20:58:08 +02:00
Paul B Mahol
6eecfc577b avfilter/f_graphmonitor: rename enums 2023-05-14 20:58:08 +02:00
Paul B Mahol
8041d00271 avfilter/f_loop: fix looping for aloop 2023-05-14 20:58:07 +02:00
Paul B Mahol
7a63add0ea avfilter/f_loop: add time option, for loop start in seconds 2023-05-14 20:58:07 +02:00
Niklas Haas
30c71ef98e lavfi/vf_libplacebo: add frame_mixer option
Fairly straightforward. We just need to modify the scaler handling code
slightly to support looking at a different list of filter presets.
2023-05-14 11:21:43 +02:00
Niklas Haas
02f3b9312a lavfi/vf_libplacebo: allow fps conversion
This exposes libplacebo's frame mixing functionality to vf_libplacebo,
by allowing users to specify a desired target fps to output at. Incoming
frames will be smoothly resampled (in a manner determined by the
`frame_mixer` option, to be added in the next commit).

To generate a consistently timed output stream, we directly use the
desired framerate as the timebase, and simply output frames in
sequential order (tracked by the number of frames output so far).
2023-05-14 11:21:43 +02:00
Niklas Haas
83b1f3f54e lavfi/vf_libplacebo: switch to activate()
To present compatibility with the current behavior, we keep track of a
FIFO of exact frame timestamps that we want to output to the user. In
practice, this is essentially equivalent to the current filter_frame()
code, but this design allows us to scale to more complicated use cases
in the future - for example, insertion of intermediate frames
(deinterlacing, frame doubling, conversion to fixed fps, ...)
2023-05-14 11:21:43 +02:00
Niklas Haas
9e802a47cc lavfi/vf_libplacebo: switch to pl_queue-based design
This does not leverage any immediate benefits, but refactors and
prepares the codebase for upcoming changes, which will include the
ability to do deinterlacing and resampling (frame mixing).
2023-05-14 11:21:43 +02:00
Niklas Haas
2d5e137207 lavfi/vf_libplacebo: split and refactor logic
This commit contains no functional change. The goal is merely to
separate the highly intertwined `filter_frame` and `process_frames`
functions into their separate concerns, specifically to separate frame
uploading (which is now done directly in `filter_frame`) from emitting a
frame (which is now done by a dedicated function `output_frame`).

The overall idea here is to be able to ultimately call `output_frame`
multiple times, to e.g. emit several output frames for a single input
frame.
2023-05-14 11:21:43 +02:00
Niklas Haas
482d81378f lavfi/vf_libplacebo: update render params on demand
Only update this struct when it's expected to change, and cache it
otherwise. Partially motivated by a desire to make `process_frames`
smaller.
2023-05-14 11:15:49 +02:00
Oleg
e700d87b20 avfilter/setpts: add command support
Add support for changing expr on the fly.

Signed-off-by: Oleg <oafanasiev@gmail.com>
2023-05-14 11:10:50 +02:00
Stefano Sabatini
6f1368842d tools/normalize: port to python3, extend syntax
Also add documentation and logging.
2023-05-14 10:16:01 +02:00
Paul B Mahol
28a73506df avfilter/vf_waveform: add input option
For finer control of selected formats for filtering.
2023-05-14 00:13:59 +02:00
Paul B Mahol
fb8efa9793 avfilter/avfiltergraph: remove no longer valid comment 2023-05-14 00:13:52 +02:00
James Almer
b446ea22e9 avfilter/formats: fix format negotiation when multiple channel_layouts are provided
For example
ffmpeg -f lavfi -i sine -af "aformat=cl=stereo|5.1|7.1,lowpass,aformat=cl=7.1|5.1|stereo" -f null -

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-13 18:21:29 -03:00
Niklas Haas
c65e481330 lavfi/vf_libplacebo: allow operation without avhwdevice
Recent versions of libplacebo have required Vulkan versions incompatible
with lavu Vulkan hwcontexts. While this is expected to change
eventually, breaking vf_libplacebo every time there is such a transition
period is obviously undesired behavior, as the following sea of bug
reports shows.

This commit adds a fallback path for init_vulkan failures which simply
creates an internal device if there was no user-supplied Vulkan hwaccel.
Useful when no interop with lavu vulkan hwframes is needed or desired,
and makes using this filter easier inside certain applications.

Fixes: https://github.com/haasn/libplacebo/issues/170
Fixes: https://github.com/mpv-player/mpv/issues/9589#issuecomment-1535432185
Fixes: https://github.com/mpv-player/mpv/issues/11363
Fixes: https://github.com/mpv-player/mpv/issues/11685#issuecomment-1546627082
Closes: https://code.videolan.org/videolan/libplacebo/-/issues/270
2023-05-13 17:38:20 +02:00
Paul B Mahol
e076d8a9b3 avfilter/af_asetrate: extend query_formats()
It left some formats not defined. Causing format negotiation
errors with ffplay.

Fixes #9248
2023-05-13 10:58:48 +02:00
Paul B Mahol
ee6ef66d65 avfilter/avfiltergraph: fix check for negative return
Before this commit if allocation would fail in ff_add_channel_layout()
function, function would return negative error code and this would
cause wrong format pick up later. If allocation would not fail return
code would be 0 and then format negotiation would simply fail as code
would break from the loop but with wrong return code.

Error was introduced in 6aaac24d72 commit.

Fixes #6638
2023-05-13 10:58:46 +02:00
James Almer
8564b4ab05 avfilter/ccfifo: constify some parameters
Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-12 22:33:16 -03:00
Paul B Mahol
e65f03ca13 avfilter/af_loudnorm: simplify query_formats even more 2023-05-12 22:44:54 +02:00
James Almer
7f890b2fbb avfilter/ccfifo: remove unnecessary context allocations
This is not public API, no it has no need for an alloc() and free()
functions. The struct can reside on stack.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-12 16:21:18 -03:00
Andriy Utkin
86ee031795 doc/muxers/image2: drop unmatched quote in example
Percent sign is not a special character in popular shells, so the
quoting isn't necessary.
2023-05-12 16:20:28 +05:30
Paul B Mahol
cb4e7831e7 avfilter/af_surround: scale output gain for non-default overlap 2023-05-12 12:33:33 +02:00
Paul B Mahol
09cd89df27 avfilter/af_surround: cache constant rdft_size inside loops 2023-05-12 12:33:33 +02:00