1

There are many pairs of video and audio filters for the same purpose - one for video streams and the other for audio streams.

For example fade - afade, trim - atrim, split - asplit, loop - aloop.

The names for audio filters have the a prefix.

Why? Why they are different names for video and audio filters?

After all, every filter is applied to a particular individual stream, isn't it? So FFmpeg knows in advance the type of that stream, and is able to decide itself what type of filter have to use (video or audio), even if the names would be the same.

2 Answers 2

3

Mainly because this is how things got implemented / evolved from the start. Yes, it could be a single filter but that would need major changes to the current code.

0

The main reason lays in selecting an appropriate stream (audio or video) for filterchains with no input labels, for example

-filter_complex "[0:v]hue=s=0,split=2[outv1][outv2];fade;afade

The first filterchain [0:v]hue=s=0,split=2[outv1][outv2] has specified input label ([1:v]) but two others not.

So:

  • for the fade filter will be selected the first unused video stream, while
  • for the afade filter will be selected the first unused audio stream.

(In the case of only 1 video stream and only 1 audio stream in both input files in ffmpeg -i input1 -i input2 ...), the first unused video stream will be the video stream from the second input file, and the first unused audio stream will be the audio stream from the first input file.)

If there would be the same names for both video and audio filters, then filterchains with no input labels could't be allowed.

3
  • This is not a fatal problem. See the concat filter, which has options to set number of segments, and types of media. Even without linklabels, the filtergraph can be made to autoselect inputs based on that info e.g. fade=media=audio:type=out:...
    – Gyan
    Commented Jan 4, 2020 at 6:19
  • @Gyan, thanks for your useful info, but you would still have to specify media=audio, while for afade you needn't.
    – MarianD
    Commented Jan 4, 2020 at 14:01
  • True. I'm just pointing out that the main reason isn't technical. It's historical as Paul says.
    – Gyan
    Commented Jan 4, 2020 at 14:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.