I'm looking for a tool for Linux which can segment a video file into multiple small .ts files.

I know one for Mac OS X called Media File Segmenter which is a simple command line tool - I'm looking for an equivalent tool for Linux.


Others have mentioned ffmpeg; it now has a nice, clean segment muxer. On Linux, instead of relying on whatever (outdated) version of ffmpeg comes with your package manager, you should download a static build or compile it from source.

To split a video into several one-minute segments, also generating an m3u8 playlist & copying all streams (so lossless, but not entirely accurate cutting):

ffmpeg -i input.mpg -c copy -f segment \
-segment_time 60 -segment_list list.m3u8 output%03d.ts

For accurate splitting, the documentation recommends re-encoding and using -force_key_frames to ensure that there will be I-frames on the times that the segment muxer will attempt to split on (see also the libx264 and AAC encoding guides on the ffmpeg wiki):

ffmpeg -i input.mpg -c:v libx264 -crf 22 -preset veryfast -c:a libfdk_aac -vbr 3 \
-force_key_frames expr:gte(t,n_forced*60) -f segment \
-segment_time 60 -segment_list list.m3u8 output%03d.ts
| improve this answer | |
  • 1
    Wich I could give you two upvotes so this sits on top of the two other posts with the sameq in them ;) – slhck Mar 27 '13 at 21:23

if you want to cut video from H.264 you should use:

ffmpeg -i Black_Lagoon_E10.mkv -ss 00:08:55 \
-c copy -t 00:00:32 \
-vbsf h264_mp4toannexb -f mpegts Ostanovites.ts
| improve this answer | |

Try ffmpeg. It's powerful & cross-platform. It may already exist in your linux distro. To copy 2 minutes of video after the first and convert from mpg to ts:

ffmpeg -vcodec copy -ss 00:01:00 -t 00:03:00 \
       -i input.mpg -vcodec copy -acodec copy \
       -f mpegts output.ts

It's a good choice if you have lots of videos in essentially random formats. It's a 'swiss army knife' for video.

If you are starting with mpeg, you could also try mpegtx, which includes a variety of mpeg tools including a splitter. Easier IMHO than ffmpeg to split. To split a file into 10 chunks each with a basename of 'chunk':

mpgtx -10 input.mpg -b chunk

You may also be able to use VLC as a splitter, but I never have. There are topics discussing it, however.

| improve this answer | |

Try dvbcut if you want something with a UI.

enter image description here

| improve this answer | |
  • Sorry if I missed it, but it seems to only work with DV or similar formats, not with, say, H.264 encoded video? – rbrito Dec 11 '14 at 6:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy