<p>You can consume a filter generated stream only once, unlike streams from <code>-i</code> inputs. Since <code>[vid]</code> is already supplied to the first trim <code>60:65</code>, it can't be reused. You can add a split and supply a copy to each:</p>

<pre><code>nullsrc,split=2[vid1][vid2]; ... [vid1]trim=60:65, ... [vid2]trim=120:125, ...
</code></pre>

CC BY-SA 3.0
2017-11-10T14:39:08.367Z
Thanks. It wasn't clear from the documentation that nullsink could be used only once. I have added the complete solution to the question.
Imad
CC BY-SA 3.0
2017-11-10T12:43:51.450Z
2017-11-10T12:43:51.450Z
Gyan
<p>I wrote a shell script that uses fzf to create repls from linux commands: <a href="https://github.com/vapniks/fzfrepl" rel="nofollow noreferrer">https://github.com/vapniks/fzfrepl</a>
There's an example in the Readme.org that shows how you can use it with ffmpeg, graph2dot &amp; graph-easy to get a live preview diagram of the ffmpeg filtergraph thats entered at the prompt.
This could be useful for debugging filtergraphs.</p>

CC BY-SA 4.0
2021-10-28T17:10:37.897Z
2021-10-28T17:10:37.897Z
Ben
<p>I am trying to understand the how FFmpeg's filtergraph works with the help of the <strong>graph2dot</strong> utility (<a href="https://video.stackexchange.com/questions/21017/ffmpeg-graph2dot-tool">FFmpeg graph2dot tool</a>). </p>

<p>I am using an example from one of the questions previously posted here (<a href="https://video.stackexchange.com/questions/10396/how-to-concatenate-clips-from-the-same-video-with-ffmpeg/10401?newreg=50e21837bd6c4e39b140e42229104e32">How to concatenate clips from the same video with ffmpeg</a>). Upon trying to parse the following filtergraph which is adapted from the accepted answer,  </p>

<p><code>echo "nullsrc[vid];anullsrc[aud];[vid]trim=60:65,setpts=PTS-STARTPTS[v0];[aud]atrim=60:65,asetpts=PTS-STARTPTS[a0];[vid]trim=120:125,setpts=PTS-STARTPTS[v1];[aud]atrim=120:125,asetpts=PTS-STARTPTS[a1];[v0][a0][v1][a1]concat=n=2:v=1:a=1[out];[out]nullsink" | graph2dot</code></p>

<p>I get the following error with FFmpeg (ver 3.4):</p>

<pre><code>[Parsed_nullsrc_0 @ 0x55cd2c952240] size:320x240 rate:25/1 duration:-1.000000 sar:1/1
[Parsed_trim_2 @ 0x55cd2c953500] Setting 'start' to value '60'
[Parsed_trim_2 @ 0x55cd2c953500] Setting 'end' to value '65'
[Parsed_setpts_3 @ 0x55cd2c953fc0] Setting 'expr' to value 'PTS-STARTPTS'
[Parsed_atrim_4 @ 0x55cd2c954f20] Setting 'start' to value '60'
[Parsed_atrim_4 @ 0x55cd2c954f20] Setting 'end' to value '65'
[Parsed_asetpts_5 @ 0x55cd2c955960] Setting 'expr' to value 'PTS-STARTPTS'
[Parsed_trim_6 @ 0x55cd2c9568c0] Setting 'start' to value '120'
[Parsed_trim_6 @ 0x55cd2c9568c0] Setting 'end' to value '125'
[Parsed_setpts_7 @ 0x55cd2c957120] Setting 'expr' to value 'PTS-STARTPTS'
[Parsed_atrim_8 @ 0x55cd2c957fa0] Setting 'start' to value '120'
[Parsed_atrim_8 @ 0x55cd2c957fa0] Setting 'end' to value '125'
[Parsed_asetpts_9 @ 0x55cd2c9587a0] Setting 'expr' to value 'PTS-STARTPTS'
[Parsed_concat_10 @ 0x55cd2c9596c0] Setting 'n' to value '2'
[Parsed_concat_10 @ 0x55cd2c9596c0] Setting 'v' to value '1'
[Parsed_concat_10 @ 0x55cd2c9596c0] Setting 'a' to value '1'
Input pad "default" with type video of the filter instance "Parsed_trim_6" of trim not connected to any source
</code></pre>

<p>As far as I understand, the <code>"Parsed_trim_6"</code> filter is connected to the source <code>nullsrc[vid]</code>.</p>

<p>Can anyone help me understand what's wrong here and how I can fix it?</p>

<p><strong>EDIT</strong>: Following Mulvya's hints, the correct solution is given below:</p>

<p><code>echo "nullsrc,split=2[vid1][vid2];anullsrc,asplit=2[aud1][aud2];[vid1]trim=60:65,setpts=PTS-STARTPTS[v0];[aud1]atrim=60:65,asetpts=PTS-STARTPTS[a0];[vid2]trim=120:125,setpts=PTS-STARTPTS[v1];[aud2]atrim=120:125,asetpts=PTS-STARTPTS[a1];[v0][a0][v1][a1]concat=n=2:v=1:a=1[outv][outa];[outv]nullsink,[outa]anullsink" | graph2dot</code></p>

