Commit Graph
1947 Commits
Author SHA1 Message Date
James Almer de5667b015 fftools/ffmpeg_mux_init: select enhancement streams if they are alone
In that scenario, it's better than not choosing anything at all.
This is needed for the following changes.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-10-31 20:38:49 -03:00
Martin Storsjö b415a88067 ffmpeg: Generalize the setup of two pass encoding to other encoder types
Previously this was only done for video encoders, but e.g. audio
encoders may also wish to do two pass encoding.
2026-10-30 14:56:05 +00:00
Niklas Haas 9e5cdcbefa fftools/ffmpeg_filter: split -filter_buffered_frames per media type
This allows callers to (optionally) set a specific limit for audio and
video frames, separately.

Since these are not really stream options, I had to add a new parsing logic
to handle the :a and :v suffixes, but I don't think it's too ugly.

As an aside, also fixes a memleak if setting the option somehow fails.

Signed-off-by: Niklas Haas <git@haasn.dev>
2026-10-29 13:09:04 +00:00
Jun Zhao 195954b861 fftools/ffmpeg_filter: do not pick inputs closed by the filtergraph
A filtergraph can close one of its inputs itself, e.g. when a filter
such as trim returns EOF on a looped input whose upstream never sends
EOF. Such inputs are marked with ifp->eof by close_input(), but
choose_input() only skipped inputs that had received an EOF from
upstream (fgt->eof_in). It could therefore pick a closed input, whose
frames can never arrive, while choking every other input's decoder
queue, deadlocking the CLI at 0% CPU.

Skip graph-closed inputs in choose_input(); close inputs that no
longer accept data before choosing the next input instead of only
after read_frames() returns, so a just-closed input cannot be picked;
restart input selection when sending a frame closes the selected
input, so a stale fgt->next_in pointing at it is not reused; and
re-send EOF for graph-closed inputs when reconfiguring the graph, so
they are not resurrected.

Fixes: https://code.ffmpeg.org/FFmpeg/FFmpeg/issues/25548
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2026-10-29 02:06:15 +00:00
Michael Niedermayer 2a04ba7b68 ffplay: add a show mode that colors stereo content by its phase difference
The phase mode is the RDFT display with the blue component raised and
the red and green components lowered by phase(L) - phase(R), wrapped to
(-pi, pi], times the smaller of the red and green components. This shows
channels in antiphase, which look the same as channels in phase in the
RDFT display.

Basically it looks pretty
2026-10-28 20:56:32 +00:00
Michael Niedermayer 730f432233 ffplay: show only the DC bin in the bottom row of the RDFT display 2026-10-28 20:56:32 +00:00
Michael Niedermayer a881f0a9ad ffplay: only compile bprint_styles() with libass
Fixes warning
2026-10-24 15:47:13 +00:00
Niklas Haas 3633db7232 fftools/ffprobe: print gain map parameters
Signed-off-by: Niklas Haas <git@haasn.dev>
2026-10-23 20:33:53 +00:00
Romain Beauxis 39d0384683 fftools/ffprobe: print seek_preroll for audio streams
Show AVCodecParameters.seek_preroll next to initial_padding in the
stream section, and add the attribute to the XSD. Demuxers that know
a pre-roll, such as Opus, report it there; everything else prints 0.
2026-10-23 15:38:04 +00:00
James Almer bd030344b7 fftools/ffmpeg_demux: automatically apply Alpha layer on Alpha Stream Group input
Signed-off-by: James Almer <jamrial@gmail.com>
2026-10-23 11:22:12 -03:00
James Almer c2c30b7b30 fftools/ffmpeg_filer: ensure all internal filtergraphs are removed if their outputs are unbound
If an internal filtergraph that's removed references another internal
filtergraph, we need to do another dry run to ensure said internal filtegraphs
it referenced are still needed.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-10-23 11:22:12 -03:00
Michael Niedermayer 79d5bd6306 fftools/ffmpeg_filter: preserve display matrix when hardware autorotation is skipped
configure_input_video_filter() does not apply autorotation to hardware
pixel formats. Match that condition when deciding whether to remove the
global display matrix in ifilter_parameters_from_frame(), so transcoding
hardware frames does not discard their unapplied orientation.

The matrix was preserved before 7b18beb477.
631ac6d055 restored propagation with
-noautorotate, but left hardware inputs using the default setting affected.

Related to issue #25089. This preserves orientation metadata; automatic
insertion of hardware rotation filters remains unimplemented.

Tested with CUDA decoding and HEVC NVENC encoding at 0, 90, 180 and 270
degrees, with software decoding and with -noautorotate. fate-autorotate
also passes.

Assisted-by: Fairy
2026-10-23 13:54:52 +00:00
Michael Niedermayer d98487b687 ffplay: avoid signed overflow of the list shuffle seed
Volunteer for testing welcome

Fixes: Qc9DRRq5X1KU
Fixes: signed integer overflow
Signed integer overflow Replicated through Modified FFmpeg with UBSAN
Found during the review of https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24589
2026-10-20 20:41:50 +00:00
Michael Niedermayer aaf8605851 fftools/ffmpeg_filter: do not drop subtitle EOF received before graph configuration
This is bascially fairies suggested change

Fixes: issue #20353
Regressed-by: d119ae2fd8 ("fftools/ffmpeg_filter: convert to the scheduler")
2026-10-19 23:42:07 +00:00
Michael Niedermayer 250f0f1624 fftools/ffmpeg_filter: check sub2video_frame() return value when flushing the queue 2026-10-19 23:42:07 +00:00
Michael Niedermayer eceaa54a38 ffplay: report an event that could not be pushed
A stream whose event the event loop never hears of stays pending, so
say when that happens.

Assisted-by: Claude
2026-10-18 03:19:28 +00:00
Michael Niedermayer f081afd4bd ffplay: compute the alpha reciprocals of the list once
Assisted-by: Claude
2026-10-18 03:19:28 +00:00
Michael Niedermayer 986de869bd ffplay: keep the list rows and the sort scratch in the allocation of the entries
Assisted-by: Claude
2026-10-18 03:19:28 +00:00
Michael Niedermayer e518fd0891 ffplay: drop the list helpers that wrap one call
Assisted-by: Claude
2026-10-18 03:19:28 +00:00
Michael Niedermayer d4063b0e24 ffplay: grow the list arrays with the dynarray helpers
Assisted-by: Claude
2026-10-18 03:19:28 +00:00
Michael Niedermayer 03f239cd74 ffplay: do not render a hidden list
A resize or a clearing of a hidden list drops what was rendered instead
of rendering it again for nobody.

Assisted-by: Claude
2026-10-18 03:19:28 +00:00
Michael Niedermayer c67cbdc0be ffplay: parse the list styles once per canvas
The styles of a layout go into one ASS track as its header, and the
script of a strip holds only its events, so a strip render parses the
events alone, the cache keys shrink to them, and the frame is the whole
canvas, which lets the metadata popup be one strip instead of a strip
per line that also draws the line above it.

Assisted-by: Claude
2026-10-18 03:19:28 +00:00
Michael Niedermayer 949c78e1ab ffplay: keep the list as it is while it fades out
The search line and the search are dropped once the list is hidden
instead of when it is unpinned, so neither the layout nor the rows
change under the fade.

Assisted-by: Claude
2026-10-18 03:19:28 +00:00
Michael Niedermayer 4c838cbfa1 ffplay: list directories and play files chosen from the list
The o key lists the directory of the input, local or remote, in the
list. Enter or a click lists the chosen directory or plays the chosen
file instead of the input once it opened, so a file that is no media
leaves the input playing. Directories come first, hidden entries are
left out, and the popup of a file shows its size.

Assisted-by: Claude
2026-10-18 03:19:28 +00:00
Michael Niedermayer 6601ca68f7 ffplay: show the sort buttons of a column only when an entry has data for it
Assisted-by: Claude
2026-10-18 03:19:28 +00:00
Michael Niedermayer 8fdf7f7241 ffplay: keep the list in the window instead of the VideoState
The list is an overlay of the window, so one list serves whatever
stream is playing.

