user17561: I am using the trim filter to cut out portions of my input pad that I do not want. I cannot use the -ss or -t option because I have to do trimming inside the filter-graph.
Here is my trim usage
trim=start=4:duration=4

The source is 10 seconds long, I just want to retrieve the portion starting at 4th second till 8th second. I get it with the above filter usage, but the output is still 10 seconds long with the trimmed out portions at the start and the end shown as "static" or paused frames. How do I get rid of those?
Edit: I was able to cut out the static frames at the start by using setpts=PTS-STARTPTS but what it did was, it added that extra duration at the end.
Here is my full command with output
C:\Temp\del>c:\temp\ffmpeg\bin\ffmpeg.exe -y -i source\6.MOV -vf "trim=start=4:end=8:duration=4,setpts=PTS-STARTPTS" out\ test.mov ffmpeg version N-82151-g1e660fe Copyright (c) 2000-2016 the FFmpeg developers   built with gcc 5.4.0 (GCC)   configuration: --enable-gpl
--enable-version3 --disable-w32threads --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --en able-bzlib --enable-libebur128 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --en able-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3la me --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --en able-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --e nable-libvo-amrwbenc --enable-libvorbis --enable-libvpx
--enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-l ibxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib   libavutil      55. 35.100 / 55. 35.100   libavcodec     57. 65.100 / 57. 65.100   libavformat    57. 57.100 / 57. 57.100   libavdevice    57.  2.100 / 57.  2.100   libavfilter     6. 66.100 /  6. 66.100   libswscale      4.  3.100 / 
4.  3.100   libswresample   2.  4.100 /  2.  4.100   libpostproc    54.  2.100 / 54.  2.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'source\6.MOV':   Metadata:
    major_brand     : qt
    minor_version   : 0
    compatible_brands: qt
    creation_time   : 2016-12-24T03:18:57.000000Z
    com.apple.quicktime.location.ISO6709: +30.1993-081.6121+005.747/
    com.apple.quicktime.make: Apple
    com.apple.quicktime.model: iPhone 6s
    com.apple.quicktime.software: 10.2
    com.apple.quicktime.creationdate: 2016-12-23T22:18:57-0500   Duration: 00:00:10.58, start: 0.000000, bitrate: 15407 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 15316 kb/s, 29.98 fps, 29.97 tbr, 600 tbn, 1 200 tbc (default)
    Metadata:
      rotate          : 180
      creation_time   : 2016-12-24T03:18:57.000000Z
      handler_name    : Core Media Data Handler
      encoder         : H.264
    Side data:
      displaymatrix: rotation of -180.00 degrees
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 83 kb/s (default)
    Metadata:
      creation_time   : 2016-12-24T03:18:57.000000Z
      handler_name    : Core Media Data Handler
    Stream #0:2(und): Data: none (mebx / 0x7862656D), 0 kb/s (default)
    Metadata:
      creation_time   : 2016-12-24T03:18:57.000000Z
      handler_name    : Core Media Data Handler
    Stream #0:3(und): Data: none (mebx / 0x7862656D), 0 kb/s (default)
    Metadata:
      creation_time   : 2016-12-24T03:18:57.000000Z
      handler_name    : Core Media Data Handler [libx264 @ 00000000007cc900] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2 [libx264 @ 00000000007cc900] profile High, level 4.0 [libx264 @ 00000000007cc900] 264 - core 148 r2721 72d53ab - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.ht ml - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 tre llis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 int erlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250  keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq
