How can I convert a .m2ts to .mkv?

Does anyone know of an application that allows me to convert an m2ts file to mkv or some other format? Preferably something that allows me to convert it directly, rather than convert the whole Blu-ray disc. hddump didn't work because it doesn't convert only the m2ts file, and the contents are on a .iso that I mounted virtually.


Solution 1:

ffmpeg Install ffmpeg

I think ffmpeg will do the job it's quite simply copy all the streams and output them in an mkv container. No information is lost/re-encoded.

ffmpeg -i input.mt2s -scodec copy -acodec copy -vcodec copy -f matroska input.mkv

Solution 2:

With Handbrake you can convert all kinds of files:

Supported Sources:

  • Any DVD or Bluray-like source: VIDEO_TS folder, DVD image, real DVD or bluray (unencrypted -- removal of copy protection is not supported), and some .VOB, .TS and M2TS files
  • Most any multimedia file it can get libavformat to read and libavcodec to decode.

Outputs:

  • File format: MP4(M4V) and MKV
  • Video: MPEG-4(ffmpeg), H.264(x264), or Theora(libtheora)
  • Audio: AAC, CoreAudio AAC (OS X Only), MP3, or Vorbis. AC-3 pass-through, DTS pass-thorugh (MKV only)"

Solution 3:

The easiest tool to use is mkvmerge, which is part of the mkvtoolnix package. To convert your file:

sudo apt-get install mkvtoolnix
mkvmerge -o output.mkv input.m2ts

Example output:

mkvmerge v6.1.0 ('Old Devil') built on Mar  4 2013 20:24:55
'input.m2ts': Using the demultiplexer for the format 'MPEG transport stream'.
'input.m2ts' track 0: Using the output module for the format 'AVC/h.264'.
'input.m2ts' track 1: Using the output module for the format 'AC3'.
'input.m2ts' track 2: Using the output module for the format 'PGS'.
The file 'output.mkv' has been opened for writing.
'input.m2ts' track 0: Extracted the aspect ratio information from the MPEG-4
 layer 10 (AVC) video data and set the display dimensions to 1920/1080.
Progress: 100%
The cue entries (the index) are being written...
Muxing took 4 minutes 20 seconds.