I have a bunch of MPEG-TS files, originally created by a hardware TV-recorder. ffprobe lists their content like so:

Input #0, mpegts, from 'recording.ts':
  Duration: 02:14:57.67, start: 87544.254878, bitrate: 4386 kb/s
  Program 12003 
  Program 12060 
    Stream #0:0[0xa7]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, top first), 720x576 [SAR 64:45 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x88](ger): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 192 kb/s (clean effects)
    Stream #0:2[0x48]: Unknown: none ([5][0][0][0] / 0x0005)
    Stream #0:3[0x47](ger): Subtitle: dvb_teletext ([6][0][0][0] / 0x0006)
    Stream #0:4[0x4a](deu): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)
    Stream #0:5[0xfb]: Unknown: none ([11][0][0][0] / 0x000B)
    Stream #0:6[0xfc]: Unknown: none ([12][0][0][0] / 0x000C)
  Program 12061 
  Program 12095 
Unsupported codec with id 0 for input stream 2
Unsupported codec with id 94215 for input stream 3
Unsupported codec with id 0 for input stream 5
Unsupported codec with id 0 for input stream 6

I want to re-encode these files for archiving, at the same time

  • trimming unnecessary runtime before movie start and after end: -ss and -t cut out segments, the concat protocol merges them together seamlessly without re-encoding.

  • cutting out advertisement blocks: The trim filter cuts with frame-precision.

  • cropping away letterboxes: The crop filter eliminates black bars.

The resulting command line looks somewhat complex. It cuts out audio and video of two segments, resets PTS for continuity, concatenates and crops them. All of this is then encoded and merged into an MKV container.

ffmpeg -i in.ts -filter_complex '
' -map '[v]' -map '[a]' -c:v libx264 -c:a libvorbis out.mkv

All of this works so far. But, as seen above, the original file also contained subtitles, on stream 4, encoded as dvb_subtitles. I now want to incorporate these into the filtergraph.

I already tried to add split, trim, setpts and concat steps for the stream and a corresponding -map. This works fine, but encodes the subtitles with x264 resulting in additional video stream. So I added -codec:2 dvbsub and get Invalid encoder type 'dvbsub', despite ffmpeg -coded lists dvbsub as both an encoder and decoder.

How can I keep the subtitles throughout this process? A pure ffmpeg solution would be perfect, but perhaps another tool is able to handle the subtitles better.

1 Answer 1


I've written a software which you can download here:

VideoCut is a graphical tool that cuts mpegts files and converts the implicitly into PS streams. If you don't re-encode, it runs very fast. If not it takes some time, but you get a very precise cut. VideoCut has been tested on debian and Arch systems.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .