Opened 9 hours ago

#11409 new defect

Using -af and -vf with non-exhistant filter succeeds if input lacks required stream type

Reported by: Wes Castro Owned by:
Priority: normal Component: ffmpeg
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

When invoking the FFmpeg binary with -af of -vf followed by a filter that doesn't exist (for example not_a_filter) it silently ignores the error and succeeds as if the option wasn't passed in if the input has no streams of the required type. For example, if an audio input is used and -vf not_a_filter is passed in, it succeeds. Similarly, if a video input is used and -af not_a_filter is passed in it will also succeed.

Note that with -filter_complex it seems to always fail if a filter isn't found regardless of input type.

How to reproduce:
Audio input with -vf:

./ffmpeg -f lavfi -i sine=frequency=1000:duration=1 -vf not_a_filter -f null -
ffmpeg version N-118273-g251de1791e Copyright (c) 2000-2025 the FFmpeg developers
  built with gcc 11 (GCC)
  configuration: --enable-gpl
  libavutil      59. 54.101 / 59. 54.101
  libavcodec     61. 31.100 / 61. 31.100
  libavformat    61.  9.104 / 61.  9.104
  libavdevice    61.  4.100 / 61.  4.100
  libavfilter    10.  6.101 / 10.  6.101
  libswscale      8. 13.100 /  8. 13.100
  libswresample   5.  4.100 /  5.  4.100
  libpostproc    58.  4.100 / 58.  4.100
[out @ 0x2fd9b80] The "sample_fmts" option is deprecated: set the supported sample formats
[out @ 0x2fd9b80] The "all_channel_counts" option is deprecated: accept all channel counts
Input #0, lavfi, from 'sine=frequency=1000:duration=1':
  Duration: N/A, start: 0.000000, bitrate: 705 kb/s
  Stream #0:0: Audio: pcm_s16le, 44100 Hz, mono, s16, 705 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, null, to 'pipe:':
  Metadata:
    encoder         : Lavf61.9.104
  Stream #0:0: Audio: pcm_s16le, 44100 Hz, mono, s16, 705 kb/s
    Metadata:
      encoder         : Lavc61.31.100 pcm_s16le
[out#0/null @ 0x2fddfc0] video:0KiB audio:86KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: unknown
size=N/A time=00:00:01.00 bitrate=N/A speed= 351x  

Video input with -af:

./ffmpeg -f lavfi -i testsrc -t 10 -af not_a_filter -f null -
ffmpeg version N-118273-g251de1791e Copyright (c) 2000-2025 the FFmpeg developers
  built with gcc 11 (GCC)
  configuration: --enable-gpl
  libavutil      59. 54.101 / 59. 54.101
  libavcodec     61. 31.100 / 61. 31.100
  libavformat    61.  9.104 / 61.  9.104
  libavdevice    61.  4.100 / 61.  4.100
  libavfilter    10.  6.101 / 10.  6.101
  libswscale      8. 13.100 /  8. 13.100
  libswresample   5.  4.100 /  5.  4.100
  libpostproc    58.  4.100 / 58.  4.100
Input #0, lavfi, from 'testsrc':
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0: Video: wrapped_avframe, rgb24, 320x240 [SAR 1:1 DAR 4:3], 25 fps, 25 tbr, 25 tbn
Stream mapping:
  Stream #0:0 -> #0:0 (wrapped_avframe (native) -> wrapped_avframe (native))
Press [q] to stop, [?] for help
Output #0, null, to 'pipe:':
  Metadata:
    encoder         : Lavf61.9.104
  Stream #0:0: Video: wrapped_avframe, rgb24(pc, gbr/unknown/unknown, progressive), 320x240 [SAR 1:1 DAR 4:3], q=2-31, 200 kb/s, 25 fps, 25 tbn
    Metadata:
      encoder         : Lavc61.31.100 wrapped_avframe
[out#0/null @ 0x2fcd140] video:107KiB audio:0KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: unknown
frame=  250 fps=0.0 q=-0.0 Lsize=N/A time=00:00:10.00 bitrate=N/A speed= 315x 

Change History (0)

Note: See TracTickets for help on using tickets.