<p>Other lessons I learnt from this</p>

<ul>
<li>Video and audio streams require separate sinks. Even with the concat filter, I wasn't able to merge them into the <code>[out]</code> destination as I had originally done</li>
</ul>

<ffmpeg>
FFmpeg filter_complex says filter not connected to source
Imad
# FFmpeg filter_complex says filter not connected to source

(Asked by: username_0 on 2017-11-10)

I am trying to understand the how FFmpeg's filtergraph works with the help of the graph2dot utility (FFmpeg graph2dot tool). 
I am using an example from one of the questions previously posted here (How to concatenate clips from the same video with ffmpeg). Upon trying to parse the following filtergraph which is adapted from the accepted answer,  
echo "nullsrc[vid];anullsrc[aud];[vid]trim=60:65,setpts=PTS-STARTPTS[v0];[aud]atrim=60:65,asetpts=PTS-STARTPTS[a0];[vid]trim=120:125,setpts=PTS-STARTPTS[v1];[aud]atrim=120:125,asetpts=PTS-STARTPTS[a1];[v0][a0][v1][a1]concat=n=2:v=1:a=1[out];[out]nullsink" | graph2dot
I get the following error with FFmpeg (ver 3.4):
[Parsed_nullsrc_0 @ 0x55cd2c952240] size:320x240 rate:25/1 duration:-1.000000 sar:1/1
[Parsed_trim_2 @ 0x55cd2c953500] Setting 'start' to value '60'
[Parsed_trim_2 @ 0x55cd2c953500] Setting 'end' to value '65'
[Parsed_setpts_3 @ 0x55cd2c953fc0] Setting 'expr' to value 'PTS-STARTPTS'
[Parsed_atrim_4 @ 0x55cd2c954f20] Setting 'start' to value '60'
[Parsed_atrim_4 @ 0x55cd2c954f20] Setting 'end' to value '65'
[Parsed_asetpts_5 @ 0x55cd2c955960] Setting 'expr' to value 'PTS-STARTPTS'
[Parsed_trim_6 @ 0x55cd2c9568c0] Setting 'start' to value '120'
[Parsed_trim_6 @ 0x55cd2c9568c0] Setting 'end' to value '125'
[Parsed_setpts_7 @ 0x55cd2c957120] Setting 'expr' to value 'PTS-STARTPTS'
[Parsed_atrim_8 @ 0x55cd2c957fa0] Setting 'start' to value '120'
[Parsed_atrim_8 @ 0x55cd2c957fa0] Setting 'end' to value '125'
[Parsed_asetpts_9 @ 0x55cd2c9587a0] Setting 'expr' to value 'PTS-STARTPTS'
[Parsed_concat_10 @ 0x55cd2c9596c0] Setting 'n' to value '2'
[Parsed_concat_10 @ 0x55cd2c9596c0] Setting 'v' to value '1'
[Parsed_concat_10 @ 0x55cd2c9596c0] Setting 'a' to value '1'
Input pad "default" with type video of the filter instance "Parsed_trim_6" of trim not connected to any source

As far as I understand, the "Parsed_trim_6" filter is connected to the source nullsrc[vid].
Can anyone help me understand what's wrong here and how I can fix it?
EDIT: Following Mulvya's hints, the correct solution is given below:
echo "nullsrc,split=2[vid1][vid2];anullsrc,asplit=2[aud1][aud2];[vid1]trim=60:65,setpts=PTS-STARTPTS[v0];[aud1]atrim=60:65,asetpts=PTS-STARTPTS[a0];[vid2]trim=120:125,setpts=PTS-STARTPTS[v1];[aud2]atrim=120:125,asetpts=PTS-STARTPTS[a1];[v0][a0][v1][a1]concat=n=2:v=1:a=1[outv][outa];[outv]nullsink,[outa]anullsink" | graph2dot
Other lessons I learnt from this

Video and audio streams require separate sinks. Even with the concat filter, I wasn't able to merge them into the [out] destination as I had originally done

**Tags:** ffmpeg


---

## 2 answers

### Answer by username_1 on 2017-11-10. Score: 2 | Accepted answer

You can consume a filter generated stream only once, unlike streams from -i inputs. Since [vid] is already supplied to the first trim 60:65, it can't be reused. You can add a split and supply a copy to each:
nullsrc,split=2[vid1][vid2]; ... [vid1]trim=60:65, ... [vid2]trim=120:125, ...

> **Comments:**
> **username_0**: Thanks. It wasn't clear from the documentation that nullsink could be used only once. I have added the complete solution to the question.  

---

### Answer by username_2 on 2021-10-28. Score: 0

I wrote a shell script that uses fzf to create repls from linux commands: <https://github.com/vapniks/fzfrepl>
There's an example in the Readme.org that shows how you can use it with ffmpeg, graph2dot & graph-easy to get a live preview diagram of the ffmpeg filtergraph thats entered at the prompt.
This could be useful for debugging filtergraphs.


---

