Commit Graph

1681 Commits

Author SHA1 Message Date
James Almer
70a6ad6c74 fftools/ffmpeg_demux: ensure the display_rotation option is honored
If requested, it should have priotity over any coded value.
Fixes ticket #11649.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-08-26 11:44:09 -03:00
Leo Izen
5d4f873ff3 fftools/ffprobe: print EXIF side data size
We don't need to print the tags here because they're added as dict
elements to AVFrame->metadata and are printed elsewhere with ffprobe
-show_frames.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2025-08-19 11:26:48 -04:00
Andreas Hartmann
11a89bfe7b ffmpeg_opt: Parse regular options in ffpreset files
instead of only AV-specific options. The previous code assumed that any
option not defining the codec in an `ffpreset` file is an AVOption. This
for example prevented the use of options defined in `OptionDef[]`, like
`-pix_fmt`, as part of preset files, requiring users to type these out
every time.

Closes: #1530
Signed-off-by: Andreas Hartmann <hartan@7x.de>
2025-08-18 13:54:30 +00:00
Michael Niedermayer
cdbb5f1b93 fftools/ffmpeg_mux_init: Use 64bit for score computation in map_auto_video()
Fixes: signed integer overflow: 10 * 1952737655 cannot be represented in type 'int'
Fixes: PoC_avi_demux

Found-by: 2ourc3 (Salim LARGO)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-08-14 00:36:29 +00:00
softworkz
1ad97b82f3 fftools/resources: Update .gitignore
Signed-off-by: softworkz <softworkz@hotmail.com>
2025-08-13 17:39:49 +00:00
softworkz
f52d9dd869 fftools/resources: Fix double-build by disabling .d file generation
Signed-off-by: softworkz <softworkz@hotmail.com>
2025-08-13 17:39:49 +00:00
Niklas Haas
e29a99a975 fftools/ffmpeg_enc: don't ignore user selected chroma location
This code always ignored the user-provided enc_ctx->chroma_sample_location
in favor of the location tagged on the frame. This leads to a very (IMHO)
unexpected outcome where -chroma_sample_location works differently from the
related options like -colorspace and -color_range, the latter of which
override the frame properties as a consequence of being configured on the
filter graph output.

The discrepancy comes from the fact that the chroma sample location does not
itself participate in filter graph negotiation.

Solve the situation by only overriding the enc_ctx option if it was left
unspecified by the user, and otherwise printing a warning if the requested
parameter does not match the frame parameter.
2025-08-11 09:38:38 +02:00
Maryla Ustarroz-Calonge via ffmpeg-devel
6711c6a89b ffprobe: add -codec:<media_spec> option and -c:<media_spec> variant
opt_codec() is mostly copied over from ffplay.c.

This is useful when different decoders have different capabilities,
or to test a specific decoder.

Signed-off-by: Maryla Ustarroz-Calonge <maryla@google.com>
2025-08-10 10:19:57 +02:00
Timo Rothenpieler
262d41c804 all: fix typos found by codespell 2025-08-03 13:48:47 +02:00
Jiasheng Jiang
f7a6965308 fftools/cmdutils: Add av_freep() to avoid memory leak
Add av_freep() to free new_elem to avoid memory leak.

Fixes: 3ca1e31e63 ("fftools/cmdutils: Atomically add elements to list of pointers, fix crash")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-07-20 01:05:22 +02:00
Marton Balint
7d54fad868 fftools/ffmpeg: add support for setting maximum buffered frames in a filtergraph
Signed-off-by: Marton Balint <cus@passwd.hu>
2025-07-14 22:05:11 +02:00
James Almer
1787fade20 fftools/ffmpeg_demux: don't flag timestamps as unreliable if they are generated
Regardless of the source being an AVFMT_NOTIMESTAMPS format, if the timestamps
are generated like when using the use_wallclock_as_timestamps demuxer option,
then they are reliable.

Fixes ticket #11268

Signed-off-by: James Almer <jamrial@gmail.com>
2025-07-10 11:13:36 -03:00
Kacper Michajłow
5f62e2de98 fftools/cmdutils: don't try to load arguments from file if not needed
CLI option parser checks if argument exists when needed, but in this
case only OPT_TYPE_BOOL where checked, so OPT_TYPE_FUNC without argument
where trying to load a file from `arg` which is NULL in this case.

Fixes crash on `ffmpeg -/version`

Fixes: 6d17991b7e
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-07-05 21:05:56 +02:00
Marvin Scholz
05094c1749 fftools/textformat: remove unreachable code in tf_mermaid
Integer writing is impossible here as the first branch was dead code,
so remove it completely.

Fix CID 1646948

Reviewed-by: softworkz <softworkz@hotmail.com>
2025-07-05 02:35:00 +02:00
Marton Balint
42bcbdd456 fftools/ffmpeg_filter: always reap all available frames before requesting new ones
alfilter_graph_request_oldest() might return EAGAIN and produce a frame on not
the oldest sink.

