title: How to use ffmpeg to concatenate subtitles only?
body: <p>I have 4 subtitle segments each in 1 mkv container. Now I want to concatenate them to 1 stream so I can mux it with video and audio streams.</p>
  
  <p>I tried</p>
  
  <pre><code>ffmpeg -i "concat:\
  22082016-0749_sub_seg1.mkv|\           =&gt; 505 KB
  22082016-0749_sub_seg2.mkv|\           =&gt; 401 KB
  22082016-0749_sub_seg3.mkv|\           =&gt; 489 KB
  22082016-0749_sub_seg4.mkv" \          =&gt; 243 KB
  -c:s copy -y \
  22082016-0749_sub_complete.mkv         =&gt; 505 KB, should be ~1638 KB
  </code></pre>
  
  <p>But this only copies the first segment.</p>
  
  <p>I also tried</p>
  
  <pre><code>ffmpeg -canvas_size 492x250 -fix_sub_duration -txt_format bitmap -txt_page 149 -ss 00:14:12.000 -i 22082016-0749.mts -to 00:27:18.480 -map 0:s:0 -c:s dvd_subtitle -y 22082016-0749_sub_seg1.mkv
  ffmpeg -canvas_size 492x250 -fix_sub_duration -txt_format bitmap -txt_page 149 -ss 00:48:57.800 -i 22082016-0749.mts -to 00:26:34.960 -map 0:s:0 -c:s dvd_subtitle -y 22082016-0749_sub_seg2.mkv
  ffmpeg -canvas_size 492x250 -fix_sub_duration -txt_format bitmap -txt_page 149 -ss 01:23:14.840 -i 22082016-0749.mts -to 00:26:59.200 -map 0:s:0 -c:s dvd_subtitle -y 22082016-0749_sub_seg3.mkv
  ffmpeg -canvas_size 492x250 -fix_sub_duration -txt_format bitmap -txt_page 149 -ss 01:58:03.120 -i 22082016-0749.mts -to 00:19:13.680 -map 0:s:0 -c:s dvd_subtitle -y 22082016-0749_sub_seg4.mkv
  </code></pre>
  
  <p>(The above command works, the command below does not)</p>
  
  <pre><code>ffmpeg \
  -i 22082016-0749_sub_seg1.mkv \
  -i 22082016-0749_sub_seg2.mkv \
  -i 22082016-0749_sub_seg3.mkv \
  -i 22082016-0749_sub_seg4.mkv \
  -filter_complex "\
  [0:s]trim=0:1638.480,setpts=PTS-STARTPTS[g1];\
  [1:s]trim=0:1594.960,setpts=PTS-STARTPTS[g2];\
  [2:s]trim=0:1619.200,setpts=PTS-STARTPTS[g3];\
  [3:s]trim=0:1140.680,setpts=PTS-STARTPTS[g4];\
  [g1][g2][g3][g4]concat=n=4[out]" \
  -map [out] -c:s copy -y \
  22082016-0749_sub_complete.mkv
  </code></pre>
  
  <p>This runs into the following error:</p>
  
  <pre><code>[mpeg4 @ 0x17da5a0] timebase 1/1000000 not supported by MPEG 4 standard, the maximum admitted value for the timebase denominator is 65535
  Stream mapping:
    Stream #0:0 (dvdsub) -&gt; trim
    Stream #1:0 (dvdsub) -&gt; trim
    Stream #2:0 (dvdsub) -&gt; trim
    Stream #3:0 (dvdsub) -&gt; trim
    concat -&gt; Stream #0:0 (mpeg4)
  Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
  </code></pre>
  
  <p>OR is there a way to directly do this all in one step from splitting it to segments and again merging them together?</p>
  
  <p>It's important to keep the durations.</p>