=1:1.00 Output #0, mov, to 'out\test.mov':   Metadata:
    major_brand     : qt
    minor_version   : 0
    compatible_brands: qt
    com.apple.quicktime.creationdate: 2016-12-23T22:18:57-0500
    com.apple.quicktime.location.ISO6709: +30.1993-081.6121+005.747/
    com.apple.quicktime.make: Apple
    com.apple.quicktime.model: iPhone 6s
    com.apple.quicktime.software: 10.2
    encoder         : Lavf57.57.100
    Stream #0:0(und): Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1920x1080, q=-1--1, 29.97 fps, 30k tbn, 29.97 tbc (default)
    Metadata:
      handler_name    : Core Media Data Handler
      creation_time   : 2016-12-24T03:18:57.000000Z
      encoder         : Lavc57.65.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 69 kb/s (default)
    Metadata:
      creation_time   : 2016-12-24T03:18:57.000000Z
      handler_name    : Core Media Data Handler
      encoder         : Lavc57.65.100 aac Stream mapping:   Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))   Stream #0:1 -> #0:1 (aac (native) -> aac (native)) Press [q] to stop, [?] for help frame=  120 fps= 18 q=-1.0 Lsize=    3030kB time=00:00:10.58 bitrate=2344.3kbits/s speed=1.63x video:2934kB audio:90kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.214492% [libx264 @ 00000000007cc900] frame I:8     Avg QP:20.11  size: 39494 [libx264 @ 00000000007cc900] frame P:52    Avg QP:22.77  size: 28036 [libx264 @ 00000000007cc900] frame B:60    Avg QP:22.78  size: 20490 [libx264 @ 00000000007cc900] consecutive B-frames: 31.7%  3.3%  5.0%
60.0% [libx264 @ 00000000007cc900] mb I  I16..4: 21.2% 77.3%  1.4% [libx264 @ 00000000007cc900] mb P  I16..4: 17.2% 45.0%  0.2%  P16..4:
30.2%  2.8%  1.0%  0.0%  0.0%    skip: 3.6% [libx264 @ 00000000007cc900] mb B  I16..4:  4.8%  6.5%  0.0%  B16..8: 34.5%  4.1%
0.6%  direct:25.4%  skip:24.2%  L0:48.4% L1:49.0% BI:
2.6% [libx264 @ 00000000007cc900] 8x8 transform intra:71.0% inter:91.1% [libx264 @ 00000000007cc900] coded y,uvDC,uvAC intra:
34.3% 68.7% 0.9% inter: 24.4% 66.3% 0.0% [libx264 @ 00000000007cc900] i16 v,h,dc,p: 26% 23% 17% 34% [libx264 @ 00000000007cc900] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 20% 33%  4%  3%  3%  3%  3%  3% [libx264 @ 00000000007cc900] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 35% 23% 19%  4%  6%  4%  4%  3%  2% [libx264 @ 00000000007cc900] i8c dc,h,v,p: 54% 25% 20%  1% [libx264 @ 00000000007cc900] Weighted P-Frames: Y:1.9% UV:0.0% [libx264 @ 00000000007cc900] ref P L0: 63.9%  6.5% 19.8%  9.9% [libx264 @ 00000000007cc900] ref B L0: 83.2% 13.5%  3.4% [libx264 @ 00000000007cc900] ref B L1: 92.5%  7.5% [libx264 @ 00000000007cc900] kb/s:6000.51 [aac @ 000000000075e020] Qavg: 699.398

Edit 2: My question was simplified for better understanding of the issue, my actual movie making command is as follows
ffmpeg.exe -y -i C:\Temp\del\source\1.mov -i C:\Temp\del\source\2.mov  -i C:\Temp\del\source\3.mov  -filter_complex "[0:v]drawtext=fontfile=/Windows/Fonts/ARLRDBD.ttf:fontsize=80:x=10:y=10:text='Title Goes Here':fontcolor=white@0.8:box=1:boxcolor=black@0.5:enable='between(t,12,18)'[first];[1:v]trim=start=4:duration=4,setpts=PTS-STARTPTS[second];[2:v]drawtext=fontfile=/Windows/Fonts/ARLRDBD.ttf:fontsize=80:x=10:y=10:text='Thank you for watching':fontcolor=white@0.8:box=1:boxcolor=black@0.5:enable='between(t,0,1)'[third]; [first][second][third] concat=n=3:v=1"


user1871: Since there is an audio stream present which is included in the output, you need to either disable that or trim it as well.
With audio trimmed:
ffmpeg -y -i source\6.MOV -vf "trim=start=4:end=8,setpts=PTS-STARTPTS" -af "atrim=start=4:end=8,asetpts=PTS-STARTPTS"  out\test.mov

Audio disabled:
ffmpeg -y -i source\6.MOV -vf "trim=start=4:end=8,setpts=PTS-STARTPTS" -an out\test.mov


17561: <p>I am using the <a href="https://ffmpeg.org/ffmpeg-filters.html#trim" rel="nofollow noreferrer">trim filter</a> to cut out portions of my input pad that I do not want. I cannot use the <code>-ss</code> or <code>-t</code> option because I have to do trimming inside the filter-graph.</p>

