1
0
Fork 0
Commit Graph

1404 Commits

Author SHA1 Message Date
Niklas Haas 6963033590 ffprobe: adapt to new AVFilmGrainParams
Follow the establish convention of printing the bit depth metadata
per-component.
2024-03-23 18:54:36 +01:00
Andreas Rheinhardt c77164390b fftools/ffmpeg_enc: Don't call frame_data twice
Reviewed-by: Jan Ekström <jeebjp@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-22 22:11:04 +01:00
Jan Ekström 8f4b173029 ffmpeg: pass first video AVFrame's side data to encoder
This enables further configuration of output based on the results
of input decoding and filtering in a similar manner as the color
information.
2024-03-20 19:15:05 +02:00
Mark Thompson 7f4b8d2f5e ffmpeg: set extra_hw_frames to account for frames held in queues
Since e0da916b8f the ffmpeg utility has
held multiple frames output by the decoder in internal queues without
telling the decoder that it is going to do so.  When the decoder has a
fixed-size pool of frames (common in some hardware APIs where the output
frames must be stored as an array texture) this could lead to the pool
being exhausted and the decoder getting stuck.  Fix this by telling the
decoder to allocate additional frames according to the queue size.
2024-03-19 22:56:56 +00:00
Marton Balint 7251f90972 fftools/ffplay: use correct buffersink channel layout parameters
Regression since 0995e1f1b3.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-03-19 20:48:22 +01:00
Andreas Rheinhardt 1faafe738d fftools/ffmpeg_opt: Check before accessing union member
OptionDef.u is only an offset (i.e. its off member) iff OPT_FLAG_OFFSET
is true. Otherwise, the pointer arithmetic can be undefined behaviour.
UBSan warns about this (on 32bit arches):
src/fftools/ffmpeg_opt.c:102:15: runtime error: pointer index expression with base 0xffa4db10 overflowed to 0x56059a50

This commit fixes this by checking for OPT_FLAG_OFFSET first.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-17 15:10:05 +01:00
Andreas Rheinhardt 78e2be2377 fftools/ffmpeg_sched: Remove set-but-unused variable
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-14 22:53:45 +01:00
James Almer 394abd8458 fftools/ffprobe: export IAMF Stream Group parameters
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-13 16:45:15 -03:00
James Almer 5cd8db3060 fftools/ffprobe: export Tile Grid Stream Group parameters
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-13 16:06:10 -03:00
Anton Khirnov 8996945d45 fftools/ffmpeg_enc: set AV_PKT_FLAG_TRUSTED on encoded packets
This allows using WRAPPED_AVFRAME encoders with loopback decoders in
order to connect multiple filtergraphs together.

Clear the flag in muxers, since lavf does not need it for anything and
it would change the results of framecrc FATE tests.
2024-03-13 08:01:28 +01:00
Anton Khirnov a9193f7b7d fftools/ffmpeg: add loopback decoding
This allows to send an encoder's output back to decoding and feed the
result into a complex filtergraph.
2024-03-13 08:01:27 +01:00
Anton Khirnov b98af440c5 fftools/ffmpeg: prepare FrameData for having allocated fields
Will be useful in following commits.
2024-03-13 08:01:15 +01:00
Anton Khirnov efab83c156 fftools/ffmpeg_sched: allow connecting encoder output to decoders 2024-03-13 08:01:15 +01:00
Anton Khirnov da17c4d24a fftools/ffmpeg_sched: factor initializing nodes into separate function
Will be useful in following commits.
2024-03-13 08:01:15 +01:00
Anton Khirnov 6ccbff2631 fftools/ffmpeg_sched: allow encoders to send to multiple destinations
Will become useful in following commits.
2024-03-13 08:01:15 +01:00
Anton Khirnov 3febc84e5e fftools/ffmpeg_enc: merge do_{audio,video}_out into frame_encode()
These functions used to be much longer, but now they are only a couple
lines each, some of them duplicated between audio and video.
2024-03-13 08:01:15 +01:00
Anton Khirnov 2f5c570dd6 fftools/ffmpeg_enc: drop unnecessary parameter from forced_kf_apply()
Encoder timebase is equal to the frame timebase, so does not need to be
passed separately.

Also, rename in_picture to frame, which is shorter and more accurate -
it always contains a frame, never a field.
2024-03-13 08:01:15 +01:00
Anton Khirnov 2ee9362419 fftools/ffmpeg: remove unncessary casts for *_thread() return values
These functions used to be passed directly to pthread_create(), which
required them to return void*. This is no longer the case, so they can
return a plain int.
2024-03-13 08:01:15 +01:00
Anton Khirnov f5d03b972c fftools/ffmpeg: simplify propagating fallback parameters from decoders to filters
Current callstack looks like this:
* ifilter_bind_ist() (filter) calls ist_filter_add() (demuxer);
* ist_filter_add() opens the decoder, and then calls
  dec_add_filter() (decoder);
* dec_add_filter() calls ifilter_parameters_from_dec() (i.e. back into
  the filtering code) in order to give post-avcodec_open2() parameters
  to the filter.

This is unnecessarily complicated. Pass the parameters as follows
instead:
* dec_init() (which opens the decoder) returns post-avcodec_open2()
  parameters to its caller (i.e. the demuxer) in a parameter-only
  AVFrame
* the demuxer passes these parameters to the filter in
  InputFilterOptions, together with other filter options
2024-03-13 08:01:15 +01:00
Anton Khirnov cabeac9123 fftools/ffmpeg_filter: add logging for binding inputs to demuxer streams 2024-03-13 08:01:15 +01:00
Anton Khirnov cb0ec854fd fftools/ffmpeg_filter: move filtergraph input type check to a better place
Perform it right after we figure out what the type is.
2024-03-13 08:01:15 +01:00
Anton Khirnov 7b51523f12 fftools/ffmpeg_opt: merge init_complex_filters() and check_filter_outputs()
The first of these binds inputs of complex filtergraphs to demuxer
streams (with a misleading comment claiming it *creates* complex
filtergraphs).

The second ensures that all filtergraph outputs are connected to an
encoder.

Merge them into a single function, which simplifies the ffmpeg_filter
API, is shorter, and will also be useful in following commits.

Also, rename misleadingly-named init_input_filter() to
fg_complex_bind_input().
2024-03-13 08:01:15 +01:00
Anton Khirnov c4de5778bc fftools/ffmpeg_dec: factor opening the decoder out of dec_open()
Rename dec_open to dec_init(), as it is more descriptive of its new
purpose.

Will be useful in following commits, which will add a new path for
opening decoders.
2024-03-13 08:01:15 +01:00
Anton Khirnov 48c39a9c71 fftools/ffmpeg_dec: move scheduler registration from dec_open() to dec_alloc()
Will be useful in following commits where we will want to create a
decoder before having enough information to open it.
2024-03-13 08:01:15 +01:00
Anton Khirnov 6f2acd7a9c fftools/ffmpeg_filter: drop unused InputFilterPriv.ist
Outside of ifilter_bind_ist(), there are no longer any assumptions about
about filter inputs being fed by an InputStream.
2024-03-13 08:01:15 +01:00
Anton Khirnov daca5d1241 fftools/ffmpeg_filter: refactor setting input timebase
Treat it analogously to stream parameters like format/dimensions/etc.
This is functionally different from previous code in 2 ways:
* for non-CFR video, the frame timebase (set by the decoder) is used
  rather than the demuxer timebase
* for sub2video, AV_TIME_BASE_Q is used, which is hardcoded by the
  subtitle decoding API

These changes should avoid unnecessary and potentially lossy timestamp
conversions from decoder timebase into the demuxer one.

Changes the timebases used in sub2video tests.
2024-03-13 08:01:15 +01:00
Anton Khirnov ddaedde7a8 fftools/cmdutils: fix printing group name in split_commandline() 2024-03-13 08:01:15 +01:00
Anton Khirnov f344277a88 fftools/ffmpeg_filter: merge block with the enclosing one
It has no reason to exist.
2024-03-12 09:47:56 +01:00
Anton Khirnov 639208cc6a fftools/ffmpeg_filter: don't forward EOF in close_output()
The caller does not need or expect it, and it can lead to terminating
filtering prematurely in case there is more than one output.
2024-03-12 09:47:56 +01:00
Anton Khirnov ce178be8b0 fftools/ffmpeg_filter: do not assume av_buffersrc_get_nb_failed_requests()>0
Apparently it can happen that avfilter_graph_request_oldest() returns
EAGAIN, yet av_buffersrc_get_nb_failed_requests() returns 0 for every
input.