Fixes ticket #11597.
Fixes excessive frame buffering in #10959.
Fixes excessive frame buffering in #11366.

Signed-off-by: Marton Balint <cus@passwd.hu>
2025-07-03 21:41:54 +02:00
Nicolas Gaullier
18c62245d7 fftools/textformat: renamings in print_unit_int for consistency (cosmetic)
Signed-off-by: Nicolas Gaullier <nicolas.gaullier@cji.paris>
Reviewed-by: softworkz <softworkz@hotmail.com>
2025-06-27 00:24:35 +02:00
Nicolas Gaullier
2b25a66238 fftools/textformat: fix print 64 bit integers
Regression in ffprobe since textformat introduction
in d7a3f68fea.

Fixes #11638

Signed-off-by: Nicolas Gaullier <nicolas.gaullier@cji.paris>
Reviewed-by: Marvin Scholz <epirat07@gmail.com>
Reviewed-by: softworkz <softworkz@hotmail.com>
2025-06-27 00:23:57 +02:00
Marvin Scholz
5c1e10d995 fftools/textformat: do not return early
This would make the goto dead code and also would not properly
call avtext_context_close.

Fix CID 1646939

Reviewed-by: softworkz <softworkz@hotmail.com>
2025-06-26 23:40:42 +02:00
Marvin Scholz
564a0784bb fftools/textformat: remove noop free
The tctx->hash was freed already right before.

Reviewed-by: softworkz <softworkz@hotmail.com>
2025-06-26 23:40:42 +02:00
Marvin Scholz
8430b8f9a9 fftools/textformat: narrow variable scopes
Reviewed-by: softworkz <softworkz@hotmail.com>
2025-06-26 23:40:42 +02:00
Marvin Scholz
7771a4eecb fftools/textformat: remove leftover comments in mermaid_print_value
Remove some leftover commented code and an extraneous semicolon.

Reviewed-by: softworkz <softworkz@hotmail.com>
2025-06-26 23:23:35 +02:00
Marvin Scholz
0578d4ad2f fftools/textformat: exit early in mermaid_print_value
Doesn't change the logic, instead of exiting in each of the two
branches below, just exit before.

Reviewed-by: softworkz <softworkz@hotmail.com>
2025-06-26 23:23:35 +02:00
Marton Balint
606efaa2cf fftools/ffmpeg_filter: simplify control flow in read_frames
No functional change.

Signed-off-by: Marton Balint <cus@passwd.hu>
2025-06-21 20:24:30 +02:00
Zhao Zhili
9c7b019284 fftools/ffplay_renderer: Use new vulkan queue API
Fixes deprecation warning.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2025-06-20 20:39:15 +08:00
Marvin Scholz
f019dd69f0 ffmpeg_demux: init resume_warn variable
Fixes an uninitialized read introduced with
6232f416b1

Fix CID 1643162 Uninitialized scalar variable
2025-06-11 19:32:05 +02:00
Ramiro Polla
afb91360ea fftools/Makefile: clean files from fftools/{graph,textformat}/ 2025-06-03 01:07:15 +02:00
Andreas Rheinhardt
688f3944ce fftools/graph/graphprint: Remove redundant avio_flush()
The AVIOContext will be automatically flushed upon closure.

Reviewed-by: softworkz . <softworkz-at-hotmail.com@ffmpeg.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-02 00:49:02 +02:00
Andreas Rheinhardt
e3b0320745 fftools/ffprobe: Fix indentation
Forgotten after d76b0c4a35.

Reviewed-by: softworkz . <softworkz-at-hotmail.com@ffmpeg.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-02 00:48:29 +02:00
Andreas Rheinhardt
5c5c7dff2b fftools/ffprobe: Factor writing common side data types out
Reviewed-by: softworkz . <softworkz-at-hotmail.com@ffmpeg.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-02 00:48:18 +02:00
Andreas Rheinhardt
6f452ad1ac fftools/textformat/avtextformat: Fix races when initializing formatters
Reviewed-by: softworkz . <softworkz-at-hotmail.com@ffmpeg.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-02 00:47:33 +02:00
Andreas Rheinhardt
4947e56974 fftools/resources/resman: Use proper logcontext
Reviewed-by: softworkz . <softworkz-at-hotmail.com@ffmpeg.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-02 00:47:16 +02:00
Andreas Rheinhardt
6d5e18b2f3 fftools/resources/resman: Use assert for always-false condition
Reviewed-by: softworkz . <softworkz-at-hotmail.com@ffmpeg.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-02 00:46:46 +02:00
Andreas Rheinhardt
06cd9086c3 fftools/resources/resman: Don't alloc ResourceManager, fix race
The resman_ctx pointer was accessed outside of its guarding
mutex.