<p>Here is my trim usage</p>

<pre><code>trim=start=4:duration=4
</code></pre>

<p>The source is 10 seconds long, I just want to retrieve the portion starting at 4th second till 8th second. I get it with the above filter usage, but the output is still 10 seconds long with the trimmed out portions at the start and the end shown as "static" or paused frames. How do I get rid of those?</p>

<p>Edit: I was able to cut out the static frames at the start by using <code>setpts=PTS-STARTPTS</code> but what it did was, it added that extra duration at the end.</p>

<p>Here is my full command with output</p>

<pre><code>C:\Temp\del&gt;c:\temp\ffmpeg\bin\ffmpeg.exe -y -i source\6.MOV -vf "trim=start=4:end=8:duration=4,setpts=PTS-STARTPTS" out\ test.mov ffmpeg version N-82151-g1e660fe Copyright (c) 2000-2016 the FFmpeg developers   built with gcc 5.4.0 (GCC)   configuration: --enable-gpl
--enable-version3 --disable-w32threads --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --en able-bzlib --enable-libebur128 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --en able-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3la me --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --en able-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --e nable-libvo-amrwbenc --enable-libvorbis --enable-libvpx
--enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-l ibxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib   libavutil      55. 35.100 / 55. 35.100   libavcodec     57. 65.100 / 57. 65.100   libavformat    57. 57.100 / 57. 57.100   libavdevice    57.  2.100 / 57.  2.100   libavfilter     6. 66.100 /  6. 66.100   libswscale      4.  3.100 / 
4.  3.100   libswresample   2.  4.100 /  2.  4.100   libpostproc    54.  2.100 / 54.  2.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'source\6.MOV':   Metadata:
    major_brand     : qt
    minor_version   : 0
    compatible_brands: qt
    creation_time   : 2016-12-24T03:18:57.000000Z
    com.apple.quicktime.location.ISO6709: +30.1993-081.6121+005.747/
    com.apple.quicktime.make: Apple
    com.apple.quicktime.model: iPhone 6s
    com.apple.quicktime.software: 10.2
    com.apple.quicktime.creationdate: 2016-12-23T22:18:57-0500   Duration: 00:00:10.58, start: 0.000000, bitrate: 15407 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 15316 kb/s, 29.98 fps, 29.97 tbr, 600 tbn, 1 200 tbc (default)
    Metadata:
      rotate          : 180
      creation_time   : 2016-12-24T03:18:57.000000Z
      handler_name    : Core Media Data Handler
      encoder         : H.264
    Side data:
      displaymatrix: rotation of -180.00 degrees
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 83 kb/s (default)
    Metadata:
      creation_time   : 2016-12-24T03:18:57.000000Z
      handler_name    : Core Media Data Handler
    Stream #0:2(und): Data: none (mebx / 0x7862656D), 0 kb/s (default)
    Metadata:
      creation_time   : 2016-12-24T03:18:57.000000Z
      handler_name    : Core Media Data Handler
    Stream #0:3(und): Data: none (mebx / 0x7862656D), 0 kb/s (default)
    Metadata:
      creation_time   : 2016-12-24T03:18:57.000000Z
      handler_name    : Core Media Data Handler [libx264 @ 00000000007cc900] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2 [libx264 @ 00000000007cc900] profile High, level 4.0 [libx264 @ 00000000007cc900] 264 - core 148 r2721 72d53ab - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.ht ml - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 tre llis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 int erlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250  keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq
=1:1.00 Output #0, mov, to 'out\test.mov':   Metadata:
    major_brand     : qt
    minor_version   : 0
    compatible_brands: qt
    com.apple.quicktime.creationdate: 2016-12-23T22:18:57-0500
    com.apple.quicktime.location.ISO6709: +30.1993-081.6121+005.747/
    com.apple.quicktime.make: Apple
    com.apple.quicktime.model: iPhone 6s
    com.apple.quicktime.software: 10.2
    encoder         : Lavf57.57.100
    Stream #0:0(und): Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1920x1080, q=-1--1, 29.97 fps, 30k tbn, 29.97 tbc (default)
    Metadata:
      handler_name    : Core Media Data Handler
      creation_time   : 2016-12-24T03:18:57.000000Z
      encoder         : Lavc57.65.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 69 kb/s (default)
    Metadata:
      creation_time   : 2016-12-24T03:18:57.000000Z
      handler_name    : Core Media Data Handler
      encoder         : Lavc57.65.100 aac Stream mapping:   Stream #0:0 -&gt; #0:0 (h264 (native) -&gt; h264 (libx264))   Stream #0:1 -&gt; #0:1 (aac (native) -&gt; aac (native)) Press [q] to stop, [?] for help frame=  120 fps= 18 q=-1.0 Lsize=    3030kB time=00:00:10.58 bitrate=2344.3kbits/s speed=1.63x video:2934kB audio:90kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.214492% [libx264 @ 00000000007cc900] frame I:8     Avg QP:20.11  size: 39494 [libx264 @ 00000000007cc900] frame P:52    Avg QP:22.77  size: 28036 [libx264 @ 00000000007cc900] frame B:60    Avg QP:22.78  size: 20490 [libx264 @ 00000000007cc900] consecutive B-frames: 31.7%  3.3%  5.0%
60.0% [libx264 @ 00000000007cc900] mb I  I16..4: 21.2% 77.3%  1.4% [libx264 @ 00000000007cc900] mb P  I16..4: 17.2% 45.0%  0.2%  P16..4:
30.2%  2.8%  1.0%  0.0%  0.0%    skip: 3.6% [libx264 @ 00000000007cc900] mb B  I16..4:  4.8%  6.5%  0.0%  B16..8: 34.5%  4.1%
0.6%  direct:25.4%  skip:24.2%  L0:48.4% L1:49.0% BI:
2.6% [libx264 @ 00000000007cc900] 8x8 transform intra:71.0% inter:91.1% [libx264 @ 00000000007cc900] coded y,uvDC,uvAC intra:
34.3% 68.7% 0.9% inter: 24.4% 66.3% 0.0% [libx264 @ 00000000007cc900] i16 v,h,dc,p: 26% 23% 17% 34% [libx264 @ 00000000007cc900] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 20% 33%  4%  3%  3%  3%  3%  3% [libx264 @ 00000000007cc900] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 35% 23% 19%  4%  6%  4%  4%  3%  2% [libx264 @ 00000000007cc900] i8c dc,h,v,p: 54% 25% 20%  1% [libx264 @ 00000000007cc900] Weighted P-Frames: Y:1.9% UV:0.0% [libx264 @ 00000000007cc900] ref P L0: 63.9%  6.5% 19.8%  9.9% [libx264 @ 00000000007cc900] ref B L0: 83.2% 13.5%  3.4% [libx264 @ 00000000007cc900] ref B L1: 92.5%  7.5% [libx264 @ 00000000007cc900] kb/s:6000.51 [aac @ 000000000075e020] Qavg: 699.398
</code></pre>

<p>Edit 2: My question was simplified for better understanding of the issue, my actual movie making command is as follows</p>

<pre><code>ffmpeg.exe -y -i C:\Temp\del\source\1.mov -i C:\Temp\del\source\2.mov  -i C:\Temp\del\source\3.mov  -filter_complex "[0:v]drawtext=fontfile=/Windows/Fonts/ARLRDBD.ttf:fontsize=80:x=10:y=10:text='Title Goes Here':fontcolor=white@0.8:box=1:boxcolor=black@0.5:enable='between(t,12,18)'[first];[1:v]trim=start=4:duration=4,setpts=PTS-STARTPTS[second];[2:v]drawtext=fontfile=/Windows/Fonts/ARLRDBD.ttf:fontsize=80:x=10:y=10:text='Thank you for watching':fontcolor=white@0.8:box=1:boxcolor=black@0.5:enable='between(t,0,1)'[third]; [first][second][third] concat=n=3:v=1"
</code></pre>
 1871: <p>Since there is an audio stream present which is included in the output, you need to either disable that or trim it as well.</p>

<p>With audio trimmed:</p>

<pre><code>ffmpeg -y -i source\6.MOV -vf "trim=start=4:end=8,setpts=PTS-STARTPTS" -af "atrim=start=4:end=8,asetpts=PTS-STARTPTS"  out\test.mov
</code></pre>

<p>Audio disabled:</p>

<pre><code>ffmpeg -y -i source\6.MOV -vf "trim=start=4:end=8,setpts=PTS-STARTPTS" -an out\test.mov
</code></pre>