Assisted-by: Claude
2026-10-18 03:19:28 +00:00
Michael Niedermayer 2ead3d0bdd cosmetics: ffplay: drop the scope of the audio filter setup
Assisted-by: Claude
2026-10-18 03:19:28 +00:00
Michael Niedermayer c74f97bcd8 ffplay: factor starting the audio output out of stream_component_open()
The audio device is opened once the audio decoder is set up, and a
failure to start the audio output closes the audio stream again.

Assisted-by: Claude
2026-10-18 03:19:28 +00:00
Michael Niedermayer c060100ff3 ffplay: start the packet queue of a decoder when initializing it
This allows queuing the packets of a decoder before its thread starts.

Assisted-by: Claude
2026-10-18 03:19:28 +00:00
Michael Niedermayer 03ce67df75 ffplay: factor clearing the list search out of unpinning the list
Assisted-by: Claude
2026-10-18 03:19:28 +00:00
Michael Niedermayer b6964c210c ffplay: remember the key that pins a list instead of a chapter list flag
Assisted-by: Claude
2026-10-18 03:19:28 +00:00
Michael Niedermayer e5fc67dd1f ffplay: mark the events of a stream with its id
The event loop quits only on a quit event of the stream playing, so
that events of another stream can be told apart.

Assisted-by: Claude
2026-10-18 03:19:28 +00:00
Michael Niedermayer b1277e727a ffplay: keep the audio device and its callback time in the VideoState
So that each open input plays through its own device.

Assisted-by: Claude
2026-10-18 03:19:28 +00:00
Michael Niedermayer eb2a565071 ffplay: count the loops of each input
-loop was counted down in the global option, so a later input played
only the loops the first one left.

Assisted-by: Claude
2026-10-18 03:19:28 +00:00
Michael Niedermayer c31578d6c3 ffplay: open every input with the given format options
avformat_open_input() replaces the dictionary it is given with the
options it did not use, which left the global format options without
the recognized ones after the first input. Each input is opened with a
copy now.

Assisted-by: Claude
2026-10-18 03:19:28 +00:00
Michael Niedermayer b7d7233d4e ffplay: keep the startup volume in percent
stream_open() replaced the -volume percentage with the SDL volume it
computed from it, so a second stream would compute its volume from the
first stream's.

Assisted-by: Claude
2026-10-18 03:19:28 +00:00
Michael Niedermayer fdc94e411e ffplay: keep what is decided for an input in its VideoState
The window title taken from the input's metadata, seeking by bytes and
the unlimited buffering of realtime inputs were decided once into
globals; they are kept per VideoState now, so that another input
decides them anew. The title string is freed with the stream.

Assisted-by: Claude
2026-10-18 03:19:28 +00:00
Michael Niedermayer 918c5ca2aa ffplay: render the list with libass directly
The strips were rendered by the ass filter over a color source in a
filter graph, whose generic blending took most of the time. libass now
renders each strip and its glyphs are composited over the strip
background where they cover it; a row strip at 1080p takes 0.47 instead
of 1.29 ms. ffplay suggests libass instead of the ass filter and no
longer selects the color filter.

Assisted-by: Claude
2026-10-18 03:19:28 +00:00
Michael Niedermayer f64a19478f ffplay: cache the rendered list strips
Each strip is rendered once into a cache keyed by its script, background
and place, and the bitmap is composed from the cached strips: what
differs from the strips shown before is cleared and composed again from
the strips covering it. Rows scrolling back into view, a highlight
returning to a row and repeated sorting or searching reuse rendered
strips, and the scroll shift and the rules for what lies under the
popup are gone. The cache holds up to twice the bitmap size, dropping
the least recently shown strips first.

