Log in

View Full Version : Best way to demux M2TS/MKV HEVC 4K HDR streams ?


Nico8583
12th April 2019, 17:45
Hi,
I would like to know the best way to demux a M2TS or MKV 4K HDR file ?
I believe eac3to can do that and tsMuxeR too but I don't know if there are some others (better?!) tool ?
Thank you !

FranceBB
14th April 2019, 06:23
Extracting the .h264 or .h265 track inside the container?
If it's an mkv, I use MKVExtract GUI (or MKVClever).
If it's an mp4, I use mp4box.
If it's something else, like an m2ts, I generally use ffmpeg to extract the tracks directly. (Eventually, you could remux to mkv and extract the tracks from the remuxed mkv if ffmpeg fails for whatever reason).

Nico8583
14th April 2019, 08:59
Thank you, I didn't know ffmpeg can extract tracks. It can extract only video streams or also audio and subtitles and even chapters ? Thank you.

FranceBB
14th April 2019, 21:50
I never used it to extract chapters, only video and audio tracks, so I don't actually know.

foxyshadis
15th April 2019, 06:09
Most people parse the chapter names out of ffprobe. I don't know of a good general round-trip tool for those, other than mkvinfo for mkv. If you're fine with some scripting, though, you can use one of these suggestions (https://stackoverflow.com/questions/30305953/is-there-an-elegant-way-to-split-a-file-by-chapter-using-ffmpeg) and replace the part that splits the file with simply saving the chapters in your favorite format.

frank
22nd May 2019, 15:56
To get chapters from mkv with ffmpeg extract metadata.

ffmpeg.exe -i input.mkv -f ffmetadata ffchap.txt

ffchap.txt:
;FFMETADATA1
title=movie title
encoder=Lavf58.27.103
[CHAPTER]
TIMEBASE=1/1000000000
START=0
END=540000000000
title=chapter 01
[CHAPTER]
TIMEBASE=1/1000000000
START=540000000000
END=1204459000000
title=chapter 02
[CHAPTER]
...This meta data file can be loaded again with -i at encoding.

stax76
22nd May 2019, 19:06
@Nico8583

It depends, to rip DVD/BR I always suggest MakeMKV and mkvextract.

videoh
22nd May 2019, 20:11
Won't talk about "best" but DGIndexNV can do the demuxing job as well.

Nico8583
23rd May 2019, 18:09
@stax76 : I'll try it, thank you ;)
@videoh : Thank you but I don't have a Nvidia graphic card :/

an3k
31st May 2019, 01:30
You have the following options:

- eac3to
- ffmpeg
- DGIndex (that's the one not requiring a graphics card video encoder)
- tsMuxeR

In case it's a MKV you additionally can use

- mkvextract (ideally with its GUI gMKVExtractGUI)


eac3to can even read a whole Blu-ray structure and list you the various playlists and after selecting one the various streams. It's also very easy to use and can automatically encode audio streams to other formats while demuxing.

ffmpeg can do everything but I don't know how.

DGIndex is nice if you want to index the video stream so you can further process it with AviSynth. It's ability to demux is just a "nice to have".

tsMuxeR is made for demuxing and remuxing but since it doesn't get updated anymore it has problems with some Blu-rays. I just noticed one of its problems lately where it corrupted the video stream. There were massive decolorations through the whole video stream.

mkvextract works flawlessly for MKV but gMKVExtractGUI can't work with some 4K content.