justdan96 / tsMuxer

tsMuxer is a transport stream muxer for remuxing/muxing elementary streams, EVO/VOB/MPG, MKV/MKA, MP4/MOV, TS, M2TS to TS to M2TS. Supported video codecs H.264/AVC, H.265/HEVC, VC-1, MPEG2. Supported audio codecs AAC, AC3 / E-AC3(DD+), DTS/ DTS-HD.
Apache License 2.0
863 stars 144 forks source link

MP4/MOV error: invalid stts index for SRT track #3 at position 93140082 #673

Closed TheSpider12 closed 1 year ago

TheSpider12 commented 1 year ago

Hi. Got this error when I tried to extract the english subtitle from episode 3 of I Am Groot. File name is I.Am.Groot.S01E03.2160p.DSNP.WEB-DL.DDP5.1.Atmos.DV.MP4.x265-DVSUX

image

jcdr428 commented 1 year ago

@TheSpider12 can you please test and report whether older versions of tsMuxer were able to complete the mux ?

TheSpider12 commented 1 year ago

@TheSpider12 can you please test and report whether older versions of tsMuxer were able to complete the mux ?

I tried the oldest version I have in my pc and the issue is still there. I think this version is from June last year. How far back in version should I go? image

jcdr428 commented 1 year ago

@TheSpider12 try e.g. Jan-22, Jul-21 and Jan-21.

TheSpider12 commented 1 year ago

@TheSpider12 try e.g. Jan-22, Jul-21 and Jan-21.

I tried those and couldn't even add the file. It was just blank. Out of 6 episodes of that series, only 1 and 4 can be added, the rest just show blank.

adrianlopezgalera commented 1 year ago

It has also happened to me with some movies. I think it may be due to the presence of unrecognized characters in UTF-8 present in the subtitles. When that same .str file is extracted with programs like MkvToolnix, it shows unrecognizable characters.

Regards.

jcdr428 commented 1 year ago

@Julvenzor it is an index issue ( the index counting for 3gp subtitles is one more than what it should be). I spent one hour analysing the iso standard and the code to find the issue without success.

TheSpider12 commented 1 year ago

@Julvenzor it is an index issue ( the index counting for 3gp subtitles is one more than what it should be). I spent one hour analysing the iso standard and the code to find the issue without success.

Update on the issue: -With the latest tsmuxer version, all episodes when remuxed into m2ts have no video, only audio. This is a separate problem, not the subtitles issue mentioned in this thread. -Using the older tsmuxer version below, no video and audio issue. Only episode 3 has the subtitles issue. Other episodes are fine. image

jcdr428 commented 1 year ago

@TheSpider12 I guess the DV are profile 5, therefore linked to issue #662.

jcdr428 commented 1 year ago

@ValZapod I have identified the problem: The chunks in the tx3g should come in pairs: the first chunk is the string for the subtitle, the second chunk is an empty string to stop showing the subtitle. The track #3 tx3g is malformed in the sense that the last subtitle is not followed by an empty chunk / will not clear, and will be shown until end of video (this can be checked in VLC or here https://trac.ffmpeg.org/ticket/7855 ).

There might be some other tracks with the same "defect", however in this case track #3 is the first track coming to last subtitle.

tsMuxeR assumes the chunks come in pair, see lines 424 and 425 of https://github.com/justdan96/tsMuxer/blob/9e00ea34d5d6a2bc771201fc0fc0a0fcfa62f3f9/tsMuxer/movDemuxer.cpp#L424

I will investigate solutions.

jcdr428 commented 1 year ago

Ok, not that simple: there is also the case when the subtitle chunk is directly followed by another subtitle chunk, without any empty chunk. So quite a lot of code to change...

jcdr428 commented 1 year ago

@TheSpider12 please try tomorrow's release.

jcdr428 commented 1 year ago

@ValZapod error is when video width or height is smaller than subtitle bitmap width or height. https://github.com/FFmpeg/FFmpeg/blob/261fb55e393a16ebebd0e0a4b16b2f84e6b2f43d/libavcodec/pgssubdec.c#L294

In this case (video is 2160px width) this should not happen.

jcdr428 commented 1 year ago

tsMuxer converts the subtitle text files to PGS.