Works around #10795, though the root issue is most likely in the
scale2ref filter.
2024-03-12 09:47:14 +01:00
Stefano Sabatini 58a1386eaf fftools/opt_common: show if muxer is device 2024-03-11 16:52:42 +01:00
Niklas Haas 30d6861a11 fftools/ffprobe: add AVFilmGrainParams printing 2024-03-07 21:09:06 +01:00
James Almer 583cf2a869 avutil: remove deprecated FF_API_FRAME_PICTURE_NUMBER
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 08:53:30 -03:00
James Almer b8fef7e9c5 avutil: remove deprecated FF_API_PKT_DURATION
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 08:53:30 -03:00
James Almer 65ddc74988 avutil: remove deprecated FF_API_OLD_CHANNEL_LAYOUT
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 08:53:30 -03:00
James Almer 7e4334e16a fftools/ffprobe: add support for Stream Groups
Reviewed-by: Stefano Sabatini <stefasab@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-05 12:56:21 -03:00
James Almer 3769968afd fftools/ffprobe: fix printing side data components and pieces
Components and pieces are side data specific fields and there's a variable
amount of them.
They also need to be identified in some form, so print a type too.

Reviewed-by: Stefano Sabatini <stefasab@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-05 12:56:13 -03:00
Anton Khirnov e2e2ee7711 fftools/ffplay: stop printing non-public AVCodecContext fields
They are documented as not intended for caller use.
2024-03-04 15:56:48 +01:00
Andreas Rheinhardt edfb4325e7 fftools/cmdutils: Inline print_error()
It is only used by ffprobe (once) and ffplay (twice);
inlining it avoids including it unnecessarily into ffmpeg.

Reviewed-by: Stefano Sabatini <stefasab@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-04 12:07:58 +01:00
Andreas Rheinhardt c6e1793e7a fftools/ffprobe: Print dispositions generically
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-03 17:16:45 +01:00
Andreas Rheinhardt 6c693da690 fftools/ffmpeg_demux, sync_queue: Constify a bit
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-02 02:51:59 +01:00
Anton Khirnov e48055fdce fftools/ffmpeg: remove options deprecated before 6.0 2024-03-01 16:51:11 +01:00
Zhao Zhili 39a0c55347 fftools/ffplay: Fix output color_spaces of filter
The sdl_supported_color_spaces only meant for SDL builtin renderer.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-03-01 17:19:15 +08:00
Andreas Rheinhardt 906fc2b2e7 fftools/ffmpeg_mux: Fix use of uninitialized variable
Broken in a2fc86378a.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-25 13:41:56 +01:00
Andreas Rheinhardt b31ee084a9 fftools/ffprobe: Use int64_t instead of long long int
This makes ffprobe match the rest of the codebase.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-25 02:19:18 +01:00
Andreas Rheinhardt 08328463d5 fftools/ffprobe: Simplify printing xml values
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-25 02:19:18 +01:00
Andreas Rheinhardt ed5bf403d7 fftools/ffprobe: Constify printing section header
Allows to avoid casting const away.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-25 02:19:18 +01:00
Andreas Rheinhardt 0f20e48e3d fftools/ffprobe: Don't cast const away needlessly
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-25 02:19:18 +01:00
Anton Khirnov c19c2078f3 fftools/ffmpeg_sched: remove a triggerable assert in send_to_enc_sq()
It can be triggered when send_to_enc_thread() returns AVERROR(ENOMEM).
Propagate the error to the caller instead.

Reported-by: Andreas Rheinhardt
2024-02-24 11:51:41 +01:00
Anton Khirnov a00765fcbe fftools/ffmpeg_sched: simplify failure path in sch_dec_send() 2024-02-24 11:51:41 +01:00