<p>Credit to @Gyan - the answer I was looking for, name each numbered input via the null filter:</p>
<p>These would go at the beginning of a filter_complex</p>
<pre><code>[0]null[sourcevideo];[1]null[qrcode];[2]null[logo];
</code></pre>

CC BY-SA 4.0
2023-02-21T23:03:04.497Z
[There are a variety of null filters](https://trac.ffmpeg.org/wiki/Null). This example application would, I think, not grab the audio tracks. So, you couldn't theoretically later use `[logo:a]` or `[logo:v]` in the same way you use `[0:v][0:a]`. You'd have to pass both with something like this: `[0:v][0:a]null[logov][logoa]`   I'm playing with this now, so might provide an answer if I run into anything specific.
user3643
CC BY-SA 4.0
2022-09-23T23:52:24.513Z
2022-09-25T00:09:12.877Z
2022-09-25T00:09:12.877Z
Duke Dougal
<p>The other answer (Duke's) suggests using the <code>null</code> filter, however, <a href="https://trac.ffmpeg.org/wiki/Null" rel="nofollow noreferrer">there are a variety of &quot;null&quot; filters</a> and the <code>null</code> filter alone won't cover every use case. Take Duke's example filter graph:</p>
<pre><code> [0]null[sourcevideo];[1]null[qrcode];[2]null[logo];
</code></pre>
<p><code>[sourcevideo]</code> will not contain the audio track, so, you couldn't theoretically later use <code>[sourcevideo:a]</code> or <code>[sourcevideo:v]</code>, though <code>[0:a]</code> would still be available to you. You also can't pass both with something like this: <code>[0:v][0:a]null[sourcevideov][sourcevideoa]</code>. <code>null</code> takes only one input and cannot take audio inputs. You'd have to use <code>anull</code> to get the audio track in the same way. Using the same assumed inputs, a filter graph that also grabs the first input's audio would look something like this:</p>
<pre><code> [0]null[sourcevideov];[0]anull[sourcevideoa];[1]null[qrcode];[2]null[logo];
</code></pre>
<p>Notice the use of <code>anull</code> for the <code>[0]</code> input audio track. Look through that link and you can probably imagine a few other instances where you might need to use a different &quot;null&quot; filter, but, in general, the null filters can be used to rename inputs.</p>

CC BY-SA 4.0
2023-02-21T23:39:27.750Z
2023-02-21T23:44:35.410Z
2023-02-21T23:44:35.410Z
user3643
<p>I'm writing a program to automate building of an ffmpeg command line.</p>
<p>One thing that is challenging me is that ffmpeg uses index numbers to identify the input sources.  It would be easier if there was a way I could name or label the input sources, which would make constructing -filter_complex arguments a whole lot easier.</p>
<p>Is there some way to name/label the inputs in ffmpeg?</p>

CC BY-SA 4.0
2022-09-23T07:24:52.383Z
Not possible...
Gyan
CC BY-SA 4.0
2022-09-23T07:29:10.903Z
Maybe is there some sort of filter that does nothing, allowing me to map an indexed input to a labeled/named output?
Duke Dougal
CC BY-SA 4.0
2022-09-23T10:29:20.010Z
Yes, e.g. `[4:v]null[logo]` and `[6:a]anull[jingle]`
Gyan
<ffmpeg>
Is there a way to name/label inputs in ffmpeg, instead of using input number?
Duke Dougal
# Is there a way to name/label inputs in ffmpeg, instead of using input number?

(Asked by: username_0 on 2022-09-23)

I'm writing a program to automate building of an ffmpeg command line.

One thing that is challenging me is that ffmpeg uses index numbers to identify the input sources. It would be easier if there was a way I could name or label the input sources, which would make constructing -filter\_complex arguments a whole lot easier.

Is there some way to name/label the inputs in ffmpeg?

**Tags:** ffmpeg

> **Comments:**
> **username_1**: Not possible...  
> **username_0**: Maybe is there some sort of filter that does nothing, allowing me to map an indexed input to a labeled/named output?  
> **username_1**: Yes, e.g. `[4:v]null[logo]` and `[6:a]anull[jingle]`  

---

## 2 answers

### Answer by username_0 on 2022-09-23. Score: 2

Credit to @username_1 - the answer I was looking for, name each numbered input via the null filter:
These would go at the beginning of a filter_complex
[0]null[sourcevideo];[1]null[qrcode];[2]null[logo];

> **Comments:**
> **username_2**: [There are a variety of null filters](https://trac.ffmpeg.org/wiki/Null). This example application would, I think, not grab the audio tracks. So, you couldn't theoretically later use `[logo:a]` or `[logo:v]` in the same way you use `[0:v][0:a]`. You'd have to pass both with something like this: `[0:v][0:a]null[logov][logoa]`   I'm playing with this now, so might provide an answer if I run into anything specific.  

---

### Answer by username_2 on 2023-02-21. Score: 0

The other answer (Duke's) suggests using the null filter, however, there are a variety of "null" filters and the null filter alone won't cover every use case. Take Duke's example filter graph:
 [0]null[sourcevideo];[1]null[qrcode];[2]null[logo];

[sourcevideo] will not contain the audio track, so, you couldn't theoretically later use [sourcevideo:a] or [sourcevideo:v], though [0:a] would still be available to you. You also can't pass both with something like this: [0:v][0:a]null[sourcevideov][sourcevideoa]. null takes only one input and cannot take audio inputs. You'd have to use anull to get the audio track in the same way. Using the same assumed inputs, a filter graph that also grabs the first input's audio would look something like this:
 [0]null[sourcevideov];[0]anull[sourcevideoa];[1]null[qrcode];[2]null[logo];

Notice the use of anull for the [0] input audio track. Look through that link and you can probably imagine a few other instances where you might need to use a different "null" filter, but, in general, the null filters can be used to rename inputs.


---

