Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a file that ends in .ts, which according to wikipedia is an MPEG2 file. I've never run into a file like this so I want it want the file to be in a more common format/container to use on multiple devices.

share|improve this question
up vote 17 down vote accepted

.TS files are technically just MPEG2 files at a very specific resolution. You can use pretty much any converter (avidemux, handbrake or even ffmpeg directly).

But the only reason to do so would be filesize. Mpeg2 files play pretty much everywhere. The only confusing part is the actual file-extension.

You can safely and freely rename them to .mpeg

PS. By turning it into Matroska, you just made is very hard for people on other systems to be able to play the file. I understand picking a free codec, and then choosing the appropiate container, but if you keep it at MPEG2, why change the container to something relatively obscure?

share|improve this answer
Thanks for clearing this all up! Renaming it seems to be exactly what I needed to get me video players to recognize the file. – Jorge Castro Sep 5 '10 at 17:55
A .ts file is an MPEG ‘transport stream’; it's not at all the same container as a ‘program stream’ (typically .mpeg). Resolution has nothing to do with it. Transport streams can contain multiple independent groups of video/streams, and have a load of error correction data (making .ts files bigger). They're typically used for broadcast systems where multiple channels are multiplexed and the transmission medium may be unreliable. For PC use where file integrity is (hopefully) assured, you will save space and improve compatibility by converting to a Program Stream. – bobince Sep 6 '10 at 7:29
This answer is wrong. There are two different container formats for MPEG: MPEG-PS (program stream) and MPEG-TS (transport stream). MPEG-PS files can be .mpeg, .mpg, .vob, etc. MPEG-TS files can be .ts, .mts, or something else. You cannot simply change the file extension to convert between them. But you can re-mux from one to the other without losing quality, retaining the same encoded video/audio streams from one container format to the other. BTW, Ralf's suggestion may appear to work but only in media players that ignore the file extension and support both formats anyway. – thomasrutter Nov 7 '12 at 9:01
Kees Cook's answer is the one that I would recommend following. – thomasrutter Nov 7 '12 at 9:05
According to who MKV is "obscure"? – Andrea Lazzarotto Aug 4 '14 at 11:36

I tend to recommend leaving files in their original state, as any conversion has a chance to introduce loss. The .ts video format is a container format for MPEG, known as "Transport Stream", which is used most frequently by digital broadcasting systems (digital cable, satellite, etc). Many applications are unfamiliar with how to decode it, since it has a very different multiplexing format than the more conventional MPEG container known as "Program Stream", which is what is used on DVDs, and what is produced by many encoder cards. The difference between TS and PS is only how the packet structure is built; the A/V data inside it is the same.

To get better interoperability, I recommend converting the container from TS to PS. Virtually every piece of software that can decode TS can decode PS, so it's almost always better to have PS file. One of the simplest remuxing tools I've found to use is avidemux. Just choose "copy" for the video and audio streams, and choose the "PS" container format for MPEG:


Then just save out the result. This can also be done using ffmpeg. You just need to select the copy codec for each stream type:

ffmpeg -i input.ts -vcodec copy -acodec copy output.mpg
share|improve this answer
How to see Avidemux's ffmpeg commands!? – Mr.Hyde Aug 20 '15 at 5:27

From looking at this forums thread I can make it into a matroska file, which I already use.

 ffmpeg -i input.ts -vcodec copy -sameq -acodec copy -f matroska output.ts

I was able to encode this despite this information the seems to indicate that I needed to compile ffmpeg from source. The downside to this is that it doesn't encode the file, so the file is as large as the MPEG2 file. More answers with recommendations for encoding .ts->MPEG4 would help me out.

share|improve this answer
See… for libx264 examples (converting to MPEG-4 AVC aka H.264). Or use Avidemux, WinFF etc if you want a nice UI for it. – bobince Sep 6 '10 at 7:39
-sameq doesn't do anything when using "copy" as the codec. Also it usually doesn't mean what people think it means - it doesn't preserve the same "quality" for example, but the same "q" factor. – thomasrutter Nov 7 '12 at 9:04
Plus there's no reason for the output file to have a ".ts" extension. "output.mkv" would be more appropriate and less misleading. – thomasrutter Nov 7 '12 at 9:04
@bobince How to see Avidemux's ffmpeg commands!? – Mr.Hyde Aug 20 '15 at 5:27

I usually use HandBrake to convert all kind of video files to iPhone-compatible format. Maybe you can use it to convert the .ts files into MP4. Check this HandBrake PPA to install it.

share|improve this answer

Actually .ts files are created by DVB-S/DVB-S2 tuners capable of recording transponder streams and can contain mpg2 AC3 AAC h264 mp3, as well as other data ie Teletext or EPG. .ts files contain in most cases just AV data but are not limited to that. VLC can play ts files directly and give You some info about some of the streams in it. Im personally using a sat tuner that records HD channels in .ts files (h264 video and in most cases multiple AAC mp3 mpg2 audio streams). So basically .ts files can contain many different things Its just container format created for sending digital broadcasts over loosy media. VLC can also convert betwen formats (hevent done this myself)

share|improve this answer
Please add details about the conversion process. – Anwar Shah Oct 20 '12 at 6:15
The information about TS formats looks all good, it's just that no info is given about the actual conversion process. – thomasrutter Nov 7 '12 at 9:05

The ffmpeg program has been deprecated in favor of avconv.

You can pass the same arguments to avconv to convert from transport stream to program stream mpeg or matroska.


avconv -i input.ts -acodec copy -vcodec copy output.mpg


avconv -i input.ts -acodec copy -vcodec copy output.mkv

share|improve this answer
Out of curiosity, deprecated by whom? – Thorbjørn Ravn Andersen Aug 11 '13 at 21:05
Avconf is a fork of ffmpeg which is still alive and actively developed. Don't believe the FUD that is spreading. See for yourself: and – thom Nov 16 '13 at 14:55

The handling of TransportStream files produced by DVB-S recorders depends on the contained video and audio stream. For material in SD quality it is likely that you can use a tool chain consisting of ProjectX and mplex to convert the stream into a standard MPEG container. If the video stream is HD, try MKVMerge to convert it into an MKV file. Both ways are described in detail this blog post.

share|improve this answer

protected by Community Dec 3 '12 at 13:50

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.