Convert .ts to .mkv : subtitles dropped #1843

Closed
GingkoFr opened this Issue Dec 30, 2016 · 9 comments

Projects

None yet

3 participants

@GingkoFr

Hello,

I have an issue when I want to use MKVToolNix (v9.7.1) to convert Mpeg .ts transport stream files (with usually one H264 video, multiple E-AC3 audio tracks, and multiple DVBSUB subtitles tracks).

When converting, I get the new .mkv correctly with all of its sound tracks, but all subtitle tracks are lost (MKVToolNix doesn't even see them on opening).

However, if I first convert these very same .ts files to .mkv using another software (that is, VideoReDo TVSuite), and next if I open the resulting .mkv files with MKVToolNix, I get the very same video and audio tracks, but that time all subtitles tracks are present and working.

The .ts files that I use as input are raw recordings of .ts DVB-T TV broadcasts, without no changes excepting hard filtering of the TS packets not concerning the channel I want to record (as there are up to 6 TV channels in one of these broadcast multiplex), selected on their PIDs. I am myself the developer of the recording software.

Would it be possible to fix this ? If MKVToolNix is able to handle these subtitles tracks in .mkv files, I think it shouldn't be very hard to find them in a .ts file.

I can eventually provide .ts files if requested.

Regards

@mbunkus
Owner
mbunkus commented Dec 30, 2016

At the moment mkvmerge doesn't handle DVBSUBs. I don't have plans for adding support for them.

Note that the Matroska container format doesn't have specs for DVBSUBs either. I don't know how other software stores them in Matroska, but if it's not with a codec ID listed here then it's technically a violation of the specs.

I'll leave this open as a feature request for the time being. Please upload sample files (more than one, preferably) to my FTP server so that I'll have something to work with should I ever decide to tackle this. Thanks.

@mbunkus mbunkus added this to the later milestone Dec 30, 2016
@GingkoFr

Ok. I will prepare this, likely later today.

Nevertheless, you just said that mkvmerge doesn't handle DVBSUBs (or MKVToolNix? What difference between mkvmerge and MKVToolNix? I actually use MKVToolNix GUI).

But MKVToolNix obviously recognize them as S_DVBSUB in the track list if read from .mkv, and can recopy them in the newly generated files. This implies at least a tiny existing support, isn't it?

mkvtoolnix_dvbsub

Regards,
Gingko

@mbunkus
Owner
mbunkus commented Dec 30, 2016

mkvmerge is the program doing the actual work. The GUI only queries mkvmerge for the tracks and later instructs mkvmerge how to multiplex.

There's a difference between reading from TS and from Matroska files. When mkvmerge reads from any container other than Matroska it must know how to convert the storage format used in the source container to the storage format used in Matroska. This is not the case for DVBSUB, therefore those tracks aren't recognized when mkvmerge reads the TS file.

When mkvmerge reads from a Matroska file it can use a special "pass-through" mode for codecs that it doesn't support otherwise. The reason is that the data is already stored the way it's supposed to be, and mkvmerge can simply keep it intact. That's what's happening here. It doesn't know how to handle DVBSUBs in general and uses the pass-through mode for that track when reading it from Matroska files.

@GingkoFr
GingkoFr commented Dec 30, 2016 edited

Ok. I just uploaded 4 files in the /upload/bug_1843 folder.
There are two .ts files, each being one minute excerpts from captured movies, along with their .mkv counterparts after conversion by VideoReDo (the one minute .ts extractions were also made using VideoRedo).

  • The file sample1_hv.ts has three audio tracks (fra=French, qad=Audio description, qaa=Original language, actually English) and two DVBSUB tracks (French for hearing impaired and French).
  • The file sample1_hv.mkv is the counterpart of sample1_hv.ts after conversion using VideoRedo.
  • The file sample2_sm.ts has four audio tracks (same as previous plus deu=German) and three DVBSUB tracks (same as previous plus one German, but this latter one seems to be actually empty).
  • The file sample2_sm.mkv is the counterpart of sample2_sm.ts after conversion using VideoRedo.

By the way, your FTP server seems to be quite hard to use without using FileZilla (I tried first with the FireFTP extension for Firefox, but I finally used the command line ftp client from my own Linux server).

Regards,
Gingko

@mbunkus mbunkus added a commit that referenced this issue Dec 31, 2016
@mbunkus MPEG TS reader: add support for reading DVB subtitles from MPEG trans…
…port stream

Implements #1843.
d1475d4
@mbunkus
Owner
mbunkus commented Dec 31, 2016

I've implemented support for DVB subtitles. I've also written a pull request for the Matroska specification that adds the storage format used with S_DVBSUB to the official specs.

@mbunkus mbunkus closed this Dec 31, 2016
@mbunkus
Owner
mbunkus commented Dec 31, 2016

If you want to give it a try, download the latest pre-builds for Windows. Build numbers 01390 and higher container the feature.

@GingkoFr

Hello Moritz,

Thank you very much, that looks great !
I just tried it, and it seems working very well.
Note that after your comments, I checked and indeed this seems to be not very well implemented so far.
Actually the only software that I have and that is able to display these subtitles is MPC HC.
Even VLC doesn't work properly with these subtitles (although it can display DVBSUB if read from a .ts file; but when opening a .mkv with DVBSUB, it gives an error message).
And in VideoRedo, some comments in their forum lets me thinking this is actually quite experimental.

There is something that puzzles me a little, however.
If I open a video converted by VideoRedo with MKVToolNix, there are some lines named “tags” at the end of the stream list which can be modified if a remux the video and reopen it. But if I convert a .ts file to .mkv using your software, none of these tags are present, even if I reopen a remuxed video.
What are these tags, exactly? What difference does it made if they are present or not present? Why could I want to have them, or to discard them in a given video?

Regards,
Gingko

@mbunkus
Owner
mbunkus commented Dec 31, 2016

Tags are user-supplied, textual descriptions about the content, e.g. which actors played in a movie, a plot summary or whatever else you want. Some programs write tags automatically. VideoRedo's includes the track's language as tags as well even though that's completely superfluous as the track headers contain that property already.

@ZexaronS
ZexaronS commented Jan 24, 2017 edited

Many many thanks for adding DVB Subtitle support for this key tool, part of my occasional archival process, I tend to do good slow encodes with x265, every now and then I have to split things up or stop the process which makes partial files and MKVToolNix is perfect for merging that, even has warnings for types of glitchy merges that end up being playable but broken, now lets hope Handbrake follows suit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment