News:

--

Main Menu

Any chance to keep subtitles in TS files?

Started by M-Reimer, August 08, 2016, 04:22:42 PM

Previous topic - Next topic

M-Reimer

Hello,

I want to cut video in TS format. This seems to work well but the subtitle is removed when saving.

Would it be possible to keep the subtitle at least in the case, where the output format is TS, too?

Jan Gruuthuse

#1
Quote from: M-Reimer on August 08, 2016, 04:22:42 PM
Would it be possible to keep the subtitle at least in the case, where the output format is TS, too?

No, not with avidemux:

Quote from: mean on June 10, 2015, 02:51:06 PM
subtitles are discarded at the moment
(any non audio/video track actually)

Only way to keep subtitles is with mkv container.

extract subtitle with mkvtoolnix gui from original .TS
edit original .TS with avidemux, save into MKV (muxer)
edit subtitles with Aegisub Advanced Subtitle Editor to match .TS editing (timing, ...)
merge the edit subtile back into mkv with mkvtoolnix gui

http://www.aegisub.org/
https://mkvtoolnix.download
see previous posting: Soft subtitles in MKV and MP4 container

M-Reimer

I think this is not much fun as soon as I cut parts from within a recording, as this would mean that I have to edit subtitles at multiple places, right?

Is it planned to add this feature (direct cutting the subtitles "stream") to avidemux at some time?

Jan Gruuthuse

you load original subtitle, you can load video into subtitle editor, and adjust timings
it helps keeping timing track on paper where you cut.

M-Reimer

I wasn't even able to extract the subtitle using mkvtoolnix gui. I only have video and audio tracks. If I play the file in VLC, I have subtitles.

I haven't tried it, but I think adding subtitles in the way, you suggested, requires quite some work. So far I did my cutting with VDR which kept the subtitles without any additional work. In theory this shouldn't be that difficult, as all the information is already there.

Maybe I'll have a deeper look at the TS file format to find out where subtitles are saved. Maybe it is possible to auto-align the subtitle information from the source file to the cutted target file, but I think this only works if avidemux doesn't change time stamps.

mean

The tracks are not just copied
They are analyzed, extracted & reconstructed in the target file
Adding subtitles is not easy (i.e. need to extra them in a format agnostic way and resynthetize them later)


M-Reimer

#6
Seems like there are two possible formats for subtitles in TS and my "bitmap based" subtitle format, used in the recording, I want to cut, isn't supported by mkvtoolnix.

Currently I fail with analyzing the TS format. I couldn't find any good documentation. But if the tracks are reconstructed, I guess it wouldn't work to merge the subtitles from the original file anyway.

At least for the recordings, where I want to keep the subtitles, I'll have to find a way to keep cutting with VDR even though I want to replace it with Kodi on my HTPC.

Jan Gruuthuse


M-Reimer

Yes, the subtitles are bitmapped. May be similar to DVD, but the source is DVB-S2.


jjddav

#10
Hello,
sorry to come back on this topic but I can't understand the following.
Quote from: mean on August 08, 2016, 07:12:08 PM
The tracks are not just copied
They are analyzed, extracted & reconstructed in the target file
Adding subtitles is not easy (i.e. need to extra them in a format agnostic way and resynthetize them later)
Actually why is the audio treatment different than the subtitle treatment ?
when openning a TS file, extracting the subtitles operation is to associate the PID packets to a timestamp, using the PTS/DTS or the PCR, like for audio I guess.
No analysis of subtitles is necessary because they are only copied back in the TS file after cut is done.
i am not an expert in demux/remux but once the file part (adds for example) is cut, putting back the subtitles should be same operation than copying the audio and remuxing it with video. No?

The only operation I need to do is cut a part or more parts of the original TS file, then save the result by copying video/audio/subtitles in a new TS file.

If it can help, I have 2 examples of such files I got with subtitles, one from ASTRA 2 satellite (BBC4 HD channel with teletext subtitles):
http://davoult.free.fr/tmp/BBC4HD.TS

I made an analysis and export with TS Reader:

QuoteTransport Stream ID: 2061 (0x080d)

PMT PID 16 (0x0010) - Network

PMT PID 259 (0x0103) - Program 8952

Program Number: 8952
Descriptor: Multiplex Buffer Utilization Descriptor
Bound Valid Flag: 1
LTW Offset Lower: 180 Upper: 180

Stream Type: 0x1b H.264 Video PID 5300 (0x14b4)
Descriptor: Stream Identifier Descriptor
0b .
Descriptor: Private Data Indicator Descriptor
4f 54 56 00 OTV.
Descriptor: User Private Descriptor: 0xfe
48 44 56 00 HDV.