Also make the ResourceManager static.

Reviewed-by: softworkz . <softworkz-at-hotmail.com@ffmpeg.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-02 00:45:18 +02:00
Andreas Rheinhardt
b4c5397642 fftools/textformat/avtextformat: Avoid relocations
Reviewed-by: softworkz . <softworkz-at-hotmail.com@ffmpeg.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-02 00:45:13 +02:00
Andreas Rheinhardt
0742239289 fftools/graph/graphprint: Fix races when initializing graphprint
Setting print_graphs_format (in case no -print_graphs_format
option was specified) is racy, as is using av_strtok()
to split it. Both have been removed.

Notice that using av_strtok() was destructive: In the absence
of races the options would only have been applied for the
first initialization.

Reviewed-by: softworkz . <softworkz-at-hotmail.com@ffmpeg.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-02 00:44:44 +02:00
James Almer
6ede1e3fbf fftools/ffmpeg_filter: make InputFilterPriv and OutputFilterPriv private again
As the names imply, they are structs meant to be internal and private to the
filter handling code. If a field is required in other modules, then it can
be moved to the public facing structs, which is done in this commit.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-06-01 14:12:50 -03:00
James Almer
1f034714f6 fftools/ffmpeg_filter: make FilterGraphPriv private again
As the name implies, it's a struct meant to be internal and private to the
filter handling code. If a field is required in other modules, then it can
be moved to the public facing struct, which is done in this commit.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-06-01 14:12:50 -03:00
softworkz
b7d44dde3b fftools/tf_mermaid: Add missing uninit and fix leaks
- merge forgotten uninit from work branch
- add set_str() function to free before overwriting
- fix some other leaks

Signed-off-by: softworkz <softworkz@hotmail.com>
2025-05-28 01:02:55 +02:00
softworkz
a0ac89e46c fftools/graphprint: Fix memory leaks
- uninit resource manager
- free strings before overwriting
- unref hw_frames_context

Signed-off-by: softworkz <softworkz@hotmail.com>
2025-05-28 01:02:55 +02:00
softworkz
75a5e0959f fftools/ffmpeg: Free print_graph option variables
Signed-off-by: softworkz <softworkz@hotmail.com>
2025-05-28 01:02:55 +02:00
softworkz
aa38270630 fftools/makefile: Remove resources from ffprobe
Even though it doesn't have any effect, that line is not needed (yet).

Signed-off-by: softworkz <softworkz@hotmail.com>
2025-05-28 01:02:55 +02:00
Timo Rothenpieler
4cb42551d4 fftools/resources: add missing extensions to .gitignore
Reviewed-by: softworkz <softworkz@hotmail.com>
2025-05-28 01:02:55 +02:00
Mark Thompson
20502ba92a ffmpeg: Don't print graphs if there are no outputs yet
Avoids writing an empty json blob in setup error cases.
2025-05-18 15:17:41 +01:00
Mark Thompson
c18d1b63ab fftools/graphprint: Fix leak of graph section header string 2025-05-18 15:17:41 +01:00
Mark Thompson
2070cc138b fftools/graphprint: Fix leak of graphprint object 2025-05-18 15:17:41 +01:00
Marton Balint
0d6ef6f545 fftools/textformat: correctly propagate uninit error codes
This allows catching IO errors occuring at file close.

Signed-off-by: Marton Balint <cus@passwd.hu>
2025-05-16 20:43:58 +02:00
Marton Balint
a124c9a580 Revert "fftools/textformat/avtextformat: Make close functions return void"
This reverts commit 7684243fbe and
a888975a3c.
2025-05-16 20:43:58 +02:00
softworkz
79e2a845cd Revert "fftools/graphprint: Now, make it a Killer-Feature!"
This reverts commit 1f2b8d7238.
2025-05-16 10:37:29 +02:00
softworkz
1f2b8d7238 fftools/graphprint: Now, make it a Killer-Feature!
remember this: -sg   <= means Show Graph

Signed-off-by: softworkz <softworkz@hotmail.com>
2025-05-15 23:11:08 +02:00
softworkz
45926bc09a fftools/graphprint: Add execution graph printing
The key benefits are:

- Different to other graph printing methods, this is outputting:
  - all graphs with runtime state
    (including auto-inserted filters)
  - each graph with its inputs and outputs
  - all filters with their in- and output pads
  - all connections between all input- and output pads
  - for each connection:
    - the runtime-negotiated format and media type
    - the hw context
    - if video hw context, both: hw pixfmt + sw pixfmt
- Output can either be printed to stdout or written to specified file
- Output is machine-readable
- Use the same output implementation as ffprobe, supporting multiple
  formats

Signed-off-by: softworkz <softworkz@hotmail.com>
2025-05-15 23:09:17 +02:00