Assisted-by: Claude
2026-10-18 03:19:28 +00:00
Michael Niedermayer bec872cc34 ffplay: move the chapter list into its own file
The list becomes a ListView in ffplay_list.c, which shows entries with
title, artist, length and metadata and reports the entry the user
chooses; ffplay builds the entries from the chapters and seeks to the
chosen one. The sort order moves from globals into the ListView.

Assisted-by: Claude
2026-10-18 03:19:28 +00:00
romainhedouin 231ce8136e ffplay: compute 1/sqrt(nb_freq) once outside the row loop
The value is the same for every row. No change in behaviour.

Found during a code review sweep of ffmpeg using an LLM.
2026-10-17 18:41:09 +00:00
romainhedouin afead44165 fftools/ffprobe: print gain_map_max from the right field
gain_map_max was printed from channel->gain_map_min. Update the
FATE reference accordingly.

Signed-off-by: romainhedouin <romain.hedouin@epitech.eu>
2026-10-15 02:53:00 +00:00
Michael Niedermayer 7b6e2f3a2a fftools/ffmpeg_mux: Avoid signed overflow in the invalid DTS fix-up
Fixes: signed integer overflow
Fixes: YK9ibCaczocG
Fixes: C041.heic
Signed integer overflow Replicated through UnModified FFmpeg with UBSAN
Found during triage of the security report GL61hVKFlOuU
2026-10-14 17:45:20 +00:00
Michael Niedermayer 8d4d9e5449 ffplay: un-premultiply the chapter list without dividing every channel
A table of 16.16 reciprocals of the alpha values replaces the three
divisions per pixel and gives the same results.

Assisted-by: Claude
2026-10-13 22:12:55 +00:00
Michael Niedermayer 53ca051ffa ffplay: scroll the chapter list bitmap instead of rendering every row again
When the list scrolls, the pixels of the rows that stay visible are
moved together with their strips, so only the rows scrolling in and
those whose content changed are rendered. Rows the popup covered are
rendered anew, as their pixels moved with the popup's.

Assisted-by: Claude
2026-10-13 22:12:55 +00:00
Michael Niedermayer 6d5667ead8 ffplay: wake up for input events instead of sleeping until the next refresh
The event loop slept up to REFRESH_RATE between refreshes while input
waited in the queue; waiting for an event with the same timeout handles
input as soon as it arrives.

Assisted-by: Claude
2026-10-13 22:12:55 +00:00
Michael Niedermayer 5e3e33501a ffplay: move the chapter list selection without rebuilding the rows
The rows are rebuilt and sorted whenever the list is shown; moving the
selection by key or wheel within the visible list only needs the new
selection, not another rebuild over all chapters.

Assisted-by: Claude
2026-10-13 22:12:55 +00:00
Michael Niedermayer 2b7ca873b5 ffplay: render the chapter list once per frame
Input handlers only ask for a render, which happens once the pending
events are handled, so a burst of wheel clicks or key presses renders
the list once instead of once per event.

Assisted-by: Claude
2026-10-13 22:12:55 +00:00
Michael Niedermayer 72b992934c ffplay: render only the chapter list strips that changed
The list is kept in one bitmap made of horizontal strips: the header,
each row, the bottom padding and each line of the metadata popup. A
strip is rendered through libass on a strip sized canvas, over its
background filled by the color source, only when its script, place or
background changed or when it lies on something cleared or redrawn
before it. Only the changed part of the bitmap is uploaded, on the next
refresh. Moving the mouse across the list thus renders and uploads the
two rows whose highlight changed instead of the whole list on a window
wide canvas.

The popup over the rows of a narrow window now covers them instead of
letting their text show through.

Assisted-by: Claude
2026-10-13 22:12:55 +00:00
Michael Niedermayer 4b5c351f9a ffplay: round the chapter length without overflowing
A chapter length near INT64_MAX overflowed the rounding, the hour count
was also truncated to int.

Fixes: signed integer overflow
Fixes: 7JHyBJsQ7bNE
Regression since: 80a55704b7
Found during the review of https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24589
Signed integer overflow Replicated through UnModified FFmpeg with UBSAN
2026-10-12 21:18:53 +00:00