Stream Type: 0x03 MPEG-1 Audio PID 5302 (0x14b6)
Descriptor: Stream Identifier Descriptor
07 .
Descriptor: ISO639 Language Descriptor
Language: NAR
Audio type: undefined
Descriptor: Private Data Indicator Descriptor
4f 54 56 00 OTV.
Descriptor: User Private Descriptor: 0xfe
41 55 44 32 AUD2

Stream Type: 0x06 Teletext/VBI PID 5303 (0x14b7)
Descriptor: Stream Identifier Descriptor
04 .
Descriptor: Teletext Descriptor
Language: eng Type: Teletext subtitle page Magazine: 0x00 Page: 0x88
Language: eng Type: Initial Teletext page Magazine: 0x00 Page: 0x88
Descriptor: Private Data Indicator Descriptor
4f 54 56 00 OTV.
Descriptor: User Private Descriptor: 0xfe
53 55 42 00 SUB.

Stream Type: 0x06 Dolby AC3 Audio PID 5301 (0x14b5)
AC3: Bitrate 192 Kbps Sample Rate 48 KHz
AC3: Mode complete main Coding 2/0 L, R
AC3: Dolby Surround Mode Not Dolby Surround
AC3: LFE Mode Off Dialogue normalization -23 dB
Descriptor: Stream Identifier Descriptor
08 .
Descriptor: ISO639 Language Descriptor
Language: eng
Audio type: undefined
Descriptor: AC3 Audio Descriptor
Flags: AC3 Type: False BSID: False Main ID: False ASVC: False
Descriptor: Private Data Indicator Descriptor
4f 54 56 00 OTV.
Descriptor: User Private Descriptor: 0xfe
41 43 33 00 AC3.


and the second file from french DTT, channel TF1 HD with DVBSUB subtitles:
http://davoult.free.fr/tmp/TF1HD.ts

here is the export after analysis with TSReader of the interrested part:

QuoteTransport Stream ID: 6 (0x0006)

PMT PID 100 (0x0064) - Program 1/1537 TF1

Program Number: 1/1537 TF1

Stream Type: 0x1b H.264 Video PID 120 (0x0078)
H.264 Video: Resolution 1920 x 1080 Interlaced: 1

Stream Type: 0x06 ISO/IEC 13818-1 PES packets containing private data PID 130 (0x0082)
Descriptor: ISO639 Language Descriptor
Language: fra
Audio type: undefined
Descriptor: Enhanced AC-3 Descriptor
80 c2 ..

Stream Type: 0x06 ISO/IEC 13818-1 PES packets containing private data PID 131 (0x0083)
Descriptor: ISO639 Language Descriptor
Language: qaa
Audio type: undefined
Descriptor: Enhanced AC-3 Descriptor
80 c2 ..

Stream Type: 0x06 ISO/IEC 13818-1 PES packets containing private data PID 132 (0x0084)
Descriptor: ISO639 Language Descriptor
Language: qad
Audio type: undefined
Descriptor: User Private Descriptor: 0x7f
06 85 66 72 61 ..fra
Descriptor: Enhanced AC-3 Descriptor
80 c2 ..

Stream Type: 0x06 ISO/IEC 13818-1 PES packets containing private data PID 150 (0x0096)
Descriptor: Subtitling Descriptor

Stream Type: 0x06 ISO/IEC 13818-1 PES packets containing private data PID 151 (0x0097)
Descriptor: Subtitling Descriptor

Stream Type: 0x05 ISO/IEC 13818-1 private_sections PID 170 (0x00aa)
Descriptor: Application Signalling Descriptor
80 10 e0 ...

thanks if someone could check this if possible. Other topics related to that TS subtitles subject:
http://avidemux.org/smif/index.php?topic=12392.0
http://www.avidemux.org/smf/index.php/topic,10661.0.html


zakk

Remuxe ton .ts avec mkvtoolnix et utilise l'onglet "cible" pour faire tes coupes avec des index temporels. Sinon tu vas galérer. Je viens d'essayer ça marche il garde les sous-titres.

bernd_b

Well, the only things I can add:

ffmpeg can handle dvb-subtitles (both - the bitmap based dvbsub and the textfiles based broadcast in the teletext-stream). I had success with cutting ts files including the subtitle streams using ffmpeg with the "copy" de/encoder. Because ffmpeg is only commandline based, that is of course a hard way to succeed.

To preserve subtitle streams with avidemux2 while using copy mode would be a vervy welcomed feature from my side too.



jjddav

Quote from: bernd_b on April 17, 2017, 10:39:35 PM
To preserve subtitle streams with avidemux2 while using copy mode would be a vervy welcomed feature from my side too.
Yes, sure, we are not the only ones who are requesting this feature.
And I still don't understand why this is so difficult to implement it, as DVBSUB insert mechanism is quite the same than audio in TS mode.